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!

5 REPLIES 5
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

 

 

Ofure_Awonuga
5 - Atom

Thanks, this was extremely useful for my project

BretCarr
9 - Comet

@mtwilliamson : were you able to figure this out? Sorry for the huge delay in response! Unfortunately, I'm forbidden from sharing anything I do at work without jumping through a million hoops and I don't think that's what you are looking for anyway.

 

Looks like yours is upside down from mine on streams (the top is the loop part and the bottom is the accumulated data?). I'd be happy to try to answer anything specifically.

Labels