Solved

Is there a tutorial on how to page through the API call

  • 29 October 2021
  • 4 replies
  • 116 views

Badge

Hi, the API comes back with the number of totalPages (say 10 pages), how can I loop the API call through all these pages (1,2,3...10) to get all data? Is there a tutorial I can refer? thanks, Song

icon

Best answer by ebygomm 29 October 2021, 09:56

View original

4 replies

Userlevel 5
Badge +25

Do you mean the FME Server API? Or just API in general?

Userlevel 1
Badge +21

If you make a request that tells you there are 10 pages to request, then you can clone the feature 10 times and then use the clone number to format a second request to get each of the 10 pages in turn. No need for looping. I would only use looping if there was no way of knowing how many requests were needed to be made in advance.

Userlevel 4

If you search for "fme httpcaller paging" you'll find some examples, including this one with a sample workspace by @bruceharold​ : https://community.safe.com/s/question/0D54Q000080hPDg/resolving-pagination-with-httpcallerloop

Badge

If you make a request that tells you there are 10 pages to request, then you can clone the feature 10 times and then use the clone number to format a second request to get each of the 10 pages in turn. No need for looping. I would only use looping if there was no way of knowing how many requests were needed to be made in advance.

Thank you, in addition, I added a decelerator on the second httpcaller to avoid being rejected by the server. Cheers, Song

Reply