This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Hello. I am developing a new workflow that needs to call different endpoints of the same REST API. Essentially I want to loop through each row URL, call and get the results, and save each in respective new tables that I plan to transfer to a SQL Server using indb functions
I'd recommend changing this slightly - put your client_id and secret in a different input, and use the Append Fields tool to put the two together. That way you will pass your client_id and secret through for each call.
If you are calling services with different client_id and secret, consider a Join instead of Append Fields.
Otherwise, this looks good! The download tool will automatically loop through all requests, and then you can later parse them out into specific logic.
So I think I can just put those 2 values in the payload of my download tool. Essentially the first step is to call that clientauth endpoint with a post and those 2 values to get a token. I then use that token in the header for all subsequent calls. So like you said, I created a separate input with just the URL and put the post values in the 1st download tool. I am guessing that will give me the token back. I see the download tool has output as a string. What tool would be the best to capture that and ultimately pass it to the next download tool's header that loops through all the URLs?
I noticed the download tool can have only 1 input so I couldn't hook up a 2nd input tool (with my URLs) and the precededing download tool (with the token output) to a subsequent download tool.
Usually I end up parsing out the response data to find the information I want, using Text to Columns (split to rows on \n for new line characters). Then I use a filter and/or formula to extract the specific data elements I want.
From there I would recommend following the process I recommended before - take your newly generated token data and use a Join to connect each token to the respective service call, then pass that output to the Download tool. You'll just need some way to identify that a token generated by the "buildings" call is tied to your new "buildings" query.
Thanks so much. I have the auth working to get the secret token. I then have to use that in the header of the subsequent calls. When I try to do that in the second download tool, I get an error that x-ems-api-token can't be found. Am I setting up the download headers correctly for this third header (first screenshot)? If you look at the second screenshot below, it looks like the input data is coming in correctly.
------last download tool config-------
-----------------Input data and workflow---------------