Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Download tool not getting any response when using API with parameters

kpreddypadira
6 - Meteoroid

Hello,

 

This is my first stint with API in Alteryx and am trying to understand where I am going wrong. Any assistance would be appreciated.

 

Below is the flow I am using. The 'url' and 'header' is in the text input tool and a header is added in the Download Tool (Authentication : Bearer ###). The flow runs perfectly when i use the base url to get data.

 

url type: https://api.pesdipy.io/p3/events (not original)

 

kpreddypadira_0-1589991639392.png

 

url with parameters: 

https://api.pesdipy.io/p3/events/evt_332242rpt/count/?start_time=2020-01-01T08:00:00.000Z&end_time=2020-01-31T18:00:00.000Z&interval=1w

 

I am using the formula tool to build this url (as defined in the API Documentation) with parameters and running a download tool, to get a response.

But when I try this. I get a 200 connection established but "404 Not found" response in DownloadData.

 

 

9 REPLIES 9
BrandonB
Alteryx
Alteryx

Do you have the API documentation available? If you are getting a 404 error there is something wrong with your URL so I would double check to make sure that you are pulling from the correct API endpoint. Also, I would look at managing your payload values in the payload tab rather than manually building the URL in a formula tool although technically this should work as well. This may help if you have any issues with syntax. 

 

kpreddypadira
6 - Meteoroid

Thanks for the prompt reply Brandon. 

 

Sure, this is the api documentation https://docs.density.io/v2/

 

I initially tried doing it via the payload tab but couldn't get it to work so resorted to the formula tool to build the url.

This is the payload tab I used:

Payload.png

 

Also, the final idea is to run this download tool over a list of parameters to get the underlying data. 

 

Thank you

BrandonB
Alteryx
Alteryx

Iterating through a list of parameters should be pretty easy to accomplish via a batch macro after you get it to work for a single use case. 

 

I was taking a look at the density API documentation and found this: 

density.png

 

It looks like your URL endpoint that you should be passing through is

https://api.density.io/v2\
/spaces/SPACE ID HERE/events/

Can you confirm that you are using the endpoint that is specified here to be passed into your download tool? Make sure that you swap out SPACE ID HERE with the Space ID of interest. I think that this is your issue because right now you are getting a 404 error which indicates that even the base url without the parameters that you are passing through is having an issue. 

 

I just gave this a try as is and returned this:

 

get request.png

kpreddypadira
6 - Meteoroid

I tried the workflow with that endpoint as well, it would still return the same 404 error.

 

Also, the data and format that I am looking for comes from this endpoint

 

kpreddypadira_0-1590067242903.png

 

The url that I am using is very similar to their Use Case example as shown here. I just changed the values and am trying to run it as a text input feeding into the download tool, but it errors out. (404)

 

kpreddypadira_1-1590067349920.png

 

I know that this specific endpoint works as it works perfectly fine when I try to do this using Python

 

kpreddypadira_9-1590071780878.png

 

 

I am trying to understand how the workflow runs perfectly when run without parameters : https://api.density.io/v2/spaces/

 

kpreddypadira_5-1590071115817.png

 

but errors out when I add them (in the payload, or as text input). Is there something I am missing?

 

 

 

 

 

 

 

BrandonB
Alteryx
Alteryx

Slight nuance and not sure if it will make a difference, but it looks like they use a backslash as part of the url before the /spaces

 

https://api.density.io/v2\/spaces/SPACE ID HERE/events/

 

Can you give that a try?

kpreddypadira
6 - Meteoroid

That was it! Thank you, it was such a small thing!

It now works like a charm.

 

Could you please direct me to any resource where I could find information on how to run these calls over a list of parameters.

 

Thanks again

 

 

 

BrandonB
Alteryx
Alteryx

Awesome! Glad that worked. What you will be looking to do is to create what is called a batch macro. Here is the basic concept. You will have a control parameter and an action tool (interface category) connected to the tool that you are updating the values in. This is then saved as a macro which will run one time for every row of parameters that are passed into it when it is placed into another workflow with data connected:

 

Example creation of batch macro

macro 1.png

 

Use of this macro in another workflow with 3 rows of parameters that are being passed into it. The macro will run 3 times based on this data being passed in. 

 

macro 2.png

 

BrandonB
Alteryx
Alteryx

Here is a free video training available which shows how to create a batch macro: https://community.alteryx.com/t5/Videos/Build-Your-First-Batch-Macro/td-p/52900

Aditia
6 - Meteoroid

HTTP/1.1 412 Precondition Failed Server: nginx/1.14.0 (Ubuntu) Date: Mon, 28 Mar 2022 12:01:18 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Access-Control-Allow-Origin: * Access-Control-Allow-Headers: Content-Type Access-Control-Allow-Methods: POST Access-Control-Max-Age: 10001

 

 

I am getting above error. My design is 

Aditia_0-1648550297389.png

Am I doing any mistake???

 

Labels