Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tRestClient "Post" API question

Hi All,

 

I am trying to create an api call using the trestclient. The "GET" api call works for me but not the post. Here is the example in postman. I have to admit that this is the first time I use this component. I basically need to run an api call from a file to get NPL result back. I know I will need to parse the JSON result back. But first thing first, is to get the call right then I could replace the "document" with a list from a csv sheet. If you have an example you can share that will be great. 

 

I believe I am doing something wrong on how i am passing the variable (see tclient.png) the repsonse i get is either HTTP 400 Bad Request if my content type is JSON and HTTP 415 Unsupported Media Type if it was FORM. I am still new to Talend, and looking at the docs and video, i haven't see something that can pass parameters to the post call. The output back from the post will be something like that "{"probabilities": [{"label": "Sales Opportunity","probability": 0.95123386} "object": "predictresponse"}

 

Thanks in advance for your help

PS

 

 

Labels (5)
3 Replies
Anonymous
Not applicable
Author

Hello,

Could you please have a look at this related topic:https://community.talend.com/t5/Design-and-Development/resolved-tRESTClient-How-to-parse-the-JSON-re....

Feel free to let us know if it is OK with you.

Best regards

Sabrina

Anonymous
Not applicable
Author

Hi Sabrina,

 

Thank you for answering me, but that doesn't apply and it is outdated. I basically need to pass parameters to the post command and receive back a json string. At the moment i just need to know how to pass the post and get anything back. Then will go to the next step is mapping the result and feed list of files (document) like my postman image.  I am still new to talend

Anonymous
Not applicable
Author

Hello,

What's your input parameters? XML file?

If you want to pass directly the xml file as request to the web service when calling, read the root element as a node.

Please see my screenshot.

trestclient.png

Let us know if it is OK with you.

Best regards

Sabrina