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
   

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download