Free Trial

Alteryx Designer Desktop Discussions

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

POST API request for file upload

sreejithmp
8 - Asteroid

Hi Data Folks,

 

Am using an api for uploading a file and it is working fine in postman not sure how can we achieve same in Alteryx using download tool. Could someone helps here. Below are the details 

In the body i have 2 parameters form_data which is a json object for payload and attachment which is the file to be uploaded. 

 

Headers contains: Content-Type :multipart/form-data

                               Cookie: Cookie

 post.png

 

25 REPLIES 25
BrandonB
Alteryx
Alteryx

Hi @sreejithmp 

 

You will likely need to use a Blob input tool pointed at the file location and then subsequently base64 encode it. You can see an example here: https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/API-Calls-How-to-make-POST-cal... 

 

From what I can see in your postman configuration you may not need the blob convert tool and can get rid of the base64 encode step. 

NewToAlteryx2024
5 - Atom

Hi, I have a similar use case, Where you able to upload the file through the Rest API from Alteryx?

oneillp111
9 - Comet

any luck with this? I am still stuck with the same issue, with or without the blob, the file never attaches

apathetichell
19 - Altair

@oneillp111----> what is your error. What is the API? Original poster never responded. @BrandonB  is correct. Do you have this working in Postman?

oneillp111
9 - Comet

I am not getting an error, the flow completes, I get an 200 response from the API but the attachment never shows up

 

cURL example:

 

curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: no-check" -F "file=@myfile.txt" http://myhost/rest/api/2/issue/TEST-123/attachments

 

 

I do have it working in postman and using Blob gets no errors, just the attachment doesn't get there

apathetichell
19 - Altair

What is the API -> 90% of API schema guides are public -> so unless this is a private API -> there should be resources you can link to.

 

2) check what the content-type is in postman - and look for other headers. replicate them to Alteryx.

3) can you confirm you are sending a single record to the download tool -> with a blob file or base 64 encoded binary in the payload?

oneillp111
9 - Comet

The API is private

Content type is multipart/form-data;

single record with base 64 data in payload

apathetichell
19 - Altair

What is your response code/error message. Not much I can do with a private API.

oneillp111
9 - Comet

I get no errors in Alteryx, with a 200 response from the API

 

HTTP/1.1 200
content-encoding: gzip
content-type: application/json;charset=UTF-8
date: Tue, 14 Jan 2025 14:31:58 GMT
p3p: CP="NON CUR OTPi OUR NOR UNI"
transfer-encoding: chunked
x-content-type-options: nosniff
x-asessionid: 1lj5t1l
cache-control: no-cache, no-store, no-transform
x-xss-protection: 1; mode=block
x-ausername: xxxxxxx
x-seraph-loginreason: OK
content-security-policy: sandbox
strict-transport-security: max-age=31536000; includeSubDomains
referrer-policy: strict-origin-when-cross-origin
x-anodeid: Node-tr-p19-a
x-arequestid: 931x3334694x3
Set-Cookie: JSESSIONID=8ABD8A6DC50123AC23A25A116519C567; Path=/tracker19; Secure; HttpOnly
Set-Cookie: atlassian.xsrf.token=BTGP-PE51-YAKD-HC0Q_1d824da6457080a32424e0bc8c1c41ee34996f35_lin; Path=/tracker19; SameSite=None; Secure
Set-Cookie: BIGipServer~PART2492~RB-TRACKER-P19_21443=rd2492o00000000000000000000ffff0a3ae312o21443; Path=/; Secure; HttpOnly

Labels
Top Solution Authors