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

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?
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.

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 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog