Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Loop in Alteryx to fetch data from an API which allows only 50 Req Per Run

Ashwin1
7 - Meteor

Hi All, 

         I have an Alteryx workflow where i am manually creating the xml code and send the request to an API to fetch data but the API only allows 50 request per run so i need to loop through and change the request value ( for Eg record 1-50 in the first run then 50 -100 in the second run and so on ). How to go about in doing this any idea would be helpful.

 

Thanks 

Ashwin

6 REPLIES 6
afv2688
16 - Nebula
16 - Nebula

Hello @Ashwin1 ,

 

The easiest way for that could be to insert your workflow inside a batch macro and change the values after every request.

 

If you don't know how to create batch macros I may be able to create a dummy one for you.

 

I think this would be the best idea.

 

Regards

Ashwin1
7 - Meteor

Thanks Much @afv2688 for getting back to me.. I am not allowed to use Macros at the moment in my workplace :(.

 

Ashwin

afv2688
16 - Nebula
16 - Nebula

Well then it depends on how you would do the changes then and how your wokflow looks.

 

Something more manual would be to add a constant that you could change manually after every run.

 

You would just need to change the value every time:

 

Untitled.png

 

You just need to change the value in your workflow with the name of the constant and after that change it every time.

 

Please also remember that not knowing how your workflow looks like limits my responses to what comes to mind.

 

Regards

Ashwin1
7 - Meteor

Thanks for that .. i will attach my workflow so you will get a better idea.

 

This is how my workflow looks like.. Right at the end after the 'Block until done' the first flow creates a txt file with all the data which has to be sent to the API and the 2nd flow to the run command which runs a curl command which fetches the data from the API.

 

At the moment i get this error - "Number of cites specified in request exceeds max allowed 50"

 

If i create the file with just 50 records in it then it works. 

 

AlteryxCommu.PNG

 

Ashwin

afv2688
16 - Nebula
16 - Nebula

Hello @Ashwin1 ,

 

In that case I would then recommend you to maybe separate your report into different files.

 

This is a simple example that shows you how I would do it:

 

Untitled.png

 

Then on the output data tool, check the take file/table name from field and select the field.

 

This with a simple modification on the run command should do it.

 

Regards

Ashwin1
7 - Meteor

Thanks Much @afv2688  we used Macros to get this done..

 

 

Ashwin 

Labels