Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am actually starting to learn Talend and I have this scenario: I need to call Rest WS, get the results, transform data so that it respect q certqin metadata Schema, then call another Rest Webservice, to post the data. What I used as components are : TRestClient -> tExtractJsonField ->TMap -> tRestWebservice. In the latest WS, I need :
- Send request one by one so should I use flowToIterate
- From the flow coming from the TMap, how can I prepare a Json body to send it in the Post of tRestClient.
I am getting an error / javax.ws.rs.WebApplicationException: HTTP 400 Bad Request
Thanks
Hi
tRestClient requries a document as input request, you need to use a tXMLMap instead of tMap to build the document.
Or you can use tRest to call API and use tWriteJsonField to write a Json string and pass it to tRest.
Regards
Shong
Hello Shong
Thanks for the reply. Ok let's assume that I will use the txmlMap. So the flow will be like this
I am right? Now I still have javax.ws.rs.WebApplicationException: HTTP 400 Bad Request
NB: I am trying to send only one record. here my tXmlMap
Yes I have tried with postman. This is the body that I send
The tXMLMap does not produce JSON. You need to send your JSON as a String to the tRestClient's "string" column. You also need to set the tRestClient up to receive JSON.
Hi,
After using the tXMLMap, the output is as below
How can I send it as Json String?
Create JSON and do not use the tXMLMap.
Hi
So shall I go for this solution instead of using a txmlMap
That would be a better approach if you want to produce JSON