Hello, I trying to update variables values throw Cloud Api. First I want you to know that all script which is working with token generation, reading values and etc. is working perfect! I just cant update values.
- I can not find anywhere what does: 'X-Organization: ' . $xOrganization, mean's and where I can find its UUID. I have maker plan not free and even in it I can't find it.
here is one of the example of my code:
echo $url = "https://api2.arduino.cc/iot/v2/things/$thingId/properties/$config_id/publish";
$headers = array(
"Content-Type: application/json",
"Authorization: Bearer $token"
);
$data = array(
"value" => "$value",
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
$httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curlError = curl_error($ch);
echo "
$response
$httpStatus
$curlError
";
if ($response === false) {
echo "Error: " . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
I get this error:
https://api2.arduino.cc/iot/v2/things/0eef551e-5d9a-49fe-a8d5-xxxxxxxxxxx/properties/ac76ce1b-e2d0-41a4-9d33-xxxxxxxxx/publish {"id":"m5QMkvcx","code":"unauthorized","status":401,"detail":"not allowed to publish the property thingID=0eef551e-5d9a-49fe-a8d5-d7xxxxxxxx","meta":{"requestId":"8VXXTgQOyN-6477162"}} 401 {"id":"m5QMkvcx","code":"unauthorized","status":401,"detail":"not allowed to publish the property thingID=0eef551e-5d9a-49fe-a8d5-xxxxxxxxx","meta":{"requestId":"8VXXTgQOyN-6477162"}}
I know 100% that my token is valid because before sending this request its check device status, using this exact token and it valid for 3 minutes.
I know that here is a lot of very smart guys, required your help!
I have this error:
{
"id": "8okDRPTK",
"code": "unauthorized",
"status": 401,
"detail": "not allowed to publish the property thingID=0eef551e-5d9a-49fe-a8d5-d7xxxxxxx",
"meta": {
"requestId": "NCM4tnrKJF-6627637"
}
}
do not understand why or how I should allowed or even from where..?