Trying to get the time off requests from a platform with over 300 users. The API call we are using is :-
GET /api/v2/workforcemanagement/managementunits/{ManagementUnit}/users/{UserID}/timeoffrequests
Just have a couple of questions about it.
When we use it we get far more 429 Responses than any other API call we use. Even sometimes we get it from the first call. It also seems to be doing the counter against the Oauth User, not the Oauth bearer key we are creating. This is strange behaviour compared to other API's in the system.
Is there anywhere we can look and see what's left in terms of calls, now the header counters have been depreciated. We handle 429 gracefully, but with over 300 agents and the 429 Response Code kicking in randomly its very slow.
Happy to be told there is a better way to get all the time off requests.
The route you're using (GET /api/v2/workforcemanagement/managementunits/{ManagementUnit}/users/{UserID}/timeoffrequests) Is not intended to be used to fetch time off requests for a large number of users. It's more a one-off request to get requests for a specific user.
The preferred method to get time off requests for multiple users is this one:
This will allow you to fetch time off requests for a group of users for up to 33 days for all statuses (if you leave the statuses field empty) or all pending requests for all time if you specify statuses = [Pending]
May I ask what you are trying to achieve in fetching all time off requests for all the agents in a management unit? Perhaps I can offer some additional tips if I know what you're trying to accomplish