Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello community,
I would like to create a REST request with the following parameters int Talend. Which component should I use and how to pass parameters to this component (body)? I have all necessary metadata on an input edge, need to transform somehow to body/string parameter and add definition for file to upload (path on the edge).
I have used tRestClient :
and I used tRest :
Any Help please
@
@richard Hall
Thank you.
Hello @Richard Hall @Xiaodi Shi
I have finally make this API.
I have used tFileFetch :
Here is my notes to close this case :
Thank you for your collaboration.
zied
Hello,
Could you please stick to one topic:
https://community.talend.com/s/question/0D55b00006e5eJ3CAI/api-rest-post-pdf-file-with-other-params so that we could pay individual attention to your issue. Thanks for your time.
Bets regards
Sabrina
Hi @zied khayechi,
Unfortunately it is very difficult to help with web service queries like this as they all have their own requirements. One solution certainly doesn't fit all when it comes to services.
However, I have spotted a few issues in your config that might be causing this.
First of all, in your tRestClient config, you are not setting the "Accept Type" to Multipart. This needs to be done when transferring files.
Also, when you are using the FORM Content Type, the query params box below becomes the place to configure your form params. So all of your params shown in the top image need to be in there and named appropriately.
WIth regard to the file name, you may need to play around with this a bit. It won't just be the name you need to supply, I suspect that it will need to be the full path to the file.
Can you try this out and let us know how you get on?
Hello @Richard Hall
i have already test it, but it didn't work for me 😞
Can you post the error message please? The NullPointerException should not be happening.
Also, what is being sent via the tJava4. The tJava is not meant to be used like that. It would be better to use the tJavaFlex to send row data. Can you share the code and show your tRestClient input schema?
In fact, i wanna just post a pdf file and queries via API .
and I don't have anything as input ( BODY/STRING) ( as we have multipart/form-data content-type)
when i put accepter-type = multipart I got a NullPointerException
But as accepter type = all , I got Bad request ( missing queries )
|400 |{"code":400,"success":false,"data":{"error":"Bad request - repository_id is missing or null"}}|
This is the API Swagger:
Thanks @Richard Hall
Can you try moving the repository_id from params to the header section. It looks like you have it as a header variables in your tRest that is working. However in your tRestClient version you have it as a param.
does't work either 😞
Can you share the API documentation? It is almost impossible to guess at what an API requires I'm afraid.
here the API DOc