Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

how to pass variables to rest message request body of post method

pavani19
Kilo Expert

Hi Team,

i want to use a rest message post method with request body having variables.

please find the screenshot below

the request body is a json format which passes 2 parameters which i want to pass dynamic values.

so i set the request body json like below

{
"userKey": "${userKey}",
"languagueCode":"$ {languagueCode}"
}

 

find_real_file.png

i am getting following response:

find_real_file.png

please help me how to set up variables in request body..

 

Thanks,

pavani

1 ACCEPTED SOLUTION

Robert Beeman
Kilo Sage

Hello Pavani,

It looks like you are close, but have two typos. The variables are case-sensitive, and in your Content block you have ${userKey} with a capital 'K', but in your variable substitutions you have "userkey" with a lower-case 'k'. For your languageCode in Content, you have a space between the dollar sign and first squirrely bracket: "$ {" vs "${" which is causing the variable to not resolve.

View solution in original post

2 REPLIES 2

Robert Beeman
Kilo Sage

Hello Pavani,

It looks like you are close, but have two typos. The variables are case-sensitive, and in your Content block you have ${userKey} with a capital 'K', but in your variable substitutions you have "userkey" with a lower-case 'k'. For your languageCode in Content, you have a space between the dollar sign and first squirrely bracket: "$ {" vs "${" which is causing the variable to not resolve.

Mike Patel
Tera Sage

you need

{
"userKey": "${userkey}",
"languagueCode":"${languagueCode}"
}