Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.

Interactive 3rd Party API

5 - Atom

Hi - I'm a complete Alteryx novice, so please be gentle with me! I'm probably asking a question that beginners ask all the time, apologies in advance.


We have third party API, and we currently use a Perl script to talk to the API and download data on a daily basis. We would like to see if we can move away from the script and have everything done within Alteryx. The API doc is:


It is RESTful, but where it differs is that the first endpoint call generates a task to start running on the server. It returns two bits of info - a status value i.e. RUNNING, and a new URL. The new URL is the url to check if the taks has finished. In the Perl script we usually sleep for 20 seconds before calling the URL, and we sleep 20 seconds between every call until the task has completed. Once it has completed the status value changes to FINSHED and we get a URL to download the actual data. The data comes down in CSV format.


Can this sort of interactive session be done in Alteryx?


cheers, Stephen

14 - Magnetar

Hi @StephenXGraham ,


Great question. You can achieve this using an Iterative Macro, the logic for which will be as follows:




You can implement this type of workflow in Alteryx using an Iterative Macro.


I've packaged up an example workflow which does the following:


  1. Waits 2 seconds
  2. Calls the WorldDateTime API
  3. Checks if the seconds of the returned time is between 00 and 29
  4. If yes, end
  5. If no, goto step 1


Here's how the iterative macro is constructed in Alteryx. You could also use RegEx to parse the response, but I've broken it out into multiple tools to make the logic easy to follow:




The batch script (included in the package) is as follows - you can edit this to define the number of seconds:



There are a few things about configuring the Run Command tool which might not be totally intuitive, in which case you can find more information here:


Alternatively you can use the excellent Wait a Second macro which is part of the CReW macro pack.


If you start the workflow running in the second half of any given minute it should loop a few times and then stop looping at the top of the minute.


To run configure the workflow you will need to open the yxzp file and download both yxdb files, then right click on the blue macro and open it from the parent workflow, and then configure the Run command tool with the _in and _out yxdb files.


For some reason, I couldn't find a way to package these up with the workflow. You may also wonder why the run command tool isn't on the looping output... again, this is down to quirks with the Run Command tool. The end result is that you're waiting before each call not after, and there is a slight time penalty from doing this.


It's possible this solution will be a bit buggy as I haven't really tested it much but it should show you the principal of how you can achieve what you're trying to.


Hope that helps.

5 - Atom

Many Thanks @jamielaird - will give this a go and see how we get on.