Skip to main content
Solved

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

  • October 29, 2021
  • 4 replies
  • 278 views

Forum|alt.badge.img

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

Best answer by ebygomm

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.

View original
Did this help you find an answer to your question?

4 replies

redgeographics
Celebrity
Forum|alt.badge.img+49

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


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • Best Answer
  • October 29, 2021

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.


david_r
Evangelist
  • October 29, 2021

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


Forum|alt.badge.img
  • Author
  • October 31, 2021
ebygomm wrote:

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings