Discussion:
How to use libcurl to evoke an HTTP PATCH method
Blake McBride
2016-08-12 17:53:36 UTC
Permalink
Hi,

I am using:


* if (!strcmp(ci->httpVerb, "GET"))*
* curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);*
* else if (!strcmp(ci->httpVerb, "POST"))*
* curl_easy_setopt(curl, CURLOPT_POST, 1L);*
* else if (!strcmp(ci->httpVerb, "PUT"))*
* curl_easy_setopt(curl, CURLOPT_PUT, 1L);*
* else if (!strcmp(ci->httpVerb, "PATCH"))*
* ???????????;*


I can't figure out what to do in the case of a PATCH method. Sure
appreciate some help.

Thanks!

Blake McBride
Joel DePooter
2016-08-12 20:05:21 UTC
Permalink
Use the CURLOPT_CUSTOMREQUEST option:

curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PATCH");

-Joel
Post by Blake McBride
Hi,
* if (!strcmp(ci->httpVerb, "GET"))*
* curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);*
* else if (!strcmp(ci->httpVerb, "POST"))*
* curl_easy_setopt(curl, CURLOPT_POST, 1L);*
* else if (!strcmp(ci->httpVerb, "PUT"))*
* curl_easy_setopt(curl, CURLOPT_PUT, 1L);*
* else if (!strcmp(ci->httpVerb, "PATCH"))*
* ???????????;*
I can't figure out what to do in the case of a PATCH method. Sure
appreciate some help.
Thanks!
Blake McBride
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Loading...