Hi,
The API documentation in general talks about paging in the platform:
## API Paging
(https://developer.genesys.cloud/api/rest/tips/#api-paging)
Seriously, who has a pager these days?
No, no, not that kind of paging. There are many resources in the Platform API that can return very large data sets. To avoid always sending large amounts of data in a response, these resources implement the concept of paged results. When a request is made to a resource with paged results, the resource will return the default number of results for the first page. To retrieve more results, the request can either specify a larger value for *pageSize* or retrieve subsequent pages by specifying *pageNumber* .
For example, calling `GET /api/v2/users` without any parameters will return 25 results. To get more results, the request can be modified as `GET /api/v2/users?pageSize=50` to return 50 results per page (getting users 1-50). Typically, the max *pageSize* for paged resources is 500. Additionally, to retrieve the second page of the default number of results the request can be modified as `GET /api/v2/users?pageNumber=2` to return the next page (getting users 26-50). These can be combined as `GET /api/v2/users?pageSize=50&pageNumber=2` to get users 51-100.
Determining if more results are available can be evaluated in two ways:
1. Compare the response properties of *pageNumber* with *pageCount* . If *pageNumber* == *pageCount* , there are no more pages. If *pageNumber* < *pageCount* , add 1 to *pageNumber* and specify that value in the next request to get the next page.
2. Check for a value in the response property *nextUri* . If a value exists, it will be the path to the next page. If it does not exist, there are no more pages.
But how is this best done when using the SDK? I am not making API requests directly to those endpoints and getting JSON returns, I am using the classes / methods (etc) in the SDK.
For example, I'm using UsersApi.GetUserRoutingSkills() as I want to get a list of all our users and all their skills & proficiencies. We have over 1,000 users so I hit the rate limit early on.
(As a novice) How is best to handle this? Currently I'm getting a list of all users from usersApi.GetUsers(), looping through each of those using their ID for the GetUserRoutingSkills() request. After a short period I get:
: 'Error calling GetUserRoutingskills: {"message":"Rate limit exceeded the maximum. Retry the request in [34] seconds","code":"too.many.requests.retry.after","status":429,"contextId":"77390665-ea94-49ef-9eb8-3cac03291577","details":[],"errors":[]}'
Thank you for any guidance you can give.
Edit: Do I check for that exception and if it occurs, get the last user and then sleep the application for however long is in the 429 response? That doesn't sound right but...