Could you please let me know if I am missing something, or if there is a reason why this element does not exist for this call? This is very frustrating to run into seemingly random inconsistencies in your API.
Thanks for your time.
function getCallLogsPage() {
return platform
.get('/account/~/call-log', {
page: page,
perPage: process.env.LOGS_PER_PAGE, // MAX is 1000
dateFrom: process.env.DATE_FROM,
dateTo: process.env.DATE_TO,
view: process.env.VIEW
})
.then(function (response) {
console.log(response.json());
// Sanity check
if( response ) {
console.log("************** SHOULD BE A SUCCESSFUL 200 REQUEST - NOTHING TO SEE HERE...MOVE ALONG PLEASE ***************");
if(timeoutObject) {
clearTimeout(timeoutObject);
}
retryAfter = 0;
var data = response.json();
//console.log("************** THE NUMBER OF CALL LOGS THIS REQUEST CYCLE ARE : ***************", data.records.length);
callLogs = callLogs.concat(data.records);
if (data.navigation.nextPage) {
page++;
return getCallLogsPage(); // this will be chained
} else {
return callLogs; // this is the finally resolved thing
}
}
});
} // end of getCallLogsPage()
/*
Loop until you capture all extensions, and then continue processing data
*/
return getCallLogsPage()
.then(<NEXT_FUNCTION_IN_PROGRAM>)
.catch(function (e) {
console.error(e);
throw e;
}
});
I know this has been a while, but as I read through the above. I find it very out of the ordinary to not include totalPages. I will have to agree that having the date range as well as the fact that data has a cutoff is interesting. We too have a large regular call volume. Using the next page from the example is more costly in the use of it. Eitherway, I am glad I read this as I was trying to figure out why it was broken.
Share your great idea, or help out by voting for other people's ideas.