Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Informatique1
Contributor III
Contributor III

Column name is an integer

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:

0695b00000SqRShAAN.png

How can I do it?

Thanks

Labels (5)
13 Replies
Informatique1
Contributor III
Contributor III
Author

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:

0695b00000SqfUmAAJ.png

gjeremy1617088143

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

 

Informatique1
Contributor III
Contributor III
Author

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:

0695b00000SsjwZAAR.png 

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:

0695b00000Ssk15AAB.pngI 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 😕

Informatique1
Contributor III
Contributor III
Author

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 🙂