Before you begin
You need:- An access token. See the quickstart.
- The
buildingId,datasourceId,deviceId, andpointIdof a writable point. Points withwritableset totruein List building points accept writes.
Write to a point
1
Get the write fields
Call List point write fields. Each item in the response is a field you can send.For each field, read:
identifier: The value to send asid.options: The allowed values. Send the option_id.metadata.required:MANDATORY,OPTIONAL, orCONDITIONAL.metadata.filter: For conditional fields, the values of other fields that make this field apply.
2
Build the actions array
Add one entry per field. For example, a typical override needs Duration options are in milliseconds.
priority, duration, and value. The value and duration fields apply only when priority is override.-1 means permanent.3
Send the write
Post the body to Write to a point:The response returns the point priority array, so you can confirm the new value at the level you wrote.
4
Release the override
When the override is no longer needed, send a write with
priority set to release. The equipment then returns to its normal control logic.Write to many points
To change several points on the same data source, use Write to points in a batch. Each item contains the pointid and its own actions array.
The response reports successCount and failureCount. Check failureCount before you treat the batch as complete, and do not retry the whole batch blindly.
Write across devices and buildings
To write to points on many devices, or in many buildings, use the mass write operations. You describe the points with a query and check the plan before you write.1
Discover the groups
Send a
query with buildingIds and any filters to Discover mass write point groups. Each group has a groupKey and the fields a write to it can carry.2
Validate the plan
Build
writes so that every group is in exactly one write. Send the plan to Validate or apply a mass write with validateOnly set to true. Fix the issues in the report, then note the etag.3
Start the write
Send the same plan without
validateOnly, with a requestId and the etag. Keep the last segment of operation.name as the operationId.4
Follow the operation
Poll Get a mass write operation every
metadata.pollAfterSeconds until done is true. Reading the operation is what finishes it. Then call List mass write results for the outcome of each point. To send failed points again, call Retry a mass write operation.
