Hi there, device types have fixed properties and you cannot dinamycally assign new properties to them. The way to add new properties to a device is to use a PATCH request, please find below the structure to do that using a curl command:
Hey,
I’d really like to implement this. Need to assign a text property to a device via http interface on my iot device.
I can create the property name on the Ubidots side, but need to populate it from the device.
Have http interface on iot device (Telit LE910) but doesn’t look like PATCH is supported (just POST, PUT, GET, HEAD, DELETE.
An alternative would be a variable that can populated with a text string. So far can’t see a way to do either.
Cheers
Rob
Tried using curl, and got a reply from industrial.ubidots.com that PATCH is forbidden on the server. Only GET, POST, HEAD, OPTIONS are permitted. Is there an alternative?
It seems like this should work as per API doc here… https://docs.ubidots.com/reference#update-device
However, it refers to v2.0 API rather than v1.6. Trying the PATCH on v1.6 API result in a permission denied error. v2.0 API is just 404 not found.
Bump please? Any ideas?
Regards
Rob
With respect to the below message, it makes sense you got the that response through industrial.ubidots.com because the official API domain is actually industrial.api.ubidots.com. For any API interaction, please use the later domain, regardless if you’re using v1.6 or v2.0.
Now, you can use either API v1.6 or v2.0 to PATCH your device’s properties. In order to better help you, can you please share with me the cURL command you’re using with v2.0 so I can determine what’s wrong and the reason behind the 404 Not Found error response code?
Furthermore, since you’re using this version, I recommend reading this section to understand the different operations modes of the API v2.0.
In a nutshell, you’ll see that must of the endpoints receive a <key> as the entity identifier. This <key> can be either the entity ID or its label, however, when using labels you’ll need to prefix it with the tilde (“~”) character so the API knows you’re querying it with labels instead of IDs. For example, say you’re Device label is “demo”, in the URL you need to enter it as “~need”.