Generate a new entity for the account.
Object data to create new device
Delete data records in a entity using the profile token and entity ID.
See the example to understand how to use this method properly to have full control on what to delete.
Entity ID.
Items to be deleted.
Success message indicating amount of records deleted (can be 0).
await Resources.entities.deleteEntityData("myEntityID", { ids: ["idOfTheRecord1", "idOfTheRecord2"] });
Modify any property of the entity
Entity ID
Entity object with fields to replace
Edit data records in a entity using the profile token and entity ID.
The updatedData
can be a single data record or an array of records to be updated,
each of the records must have the id
of the record and the fields to be updated.
Entity ID.
A single or an array of updated data records.
Success message indicating amount of records updated (can be 0).
await Resources.devices.editEntityData("myEntityID", { id: "idOfTheRecord", field1: "new value", field2: "new unit" });
Add a field to the entity schema
entity ID
schema or index to be added
Optional
index?: Record<string, { Optional
schema?: EntitySchemaSuccess message
Get all the data from a entity.
Entity ID
Optional
queryParams: EntityDataQueryQuery parameters to filter the results.
Optional
options: { Optional
paramsArray with the data values stored in the entity.
const lastTenValues = await Resources.entities.getEntityData("myEntityID", { amount: 10 });
Get Info of the Entity
Entity ID
Retrieves a list with all entities from the account
Optional
queryObj: EntityQuerySearch query params
Optional
options: { Optional
paramsqueryObj: {
page: 1,
fields: ["id", "name"],
filter: {},
amount: 20,
orderBy: "name,asc",
}
Send data records to a entity using the profile token and entity ID.
The data
can be a single data record or an array of records to be sent.
Entity ID.
A single or an array of updated data records.
Success message indicating amount of records sent (can be 0).
Update a field from the entity schema
entity ID
field name to be updated
data to be updated
Get amount of data stored in the Device.