Hi Everyone,
I'm quite new to Talend and I am stuck with posting json request using tRestClient. I browsed through the forum topics. But I could not find an example that posts a json request . Here is one of the scenarios I tried. I have an input json file:
{"name": "months", "levels": }
And here is my job:
tFileInputJSON ----row1 (Main) -->tXMLMap-- output(Main) -->tRestClient-----row4(Response)->tLogRow2
Basic Settings:
tFileInputJSON : Mapping - Column JSonPathQuery
name "name"
levels "$.levels"
I mapped these two to the body(root) of txmlMap. In the tRestClient I changed the content type to be JSON. When I ran the job, this is how my payload looked
<quote>
Http-Method: POST
Content-Type: application/json
Headers: {Content-Type=, Accept=}
Payload: {"name":"months","levels":""}
</quote>
I would expect the payload to be
Payload: {"name":"months","levels":}
Is there a way to send the json request directly to the tRestClient? I assume tXMLMap is a mandatory component before tRestClient as tRestClient needs body and string as the input
I would appreciate if any body could provide a sample job.
Note: I am using Talend Open Studio for ESB (v 5.3)
Thanks
Hi ssunkara
I am working on your problem, but I am not able to reproduce the problem, can you please export the job and send it to me via email?
Thank you!
Shong
Double quotes apparently get escaped somewhere early in the route, Jettison provider won't do it.
FYI, tXMLMap will only be needed if DOM4J to JSON auto-conversion is needed, using a dedicated tWriteJson component may be better indeed.
Actually, you probably need to remove quotes in your configuration.
Sergey