U
U
Ultraice2014-09-05 17:55:25
PHP
Ultraice, 2014-09-05 17:55:25

How to send a request using the PUT method with a request body?

To work with the Yandex.Market API, you need to send requests of the form:
PUT https://api.partner.market.yandex.ru/v2/campaigns/...
Content-Type: application/json
PUT request body:
{"bids" :[
{"offerId":"239982","feedId":30919,"bid":0.22, "cbid":0.33},
{"offerId":"239983","feedId":30919,"bid":0.22 , "cbid":0.27},
{"offerId":"239984","feedId":30919,"bid":0.22, "cbid":0.15, "fee":1.5} ]
}
I use curl with the CURLOPT_POSTFIELDS parameter in my body
Maybe there is a parameter for PUT as well?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yakov Akulov, 2014-09-05
@Ultraice

Same as for POST request use CURLOPT_POSTFIELDS, in curl add option CURLOPT_CUSTOMREQUEST = 'PUT'
instead of CURL_POST

U
Ultraice, 2014-09-08
@Ultraice

The error was that instead
of $arCurlSettings[CURLOPT_CUSTOMREQUEST] = 'PUT';
i used
//$arCurlSettings[CURLOPT_PUT] = true;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question