tRestClient "Post" API question

Highlighted
Four Stars

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

 

 

Moderator

Re: tRestClient "Post" API question

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

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: tRestClient "Post" API question

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

Moderator

Re: tRestClient "Post" API question

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

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

What’s New for Talend Spring ’19

Join us live for a sneak peek!

Sign up now

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads