cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: HTTP PATCH does (not??) send JSON data to API

From: Rich Gray <rgray_at_plustechnologies.com>
Date: Tue, 02 Jun 2015 10:07:38 -0400

Petr Lázňovský wrote:
> Trying to use curl.exe with PATCH method to send JSON data to API, by
pushing data to STDIN of curl (avoid to write data to file). Got HTTP code
200 but ho data changes in database. Service provider inform me I am trying
"update nothing" (sending PATCH request with no data), but I can check it.
Anybody see any problem in my curl command construction?
>
> echo { "custom_id": "90433", "name": "Aleš Bržďucha", "street":
> "ěščřžýáíé
9", "city": "Uhl 4", "zip": "", "variable_symbol": "0", "email":
"dfgdfg_at_zrttr.cdf", "phone": "4748596" } | tail --bytes=+4 | curl.exe
--include --header "user-agent: My App" --header "content-type:
application/json; charset=utf-8" --insecure --request PATCH -u
"%login%:%passwd%" -so - --data-binary "@-" --url "https://%service_url%"

Assuming you want the double quotes sent as part of the data, you should
wrap the echo'd data in single quotes to keep the shell from removing the
double quotes?

- Rich

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-06-02