Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Ziedkh
Contributor III
Contributor III

API REST : POST PDF file with other params

Hello,

I would like to send file in a POST API through trestclient,

i have attached the file and parameter in the query parameter but i couldn't detect the file.

Any help please

@xdshi

 (Talend Beijing Tech Co., Ltd.)

Thanks

0695b00000L1YEmAAN.png0695b00000L1YHCAA3.png

Labels (3)
4 Replies
Anonymous
Not applicable

Hello,

What's your input file? Please try using a tRest component instead of a tRestClient to POST w/ a body. You can past the raw JSON directly in the HTTP body section.

Please have a look at my screenshots for details.0695b00000L1kCTAAZ.pngYou should be passing the value that is sent from the tFileInputRaw

0695b00000L1kCYAAZ.pngWhere 'row1' is the row leading from tFileInputRaw and 'content' is what represents the content of the file. (Clicking the row itself, then the component button will let you see what the schema is defined as)

0695b00000L1kDRAAZ.pngLet us know if it is OK with you.

Best regards

Sabrina

 

 

 

Ziedkh
Contributor III
Contributor III
Author

Hello Sabrina,

 

Thanks a lot for your help.

I created the same flow and i have some issues:

0695b00000L1mCzAAJ.png0695b00000L1ksKAAR.png 

  1. It is OK to put the authorisation OAuth2.0 and token in header params ?
  2. The API have a multipart/form-data ( params ars file, integer, string and an array) , i have integreted the file in the body as ( pdf_input.content) and i wanna check if i put the others params in the body or the header??

(upload file and other parameters through REST api)

( This is the API Swagger ) 0695b00000L1kliAAB.png0695b00000L1kmgAAB.pngThanks @xdshi

Zied kh

Anonymous
Not applicable

Hello,

You input is PDF file? I didn't try to upload PDF file via trestxxx component before. Here is tfilefetch component which has Upload file option to upload one or more files to the server in advanced settings.

Best regards

Sabrina

Ziedkh
Contributor III
Contributor III
Author

Hello,

 

I have tried tFilefetch to send the file and params to the API ( see screenshots )

 

0695b00000L1xFfAAJ.png0695b00000L1xFzAAJ.pngbut I still have issues:

0695b00000L1xJwAAJ.png 

=> The problem is how to pass a PDF file and others parameters to the API .

 

Note:

it works well on Postman with this config :

0695b00000L1xMHAAZ.png 

Thanks ​ xdshi]​