0

I am using Zend's gdata library for the Google Apps provisioning API. Since Zend doesn't yet support fetching org users (no retrieve function provided by the library for this feed), I am making a custom gdata query to the url (as suggested in the documentation developers.google.com/google-apps/provisioning/#retrieving_organization_users_experimental):

apps-apis.google.com/a/feeds/orguser/2.0/'.$customerId.'?get=all

This works well for <= 100 users.

Now, I have created a domain with 125 users across 5 OUs. When I fetch the above URI, I get the 1st 100 users (as documented and expected). However, I could not find the pagination link mentioned here: developers.google.com/google-apps/provisioning/reference#Results_Pagination

Here's the start of my orguser feed:

<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:apps='http://schemas.google.com/apps/2006'><id>https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx</id><updated>2013-01-06T08:17:43.520Z</updated><**link rel='next' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all&amp;startKey=RASS03jtnz0s2orxmbn.**'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxx'/>

I tried the https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all&amp;startKey=RASS03jtnz0s2orxmbn. link but it gives me the exact same 100 users that the https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all link gives. This is the only occurrence of the word "next" in my feed and so there is not other URI I can try to fetch the next 25 users.

So I have only been able to get 100 users from this API call. How do I go about fetching the next 25 users? Examples/code would be really appreciated. Or what am I doing wrong?

Please help - this is blocking an urgent delivery.

Thanks!, Vinay.

Rohan
  • 52,392
  • 12
  • 90
  • 87
  • The OrgUser API is _Experimental_, and is very unstable.... I recommend against its use for any serious thing https://developers.google.com/google-apps/provisioning/#managing_organization_users – user454322 Apr 24 '13 at 06:12

1 Answers1

0

Your 2nd request should look like:

https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxx?startKey=RASS03jtnz0s2orxmbn&get=all

startKey should be set to the value of the next parameter and get should continue to be all for each page request.

Also, make sure the URL is decoded, if & is encoded as &amp; in the request, then Google's servers will see all of all&amp;startKey=RASS03jtnz0s2orxmbn as the value of get and it won't see a startKey parameter at all.

Jay Lee
  • 13,415
  • 3
  • 28
  • 59