Entity object
Definition
An entityObject
reflects the JSON representation of entities from the API, but it's provided with 3 methods that allow interacting with that particular instance.
Example
Suppose that you retrieve data from a device as:
Here, firstDevice
is an object containing all the properties of the dictionary representation of a device from the API:
But, not only does this object have the properties shown above, you can also invoke the following methods on firstDevice
:
Entity object methods
refresh
Returns the most recent state of the entityObject
from the server.
Ubidots.<entity>.<get-method>(, [args]).refresh()
None
entityObject
update
Updates the entityObject
fields on the server with the values given in the object passed as argument.
Ubidots.<entity>.<get-method>(, [args]).update(props)
props: object
An object with at least 1 valid property of the given entity
entityObject
save
Updates the entire entityObject
on the server with the values given in the object passed as argument.
Ubidots.<entity>.<get-method>(, [args]).save(props)
props: object
An object containing all the properties of the given entity
entityObject
Last updated