I'm trying to connect API with PHP. But all I get is "Command parameters are required". In order to work I need to send RAW Body data with it and it needs to be in PUT method.
Json data needs to look like
{
"OutputID":"Some key",
"Activate":true,
}
Here is my code
$curl = curl_init($URL);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
$jsonData = array(
'OutputID' => 'Some key',
'Activate' => true,
);
$jsonDataEncoded = json_encode($jsonData);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonDataEncoded);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: 0',
$Authorization_Token_Key));
if(curl_exec($curl) === false)
{
echo 'Curl error: ' . curl_error($curl);
}
else
{
echo '';
}
If I try it with Postman it works but not in PHP Script.