Alteryx Designer Desktop Discussions

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

Run API tool over multiple IDs

JohnLight
8 - Asteroid

I have a server api tool that gets information of all the workflows, and a select tool afterward that gets each ID. I then want to talk those IDs and get the jobs of each one. Is there a way to do that without using a server api tool for each workflow? I tried creating some kind of macro and using the action replace tool to iterate over each ID in the tool, but couldn't get it to work, so wanted to check here if anyone has done anything similar, thanks!

9 REPLIES 9
rfoster7
10 - Fireball

The new Server API tool (on marketplace https://marketplace.alteryx.com/en-US/apps/418052/server-api-tool?utm_content=en&utm_source=designer...) would let you do this. 

 

Run the tool on the GET endpoint v3/workflows once to get all the workflowIDS then feed them back into the tool a second time this time on the GET endpoint V3/workflows/{workflowid}/job

 

Its been an amazing help to us, far superior to the older API tools or our own homegrown cobble. 

JohnLight
8 - Asteroid

How would you do this? I believe I have this tool already, the first tool is getting the workflow IDs, I use the select tool to remove all other fields other than workflow ID, and then feed it back into the second tool that's set to the GET endpoint V3/workflows/{workflowid}/job.

rfoster7
10 - Fireball

When you set up the second API tool and point it to the V3/workflows/{workflowid}/job GET endpoint, take a look at the parameter values that show up on the bottom. 

 

example1.png

 

This will tell you what input fields are required and what it expects it to be named. In this case it expects it to be named appid. So use a select tool to rename your "id" field to "appId" before feeding it in. I believe it is cap sensitive so exactly match the expected field name. 

 

example2.jpg

 

 

 

 

 

 

rfoster7
10 - Fireball

Sorry for the double, for some reason it cut off part of my reply: 

 

So after renaming the Id field to something distinct, this is what your config for the second macro should look like. click the "use fields for parameters" and pick your field . 

 

example3.jpg

JohnLight
8 - Asteroid

I'm trying to do this with workflows, not apps, so using this endpoint: V3/workflows/{workflowid}/job. I filled in one field, but not sure what to fill in for the rest. I also got this error in the screenshot, I know the other fields aren't required, but maybe they're tied to this error?

rfoster7
10 - Fireball

{workflowid} and {appid} are interchangeable for these two GET endpoints. You should be able to use either. 

 

Try putting a filter tool before your second input and filter out any records with a null workflowId. For some reason you have 1 or more record going through that is null. I don't know why. 

 

If that doesn't work, just use the v1 endpoint and put your workflowId in place of the appId. 

 

 

JohnLight
8 - Asteroid

That worked! Thank you! One more thing, is there a way to limit the number of jobs you see for each workflow? Right now I'm seeing over 2000s jobs total from all the workflows, and I only want about 10 jobs per workflow.

rfoster7
10 - Fireball

after you pull the jobs, you can sort the data by workflowid, then datetime desc, then use a multirow formula to make a rownumber per workflowID group, then simply filter for rownumber <= 10. that will give you the last 10 jobs for each workflow. 

 

There is a limit option you can set in the server_api macro, but I think that's just for the entire return set, not per workflowID. 

 

 

JohnLight
8 - Asteroid

Ah gotcha, the limit field in the tool wasn't working as I thought it would. Thank you again!

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels