Rest API request body

Khanna Ji
Tera Guru

How to send data in the below format?

"name": "Invalid Test",
"created": {
"date_time": "2018-04-18T15:33:00",
"time_zone": "America/New_York"
},

I have able to send data for the name field but not able to send for created since it has some different format. In Rest Message variable substitution related list, we have one to one field mapping. like name to name, date_time to date_time, number to number but this is something different.

Anybody share some idea how to handle this?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Swathi,

Have those many variable substitutions in your rest message function and substitute those individually using setStringParameter()

your request body before substitution should look like

"name": "${name}",
"created": {
"date_time": "${date_time}",
"time_zone": "${time_zone}"
},

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Great.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Omkar Mone
Mega Sage

not helpful