Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I use tWriteJsonField to send it into the body of an API.
The problem is that one of the field needed for the API is a number:
How can I do it?
Thanks
Yes and it works fine. Not the first time I use tRestClient on Talend on POST and GET request.
Here on a PATCH, don't know why it does not take the Json I send while in Postman I just do that:
ok it seems you dont have the array in your json created by talend
you can do it with
name your root node root instead of rootTag
adding an attribute on the root node
name class
fixed value (right click on the attribute and choose fixed value)--> array
add a sub element named root to the root node
add your data sub element to the root sub element
then you check remove root node in the component
root
@class array
---- root
--------- data
-------------- type
--------------attributes
Hi,
Sorry for late answer I had some projects to finish first... And thank you for your help and patience.
So I tried as you mentioned:
Unfortunatly it still don't work.
It send this:
{"rootTag":{"data":{"id":"XXXXX","type":"objects","attributes":{"1473":{"idContext":"0","idLanguage":"1","value":"XXXX"}}}}}
I tried to directly sent a string to look like the one I send in postman:
I don't know what I'm missing. I tried to send it into the String or the Body of the API but no result: still a 400 bad request 😕
So finally I manage to create a simple String in a T_Java to make my Json inside an array []. As it was impossible with tWriteJsonField which always start by
{"root", [...data...]}.
And it works 🙂
Sometimes the easiest way is the best^^
Oh and not in the body but in the string of the API. And activating the "Log messages" option in Advanced settings in the tRESTClient is VERY helpfull.
Thanks gJeremy for your time and your help 🙂