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.

API Calls : How to make POST call to upload a file via API using Alteryx

Newstart2020
7 - Meteor

Hi All,

 

I am getting a success response when i upload a file using postman.

But when i try the same with alteryx designer it saying "A file was not included in the request.","success":false

 

My worklfow is quite siple..I am just trying to upload .txt file via api call but i guess i am getting configuration of the payload section in the download tool incorrect. 

very much new to this API upload space.

My curl code from Postaman is as below...have edited some of the details here...My query is how can i achieve the last lineie in higigted RED below in Alteryx API call...

 

curl --location --request POST 'https://linkhasbeendeletedhere' \
--header 'CompassApiKey: 550911*****f264a5***9' \
--header 'Content-Type: application/json' \
--header 'Cookie: cpssid_TYUUUU; ASP.NET_SessionId=49311e1f-dc8b-4ab4-8f04-341c8b2b5465' \
--form '=@"/C:/FileLoad/TestSundry.txt"'
 
Thanks
 
11 REPLIES 11
OllieClarke
15 - Aurora
15 - Aurora

Hi @Newstart2020

 

I've attached a workflow showing a way of doing this. You can use a blob input tool to input your file, and then convert it to a string to post. The format that this file needs to be in depends on the API documentation - it could also be that the api can take the data from the file, rather than the file itself. If you can share the API you're using, then I could take a look, but this workflow is the process that is used to publish workbooks to Tableau for example.

 

OllieClarke_0-1620984513081.png

 

Hope that helps,

 

Ollie

 

Newstart2020
7 - Meteor

Hi @OllieClarke 

 

Thanks for the reply..i tried to use the workflow but it still gives me error...

I am attaching my worklfow which gives me success in Postman but failure in Alteryx...I am also attaching the screengrab from the api documnetation...i am not quite sure how to achieve the Type Files in alteryx...

 

Hope i will get a reply soon from you..

 

Newstart2020_0-1621390252736.png

 

OllieClarke
15 - Aurora
15 - Aurora

Hey @Newstart2020 

 

It's hard for me to give much more without seeing the APIs documentation. Could you please link it here?

In the meantime, one thing you could try is removing the Blob convert tool, and just send the file as a blob in your payload.

 

Ollie

Newstart2020
7 - Meteor

Hi @OllieClarke 

 

I had tried that too but still getting the same response that the file is not contained...

 

I cannot link the documentation as this is controlled by my authentication...

I have listed the screengrabs from the API documentation related to this call...

 

Newstart2020_0-1621466067120.png

 

Newstart2020_1-1621466162293.png

 

Newstart2020_2-1621466195541.png

 

 

 

 

 

OllieClarke
15 - Aurora
15 - Aurora

Hey @Newstart2020 

 

Sorry, I'm not seeing much that's helpful in the documentation. You mentioned that your set up works in postman, but not in Alteryx. In that case I'd recommend using fiddler to see the exact queries that Postman and Alteryx are sending to the API. Once you can see the differences, it should be possible to alter the alteryx query so it works 🙂

Ritesh127
6 - Meteoroid

Hi Ollie, thank you very much for the above suggestions. 

Thank you @OllieClarke your pointers were very helpful in setting up the download tool to a great degree!! I am seeing one final issue and would appreciate any thoughts you might have on this

 

Following the suggestions on that post, I have got the download tool to seemingly work - It shows a 200 response in the Download Headers field, which would mean it's successfully uploaded attachment - However on checking the environment(Jira) where attachment was expected, I see that it hasn't actually attached the file. The DownloadData field in Download tool does not show anything aside from a box type symbol made of square brackets like the following- '[]' - not sure what that means and if it indicates an issue in the upload? Could there be something about the file blob/string data that I am sending which is causing this? 

  1. I have tried connecting the Blob Input tool directly to the download tool
  2. Also tried using Blob Input tool and then Blob convert tool
    Both give the same output as above

 

And one thing I've noticed with the download tool here is that

  • It gives 415 error if Content Type is not provided as one of the headers
  • If the Content type is set to Multipart-form-data then it gives 500 Server error and DownloadData field shows Boundary not Set disclaimer
  • If the Content Type is set to Multipart/form-data: boundary=--RandomBoundary then as mentioned above the download tool indicates successful upload but on actually checking the JIRA it isn't uploaded

 

I have been able to successfully upload the file via Postman(where neither Content Type and boundary do need to be specified) but am unable to do so via Alteryx.

 

Link to API documentation if required is: https://docs.atlassian.com/software/jira/docs/api/REST/8.13.0/#api/2/issue/{issueIdOrKey{/attachment...

Would like to highlight that while the above documentation mentions Content Type as application/json, setting that in Download tool causes it to give the 415 error

 

Could you please share any thoughts on what I could do differently to complete this?
Thank you,
Ritesh

Vijuzy
8 - Asteroid

Hi Ritesh,

 

Did you find any way to upload file using Download tool? I am also trying similar approach, any help will be appreciated.

 

Thanks,

 

Vijay 

BretCarr
10 - Fireball

I am having the exact same problem. I can't get a file to upload for the life of me unless it is some sort of Text file.

Vijuzy
8 - Asteroid

As @OllieClarke suggested I even used fiddler to see the exact queries that Postman and Alteryx are sending to the API.

 

Difference I noticed only in Body of the request.

Postman : It contains some form info related to file name and stuff, before starting actual file content in Blob

Fiddler.png

 

Alteryx: I used Blob input tool to convert my file in to Blob format and I am not able to replicate seemlier text before Blob content, as Download tool only accepting Blob content when I select this filed in Payload tab and 'Take Query String/Body From Field'.

Alteryx.png

 

Please suggest if I can do anything differently.

 

Thanks,

 

Vijay

Labels