6/17/21: We have completed maintenance for the Search functionality on the Community. If you are seeing any issues, please try to clear your cache first. If the issue persists please email Community@alteryx.com

Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
SOLVED

Need to build Iteration Macro to paginate API JSON downloads... I think?

BretCarr
9 - Comet

Quick overview:

  1. I have a REST API
  2. I have been successful at obtaining a single JSON object that I then parse into a table. Yay!
  3. I know the total number of pages that my request needs to iterate through.

Problem:

I know how to pass values from other fields into my POST body to get desired results but I don't know how to create a loop to increment my page number until it hits the total pages number.

 

Total_Pages.png

 

How do I feed the totalpages number into a loop that would stop at (in this example) 4 API calls that append to one database set?

 

I'm guessing the Download Tool needs to be in my iteration macro along with passing the totalPages and authentication Token into it.

 

Can someone briefly describe the general make-up of the iterative macro? I feel I can make it if I knew what tools to use in the process.Thanks!

3 REPLIES 3
BretCarr
9 - Comet

First, I want to give serious props to @DiganP for his article that included the only instructions that made iterative/pagination make sense! You can catch his example of the whole thing here: https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Iterative-API-call-with-pagination-amp...


Here is a picture of my iteration macro:

JSON-Macro-Post-with-Pagination-Iteration.png

 Here is the setup of the iteration properties in the Interface Designer:

 

Iteration-Designer-Setup.png

 

 

I hope all of this helps someone else out there with undertanding another chunk of how the iteration process works! Good luck!

 

BretCarr
9 - Comet

I'm just thankful I posted this. I couldn't, for the life of me, get an iteration to work in a new workflow and I had to use my own post to get it to work. 🤣

mtwilliamson
7 - Meteor

Hi Bret,

I'm working thru this exact same scenario (processing the ContinuationToken until all records are processed).  Could you upload your workflow to this thread?  I'd like to look at it. 

 

Here is how far I got on my own, but I'm stuck on how to loop thru the ContinuationToken and process/concatenate the pages back together.

 

mtwilliamson_0-1612464283565.png

 

 

Labels