Docs state: “The API returns a maximum of 100 items per page. Use the next page token to retrieve subsequent pages.”
Trying to fetch every single queue across all our divisions using the JavaScript Platform SDK. We have a massive org structure with hundreds of queues split across different divisions. The goal is simple. Iterate through the full list to build a mapping for our internal dashboard.
Here is the code:
const client = PlatformClient.create();
let queues = [];
let pageToken = null;
async function getAllQueues() {
do {
const resp = await client.queuesApi.queuesGet({
pageSize: 100,
pageNumber: pageToken
});
queues = queues.concat(resp.entities);
pageToken = resp.nextPageToken;
} while (pageToken);
console.log(queues.length);
}
It grabs the first 100. The nextPageToken comes back. But the next call returns the same 100 items. The token seems to be resetting or ignored. Or maybe the division filter is defaulting to the user’s home division despite the docs saying global scope is possible for admins.
We are using the latest npm package. Auth is client credentials so it has full org access. The token is valid. No 401 or 403 errors. Just looping on the first page of results forever. Anyone else hit this wall with the queue endpoint?