My first guess would be that put requests need another special header. But I could not find any reference to that.
So far I tried with and without the ‘Accept: application/json’ header “post”
requires.
In fact I already tried a bunch of variations of this:
$headers[] = 'Accept: application/json';
$headers[] = 'Content-Length: ' . strlen($payload);
//$headers[] = 'X-Requested-By: cli';
//curl_setopt($ch, CURLOPT_PUT, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
What is going on here?
Web debugging and the documentation tell me that this endpoint does in fact expect “put” requests:
put /api/system/inputs/id/extractors/id
Web debugging:
PUT /api/system/inputs/id/extractors/id HTTP/1.1