Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

RESTful API - using POST to upload a file

jjordan
6 - Meteoroid

Hello all -

 

Has anyone been able to successfully utilize the download tool to upload a file to a RESTful API?

 

I've been able to POST to an FTP/SFTP, but I cannot seem to figure out how to make this POST command works.

 

Here's the 30,000ft view of how the API I am connecting to works:

- POST a file of names and address

- Utilize GET commands to perform various actions on the file/download results.

 

I have been able to set everything for the GET commands and return data successfully within both Alteryx and POSTMAN. However, I have only been able to execute the POST/upload in POSTMAN.

 

I've attempted converting the CSV file to a Blob and including/not including it in the Payload, but get the same error message.

 

In Alteryx I simply get an error returned: {"success":false,"message":"ERROR·Submitted·file·path·does·NOT·exists"}¶

 

Anyone have successful examples I can look at?

 

 

33 REPLIES 33
jgo
Alteryx Alumni (Retired)

Hi @jjordan,

 

While I dont have any specific examples of successfully using that command, a tool that I use frequently to diagnose API call issues is Fiddler. This will allow you to see what is transmitted to and from the API.

 

From there, you can compare the call between Alteryx and POSTMAN to see whats different.

 

For reference, what API are you attempting to connect to?

 

Best,

 

JGo

jjordan
6 - Meteoroid

@jgo - Thanks for the reply. I'll check out Fiddler.

 

The API is for a 3rd party utility to perform NCOA functions on names/addresses. 

 

I can post the documentation pages as it relates to the upload process if that helps. I'll check in after I get a chance to mess with Fiddler, but I'm open to any other feedback.

 

Thank you for taking time out of your day to offer some feedback!

TashaA
Alteryx Alumni (Retired)

@jjordan

 

Another approach you may want to consider trying is the Run Command Tool  . If you know you can execute the request with Postman, you can go to the Code button on the right hand side of Postman, and save the code snippet in cURL format. 

 

Then you could use the run command tool to run the curl program (once you install it) and excecute the request that way. 

 

Hope this helps!

 

-Tasha 

jjordan
6 - Meteoroid

Thanks for the thoughts!

 

It looks like this is the route that I'm headed. I've been able to execute the the cURL from a command prompt, but oddly enough when I run it using the command tool in Alteryx the API response gets lost. I put a PAUSE in the CMD execution and saw that there was a response returned, however I'm unsure how to get that to pass to tools downstream. I did specify Read Results, but the actual API response isn't being output anywhere and is not in the stream anywhere.

 

Any thoughts for how to rectify that?

TashaA
Alteryx Alumni (Retired)

Hey @jjordan, great question!

 

The run command tool is slightly nuanced and requires some specific settings to read directly into the stream. 

 

There is some great content about this, as well as example workflows in this post that I think will help you out with this issue. 

 

Best, 

 

-Tasha

 

 

 

 

jjordan
6 - Meteoroid

After a ton of back and forth, I was able to resolve this using cURL and the Run Command tool.

 

Thank you all for the assistance, marking as complete!

djb
6 - Meteoroid

Hi @jgo,

 

Sorry to open this one up again.  I was hoping Fiddler would give me a breakdown of the complete API call (from Postman) with the url and key value pairs etc, so I can prep in Alteryx.  However I can't seem to find this and I think I've exhausted all options now.  Are you able to point me in the right direction please?

 

Thanks

nghealthpointe
5 - Atom

I am trying to do something similar too. Both GET and POST on a self-signed server. Don't know how to set up the Alteryx Download tool to not verify the server identity. 

 

Apparently, per (https://curl.haxx.se/docs/sslcerts.html), here is how you'd do it with libcurl.

Telling libcurl to not verify the peer: With libcurl you disable this with curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);

How would we do the same with the Alteryx Download tool?

 

Help appreciated.

Nathan

npandya
7 - Meteor

Have you found any way of doing it?

Labels