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
pickandpray
6 - Meteoroid

I struggled for a little while to upload a document (trying to avoid using the command line). For me the key to getting this to work was using the blob input tool followed immediately by a blob convert to change the blob field to a base64 encoded string.

 

After that it was just configuring the download tool to work correctly with the API I was attempting to use.  I don't have any sample code to share, but I have a screen shot of the macro I created to encapsulate the upload process. I don't have any formal training so the JSON creation piece is probably ugly, but it works for me.

RohitChopra
6 - Meteoroid

Is it possible to share some screenshots of the tools configuration i.e. Configuration of Blob tools and the final API tool

pickandpray
6 - Meteoroid

hope this helps

 

blob convert.PNG

blob1.PNG

  

BretCarr
10 - Fireball

As someone who works at a company that (logically, I might add) blocks the use of .bat files on local machines, is there no other way that this can be performed? I feel like this should be a tool in the arsenal since uploading files via an API is a fairly common and routine operation that a program like Alteryx would use. thanks @TashaA  

rnairg
5 - Atom

Can you please also share the download tool configuration screenshot.

pickandpray
6 - Meteoroid

here you go!

rnairg
5 - Atom

Thank you very much for the screenshots.

 

I see in this case the Content-Type is application/json

 

However I am working with Content-Type: multipart/form-data.

 

When trying to configure I encountered below issues:

 

1) If I try to send data as multipart/form-data, the API gives an error 'No boundary Value Set'. It seems like Alteryx does not do this automatically.

 

2) To solve the above issue I explicitly set Content-Type to multipart/form-data; boundary=----MyBoundary. This solved the boundary error, but started giving the error stating: The required part 'file' is not present.

 

3) To solved the above I explicitly constructed the body and passed it to the Download tool: The Body is as follows:

 

'
------MyBoundary
Content-Disposition: form-data; name="file"; filename="rakTestAlteryx.csv"
Content-Type: multipart/form-data

'
+
Test Data
+
'
------MyBoundary--

 

This resolved the the part of present issue. However then I started getting stream unexpectedly closed error.

 

Post this I have hit a deadend. 

 

Has anyone ever succeeded in uploading a multipart content via Download tool? 

 

 

diksha1107
7 - Meteor

Hi @mutama , @AlteryxAdvocacy This is an urgent issue. Can you please ask support team to look into this?

RohitChopra
6 - Meteoroid

Hi, 

 

I have already raised the exact same issue with all the screenshots here: 

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Not-able-to-Upload-both-File-and-Data-...

 

I have tried a lot of combination over the download tool but ended up using the Python Script i have created in the above discussion. 

 

As far as I understand the Alteryx Download tool is able to support Posting form Data only or Posting a file only however, Posting File+Data is not feasible with the Download Tool.   

rnairg
5 - Atom

In my case I am just trying to upload file using REST API

Labels