域名的Google全球地址列表限制为250个结果[rehash](Google Global Address List for Domain limited to 250 results [rehas

编程入门 行业动态 更新时间:2024-10-27 20:39:23
域名的Google全球地址列表限制为250个结果[rehash](Google Global Address List for Domain limited to 250 results [rehash])

由于缺乏答案而重新发布

我正在尝试查询特定域名的Google全球地址列表,由此答案引导(特别是Jay Lee的回答)。

这一切都很好,并且在Google的OAuth Playground中完美运行,但它似乎仅限于250个用户。 鉴于此功能似乎完全没有记录,并且我无法通过查看他们的github repo(特别是此文件)来判断,是否有人知道如何查询下一个250个用户或如何设置结果数量?

谢谢!

Reposting due to lack of answers

I'm trying to query Google Global Address List for a specific domain, being led by this answer here (Specifically the answer by Jay Lee).

It's all well and good and works perfectly in Google's OAuth Playground, however it seems to be limited to 250 users. Given that this feature seems completely undocumented, and that I can't tell by looking at their github repo (specifically this file), does anyone know how to query for the next 250 users or how to set the number of results?

Thank you!

最满意答案

我的最后一个答案被转换成评论,但我现在对这个问题有一个完整的答案。

编辑 :我反复提到JSON,但你不需要在JSON中解析它以获得syncToken。 无论如何,Google都会为您提供syncToken。

Google GAL API似乎与Google日历或YouTube API的“nextPageToken”参数类似,只要您有令牌,就可以查询下一页结果。

Google GAL使用“syncToken”参数作为替代。 与其他Google API非常相似,如果您将此syncToken附加到网址的末尾,您将获得下一页结果。 请注意,我无法使startIndex参数起作用(这允许您从JSON中的特定项开始),因此如果您尝试通过查询获取特定结果,则很可能必须解析整个JSON文件。 在解析的JSON中,应该有一个名为“gal $ syncToken”的密钥。 您可以在“条目”键/数组之前的json中找到它,这是列出所有全局域联系人的位置。

以下是它的外观示例:

"gal$syncToken": { "$t": "0_1001_17011_AAN3FFNH2AEJ3SFBKZDRS36AHRXHND47YACXLGFJF5QBXCSQLUK57EX3LC765CU5IWG6ZXWHPS5WKHSDFJ26LRI5FRIVIQ3Z532PWKG3ZG45JW3RVCDZMWK5LLLHZSCBTJH5U6Q4LZRG4PKWQE42AOIPC4VJCZQIP5MBJHNUBZZJNLKISKETTQ6DNTRAPTI" },

您的syncToken看起来会有所不同。 要获得下一页结果,Google实际上提供了一个已预先附加了syncToken的链接:

{ "rel": "next", "type": "application/atom+xml", "href": "https://www.google.com/m8/feeds/gal/example.com/full?sync-token=0_1001_17011_AAN3FFNH2AEJ3SFBKZDRS36AYRXHND47YACXLGFJF5QBXCSQLUK57EX3LC765CU5IWG6ZXWHPS5WKHSDFJ26LRI5FRIVIQ3Z562PWKG3ZG45JW3RVCDZMWK5LLLH6SCBTJH5U6Q4LZRG4PKWQE42AOIPC4VJCZQIP5MBJHNUBZZJNLKBSKETTQ6DNTRAPTI" },

但是,这只会为您提供接下来的250个结果。 如果您想在每个页面上添加更多内容,可以将max-results参数附加到此页面,然后让Google以JSON格式将其吐出。

https://www.google.com/m8/feeds/gal/example.com/full?sync-token=INSERT_SYNCTOKEN_HERE&alt=json&max-results=10000

希望这有助于任何人看到这一点 Google GAL似乎在很大程度上没有记录,我无法在互联网上的任何其他地方找到这个问题的答案。 如果谷歌的任何人都能确认这是实现这一目标的最佳方法,那就太棒了!

My last answer was converted into a comment, but I now have a complete answer to this question.

EDIT: I repeatedly mention JSON but you don't need to parse this in JSON to get the syncToken. Google will provide you the syncToken regardless.

The Google GAL API seems to operate in a similar manner to the Google Calendar or YouTube API's "nextPageToken" parameter, which allows you to query the next page of results as long as you have a token.

The Google GAL uses the "syncToken" parameter as a replacement. Much like the other Google API's, if you append this syncToken to the end of your URL, you will get the next page of results. Note that I was unable to get the startIndex parameter to work (which allows you to begin at a specific item in the JSON), so if you are trying to get a specific result through the query you will most likely have to parse the entire JSON file. Inside the parsed JSON, there should be a key called "gal$syncToken." You can find it in the json right before the "entry" key/array which is where all of the global domain contacts are listed.

Here is an example of what it would look like:

"gal$syncToken": { "$t": "0_1001_17011_AAN3FFNH2AEJ3SFBKZDRS36AHRXHND47YACXLGFJF5QBXCSQLUK57EX3LC765CU5IWG6ZXWHPS5WKHSDFJ26LRI5FRIVIQ3Z532PWKG3ZG45JW3RVCDZMWK5LLLHZSCBTJH5U6Q4LZRG4PKWQE42AOIPC4VJCZQIP5MBJHNUBZZJNLKISKETTQ6DNTRAPTI" },

Your syncToken will look different. To get the next page of results, Google actually provides a link that already has the syncToken pre-appended:

{ "rel": "next", "type": "application/atom+xml", "href": "https://www.google.com/m8/feeds/gal/example.com/full?sync-token=0_1001_17011_AAN3FFNH2AEJ3SFBKZDRS36AYRXHND47YACXLGFJF5QBXCSQLUK57EX3LC765CU5IWG6ZXWHPS5WKHSDFJ26LRI5FRIVIQ3Z562PWKG3ZG45JW3RVCDZMWK5LLLH6SCBTJH5U6Q4LZRG4PKWQE42AOIPC4VJCZQIP5MBJHNUBZZJNLKBSKETTQ6DNTRAPTI" },

However, this will only give you the next 250 results. If you want more on each page, you can append the max-results parameter to this and have Google spit it back out in JSON format.

https://www.google.com/m8/feeds/gal/example.com/full?sync-token=INSERT_SYNCTOKEN_HERE&alt=json&max-results=10000

Hope this helped anyone seeing this. The Google GAL seems to be largely undocumented for the most part and I was unable to find an answer to this question anywhere else on the internet. If anyone from Google can confirm that this is the best method for accomplishing this that would be great!

更多推荐

本文发布于:2023-07-15 05:31:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1110699.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:地址   域名   全球   列表   Google

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!