cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to do http "DELETE" in libcurl

From: cnm marketing <cnn.marketing_at_gmail.com>
Date: Wed, 27 Jan 2016 11:48:15 -0500

I am trying to achieve the following http "DELETE" in REST -

//url portion
 HTTP DELETE https://xxxxxx/object?name=xyz
 // body portion
 {
 "bodayField":"abcd"
 }

The url portion uses curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST,
"DELETE");
And the boday portion uses curl_easy_setopt(curlHandle, CURLOPT_POSTFIELDS,
frmdata);

Will it work in libcurl?

Message: 4
Date: Tue, 26 Jan 2016 23:51:34 +0100 (CET)
From: Daniel Stenberg <daniel_at_haxx.se>
To: libcurl development <curl-library_at_cool.haxx.se>
Subject: Re: How to do http "DELETE" in libcurl
Message-ID: <alpine.DEB.2.20.1601262350550.7206_at_tvnag.unkk.fr>
Content-Type: text/plain; charset=US-ASCII; format=flowed

On Tue, 26 Jan 2016, cnm marketing wrote:

> Does the following make sense to you, I found this some place, but want to
> make sure this is valid:
>
> curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "DELETE");
> NOTE - send body with HTTP DELETE
> I suggest you simply set the body with CURLOPT_POSTFIELDS and set
> CURLOPT_CUSTOMREQUEST to "DELETE". Done.

You can certainly do that, sure. If that's the correct action for your
situation, we can't tell.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2016-01-27