cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

Who Me Too'd this topic

andreagranbery
New Member - Level 1

Exceed expense reports response limit

Hi,

I am making a call to 

GET  /api/v3.0/expense/reports

However, sometimes the number of reports available exceeds the default limit of 25. Is it possible to set the 'limit' param to unlimited?

 

Recognizing this could be risky if the payload ends up being too large, another question and possible alternative, how can I use the 'offset' param to make subsequent requests? Is the first batch/page offset equal to 0, 1, 25, or something else?

My current plan is to loop over the get request while the items returned equals 25. And this assumed that the first page of results offset = 0, so the second request starts with offset = 1

 

  // initial call to /api/v3.0/expense/reports 
let expenseReportsBatch = await getExpensesForApproval(config, lastPolledTime) const newLastPolledTimestamp = new Date().toISOString() let allExpenseReports = expenseReportsBatch?.Items let offset = 1 while (size(expenseReportsBatch?.Items) === 25) { expenseReportsBatch = await getExpensesForApproval(config, lastPolledTime, offset) allExpenseReports = concat(allExpenseReports, expenseReportsBatch.Items) offset++ }

 

 

Who Me Too'd this topic