Alteryx Designer

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

Iterative Macro for API Call

Highlighted
7 - Meteor

Good Afternoon, Everyone,

 

I'm struggling a bit here, and am new to Alteryx, so please bear with me. I've searched the forum, found some examples, but still am struggling with making an iterative macro. Very basically, I'm using the Macro Input tool with 1 row and 2 columns, which are the API and the Authorization Token. I then use the Formula tool to add parameters to the URL such as start date, end date, and page number. I then use the Download and JSON Parse.

 

After I've selected out the unnecessary information, the two columns remaining are JSON_Name and JSON_ValueString. With this API, it identifies if there are more pages after the current page by the last value in JSON_Name being "more" and the associated JSON_ValueString being either 0 or 1.

 

This is where I am stuck. The second half of my workflow consists of a Multi-Row Formula Tool and a Cross Tab tool. I'm just failing to make the connection with how to make the workflow continue looping until "more" equals "0". Does anyone have any good sample yxmx files to share? It's so much easier to see this. I appreciate anyone's help!

 

Not that I think it'll be much help to anyone, but I've attached the API call workflow, substituting the API credentials. I'm accomplishing this through a less elegant workflow now, but it only accounts for making the API call five times and at some point, there could be more than five calls needed. There's a screenshot below with how I've gone about this without the iterative macro; don't laugh.

 

Capture.PNG

Highlighted
Alteryx
Alteryx

Attached is an example of an iterative macro that does Amortization.  The piece you are missing is that you need to output the data that meets your criteria, and another output for data that does not.  Also, it is best to put data back into it's pre-macro format before you loop.  Often just a select tool to remove any extra fields, or a join to bring them back in.

In  my example I check using a Filter tool  I only want where the Principle is less than or equal to 0.  Yours may be a Contains or a field = 0 depending on what the data looks like.

You will need to use the Interface designer to set this up.  Go to View>Interface Designer to see it.  Select what the input is, and what output to Iterate.

clipboard_image_0.png

 

Hope this helps.

Scott Jones
Strategic Sales Engineer
Alteryx, Inc.
Highlighted
Alteryx
Alteryx

@scsh4 I posted an example for this post earlier. please take a look! It is an Iterative API call with pagination & updating URL. There's also an example attached.

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Iterative-API-call-with-pagination-amp...

 

You would have to use the iteration macro. You have to use the Interface Designer to set the loop. Part of the look will be the results and the 2nd part would be to create a string of the next url. Attached is a sample workflow that I like to show to clients around this use case....

Digan
Alteryx
Labels