POST request with JSON data to tRESTClient component
How can I create POST request with JSON data using tRESTClient component? I can only successfully send XML Document. Should I put JSON data inside XML element? It seems that is the only way to send JSON data. I am using talend 5.5.1.
Which component should I use ? tRESTClient or tREST ? I would like to use tRESTClient but it only inputs "Document" type of data and JSON data are String type.
The Document type is quite ok. This is the result of the tXMLMap or another document related components in Talend. For an REST request you need an document.
Hello, In the component tRESTClient, there are two fields : 'body' and 'string'. You need to juste put your string json in the field 'string' of the tRESTClient. Lin LIN Consultant BI/Talend Synaltic Group
when I put string into a tRestclient's string filed I always get null on the other side inside a service. But the body gets through. What am I doing wrong?
The other side you mean the output? In the output, there are also body and string. But it's not body and string of the input. If you choose the option 'Convert Response To DOM Document', the result of the ouput will be put in the body. If not, the result will be put in the string. Lin LIN Consultant BI/Talend Synaltic Group
On the other side I mean on the service side. I have 2 jobs, one is consumer that has tRestClient component. The tRestClient component has 2 inputs body and string. I am inputing both body and string. The second jobs is a service. In this job tRestResponse component outputs the string and body that was inputed in previosuly mentioned tRestClient component. My problem is that from tRestResponse component i get out body but not string. String is always null no metter the input. What should I do so the string won't be null? Right now from tRestResponse component I would also like to recive a string not just body.
I am using talend 5.5.1 and there is no 'Convert Response To DOM Document' option? Is there something I can do in 5.5.1 version to transfer JSON data to the service and not inside XML?