REST API Json Pages

Hey

I have a problem with the JSON pages that I get via REST API. The readout works wonderfully by reading out the pages individually. So 1 and 2:

//url.com/v1/someUrl?page_size=100&page=1

Now is the question I am asking myself. Do I read the first page with the first 100 entries, let the counter count this to 100 and then switch to page 2 and read out the last entries or is there a possibility to transfer both pages with all 150 entries to a variable (HTTPResult)?

{
  "data": [
    {},
    {},
    {}
  ],
  "links": {
    "self": "someUrl?page_size=3&page=1",
    "first": "someUrl?page_size=3&page=1",
    "prev": null,
    "next": "someUrl?page_size=3&page=2",
    "last": "someUrl?page_size=3&page=14",
  }
}

Hi @Crusha

If the data is a JArray, you can create a loop that will continue to send the HTTP request until there are no more pages, while also appending new array elements to a separate JArray (this is possible i.e. by calling a method of the JArray with the Invoke Method activity).

1 Like