Skip to main content
Solved

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

  • October 29, 2021
  • 4 replies
  • 352 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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

redgeographics
Celebrity
Forum|alt.badge.img+59
  • Celebrity
  • 3700 replies
  • October 29, 2021

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


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • 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
Celebrity
  • 8392 replies
  • 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
  • 4 replies
  • October 31, 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.

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