Alteryx Designer Desktop Discussions

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

Akixi - REST API - status check loop?

hvh
6 - Meteoroid

Hi all,

 

I'm trying to build an API for Akixi - the problem I am running into is that when you send the request via the download tool it returns the status "waiting" it should then go to "initializing"  and finally to "Active".

 

I've been trialing different ideas to get the data out - for example using the wait a second macro to try and delay the download process to get the data but i'm not having much luck. Has anyone done anything similar and possibly offer some ideas?

 

Here's the API documentation:

https://akixi.dev/endpoints/report/report.html#report-list

 

Thanks,

7 REPLIES 7
BrandonB
Alteryx
Alteryx

It looks like it should be a two download tool process, one to authenticate and retrieve the session cookie, and the second to pull the data. Have you successfully retrieved the session cookie from the first step?

hvh
6 - Meteoroid

Hey, thanks for your reply. Yes I've retried the session cookie, but when I move onto the download report data process it returns "waiting" and no data which is where I've gotten stuck and where I tried to add the wait a second macro.

BrandonB
Alteryx
Alteryx

Ah I see, so after making the first call it returns a waiting message if the report isn't immediately ready. 

 

waiting.png

The API documentation says to keep requesting the report content data until the status is active. I almost wonder if you need to set up the API call for the data as an iterative macro. Like if the parsed out status is WAITING then you loop it back through to do another call and if the status is ACTIVE then you just return the data. 

 

This is an interesting one. I haven't worked with an API like this before, but it does seem like a request loop is required which I can only think of accomplishing with an iterative macro. 

hvh
6 - Meteoroid

I was thinking the same as the next stage to tackle this - maybe altering the macro used to call back the next batch. I'll give it a go and report back

BrandonB
Alteryx
Alteryx

This is a good training video on the concept of an iterative macro if you haven't built one yet: https://community.alteryx.com/t5/Videos/Build-Your-First-Iterative-Macro/td-p/55565

 

You would basically have a filter at the end of it that forks out to the data output if true and the iteration output if false. Whatever goes out to the iteration output loops back into the input at the very beginning. So you could pass the same API call through 100 times if needed for it to finally get the appropriate status. You may want to add your wait a second macro at the end of it if you want to minimize the number of subsequent API calls made. 

hvh
6 - Meteoroid

Sorry for the slow reply on this one, took a while to get back to it. The iterative macro worked perfectly, with the addition of the Wait A Second. 

BrandonB
Alteryx
Alteryx

Nice work!

Labels