This article explains how to use paginated version of Company Users Get API. This API is called to return all users of a company.
URL:
There are two additional parameters: limit and lastUserGuid.
limit - maximum number of users in returned list (default max is 12,000)
lastUserGuid - defines last user (and its integer userId) from previous page. So every user on current page should correspond to condition: user.UserId > userId
A HTTP header called Syncplicity-Next-Page-Location is returned in the response with URL of the next page.
Header is only set if there is more data in the batch.
In the table below, some use cases are described:
Limit |
lastUserGuid (Only last 3 digits shown here) |
Number of users in the organization |
Number of users Returned |
Returned list begins from user Id |
'Syncplicity-Next-Page-Location' header value |
null |
null |
100 |
100 |
1 |
null |
null |
010 |
100 |
90 |
11 |
null |
10 |
null or 000 |
100 |
10 |
1 |
|
10 |
005 |
100 |
10 |
6 |
|
100 |
000 |
100 |
100 |
1 |
null |
null |
100 |
100 |
0 |
0 |
null |
null |
null |
10000 |
1000 (default) |
0 |
|
FAQ:
1. What is userGuid? How do I obtain it?
You can use following Get User API to retrieve information about a user. The value returned in "Id" is the Guid of the user.
https://api.syncplicity.com/provisioning/user.svc/<useremailaddress>
2. What will happen if a new GET is called after the last page?
When you don’t see the Http Header Syncplicity-Next-Page-Location in the response, that means it is the last page, no need to do further GET calls.
If you still call GET, the response will be 200 OK, but response body will be empty.
For example, if the last user’s guid is 9ef91ac8-c5b6-4c8f-bb16-b25e569b0b4f and you call GET as below,
You will get a 200 OK response with empty body.