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!
Solved! Go to Solution.
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.
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.
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.
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 .
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?
{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.
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.
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.
Ah gotcha, the limit field in the tool wasn't working as I thought it would. Thank you again!