Hello, I'm working on a workflow where I have to call an external API using HttpClientRequest and all work fine.
The API that I call uses pagination so I have to call the API to get results for each page. I have 10 pages so I have to make 10 calls. I'm wondering if there is a way to make only one call to get the result instead of 10 calls.
this is my current code :
var requestUrl = "https://www.muapiurl.com?";
// 10 calls
for (var i = 1; i <= 10; i++) {
var requestParam = "page="+i;
var url = requestUrl+requestParam;
var request = new HttpClientRequest(url);
var bufferEm = new MemoryBuffer();
request.header["Content-Type"] = "application/json; charset=utf-8";
request.method = "GET";
request.execute();
var dataResponse = request.response;
var data = JSON.parse(dataResponse.body);
for each(var obj in data) {
//.........
}
}
Regards.