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: Thu, 28 Jan 2016 13:07:22 -0500

Hi,

>>>>>>You can certainly do that, sure. If that's the correct action for
your situation, we can't tell.
Your answer "If that's the correct action for your situation, we can't
tell" makes me un-sure. What I try to get is that for the http "DELETE",
include the url AND body portion, can "curl_easy_setopt(handle,
CURLOPT_CUSTOMREQUEST, "DELETE");" and
"curl_easy_setopt(curlHandle, CURLOPT_POSTFIELDS, frmdata);" achieve it?

I am sorry if I misunderstand what your answer is.

The following is the message -

//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-28