Five Stars

error when using tSystem with cURL to HTTP POST a single json file

The tHttpRequest_1 is broken in in 5.6.1 to HTTP POST a single json file (see #31574)
As work around I am using a tSystem to do pass the JSON file via cURL. My command is the following:
"curl -X POST -d 'data={\"status\":"+row24.status+",\"details\":\"+row24.details+"\"}' " +context.url

and the answer from the service is
{"success":false,"error":"Missing POST data"}


The same command from my terminal (linux) works great.
I tried to replace all my context variable with test data for debugging purpose -  without success
Any idea why the POST data are not recognized when using tSystem?
2 REPLIES
Seventeen Stars

Re: error when using tSystem with cURL to HTTP POST a single json file

There are some possible problems. At first there is a difference between running a script within the linux shell (with all environment variables set and tSystem which has a shell without these env vars.
Did you tried the component tRESTClient or tHttpRequest? I would say this much more reliable than depending to have curl available.
Five Stars

Re: error when using tSystem with cURL to HTTP POST a single json file

Thanks for the answer.
As said before the tHttpRequest is broken in talend v 5.6.1.
I've tried the tRestClient but our web service on the other side doesn't want to recognize the data posted. I am now trying to figure out if this come from my configuration of the tRestClient or our web service.