tREST- Using Context Variable in tRest

One Star

tREST- Using Context Variable in tRest

I am trying to make a POST command using tREST component. When I type in the exact payload to be sent to the server in HTTP Body section, the job works fine and I am able to make the call and get a successful response from the server. But when I store the payload in a string context variable and then put the variables name in the HTTP Body section, I get a http 400 error. Any idea why is this happening?
Moderator

Re: tREST- Using Context Variable in tRest

Hi,
How did you store the payload in a string context variable and put the variables name in the HTTP Body section? Could you also post your setting screenshots into forum, please? In this way, we can address your issue quickly.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: tREST- Using Context Variable in tRest

I am using tJavaflex for assigning the context variable. here i is the screenshot of of the java code. Variable s is of string type. As you can see that context.new1 is getting the variable s and context.new2 is being assigned a string directly, which is of the same value as of s ; I printed the value of s on the console and then copied it here.
When tRest is given context.new1 it shows error but works fine with context.new2