Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
asy-jqm
Contributor
Contributor

Upload file with API rest (PUT) with talend

I'm using a PUT Method to upload a file in a tool (Anaplan).

I tried with POSTMAN and it works fine (i put the file in the binary of the body and the content-type is "application/octet-stream") 

Upload File Postman.pngPut Result Postman.png

But when i try to do it with talend the result is different either with tRestclient or classic tRest. The headers are same as postman and the body is "-upload-file C:/xxx/ANAPLAN/20240605_165600_DP_Warehouse_Full.csv"

asyjqm_0-1717681649469.pngasyjqm_1-1717681826966.png

Is there anyway I can upload file as binary in trest component or any other component.

Here is the link to the API documentation : https://help.anaplan.com/load-the-import-file-chunks-011d23cf-4acf-43a8-8b92-3dc5f07d7b6a

Thanks in advance

Labels (1)
  • REST

1 Solution

Accepted Solutions
janterje
Partner - Contributor III
Partner - Contributor III

Short answer:
No, it is not possible using tREST or tRESTClient.

I had a similar issue with Microsoft Graph file Uploads, and I ended up having to program it in Java as a custom Code Routine in Talend.

If you want to try something lite that for yourself, here is a post from someone who created this using Java:
https://community.anaplan.com/discussion/51791/uploading-file-via-rest-api-and-triggering-imports

As you can see, he turns the file into a ByteArrayInputStream.

So, unfortunately, no easy fix for this.
Expect to do some Java development to pull this off...

View solution in original post

2 Replies
janterje
Partner - Contributor III
Partner - Contributor III

Short answer:
No, it is not possible using tREST or tRESTClient.

I had a similar issue with Microsoft Graph file Uploads, and I ended up having to program it in Java as a custom Code Routine in Talend.

If you want to try something lite that for yourself, here is a post from someone who created this using Java:
https://community.anaplan.com/discussion/51791/uploading-file-via-rest-api-and-triggering-imports

As you can see, he turns the file into a ByteArrayInputStream.

So, unfortunately, no easy fix for this.
Expect to do some Java development to pull this off...

asy-jqm
Contributor
Contributor
Author

Hi, thanks for your solution. i didn't apply exactly the same code but i use a java routine very similar to this code and it works.