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
Solved! Go to Solution.
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.
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
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.
Did you manage to sort out how to execute the trestclient?
How do you pass all field from input row to a json document inside the body of the trestclient.
Could trestclient body allow to mapped expected field to pass from the current row?
Thanks for the hint, I have read the full post including image, I am still lost on what to do inside tmap and jsonwrite
I have sort it out: just need to put the loop in the first field int twritejsonfield, check the remove root node and ensure trestclient is fully configured in json, I now have to understand why null are transformed in 
Great news! I try to give enough information in my posts so that others can figure it out for themselves for similar issues. I find that you learn the product better if you have to struggle a little on your own
to fixe the null transformed [ ] : in Insert a tJavaRow with the following code right after your tWriteJsonField:
output_row.string = input_row.string.replaceAll(",?\"[a-zA-Z_0-9]*\":\\[\\]", "");
thanks to Jbalberge
In order to resolve the issue of Null array generated by the tWriteJsonField, yu need to declare the attribute as object and not String Like below
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Take a look at this technical overview video of Talend API Designer
Find out how to get started with APIs