One Star

5.1 tHttpRequest get Http Status Code

Hi,
I have a job sending data to a webservice using component tHttpRequest and i want this job to take a different path depending on the Http Status code received from the tHttpRequest.
Unfortunately i have been unable to capture the Http Status code even though it is displayed in the console.
I have attached a screenshot of my job.
Ideally the 2 if links would contain something like ?context.Http_Status_Code.equals(200)? and ?!context.Http_Status_Code.equas(200)?.
Do you have any idea on how to get this status code ?
Regards, Valentin
NB : I am working with 5.1
1 REPLY
Community Manager

Re: 5.1 tHttpRequest get Http Status Code

Hi
Just an diea I did't try, check the 'write the response content to file' option to output the response to a file, and then read this file to extract the status code with regular expression or othey way, and store it to a context variable, String type or int type. About the expression of runIf link, something like:
context.Http_Status_Code==200 // for int type.
or
context.Http_Status_Code.equals("200") // for string type
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business