Datapoint Value

Obtains the present value of a datapoint. The present value conforms to the type specification for the datapoint. You can read/write to one or more datapoints at a time. There are many ways to do a bulk read or bulk writes to multiple datapoints, some of which are listed below.

For reading datapoints you use the same GET request when using REST or REST with WebSockets. When only using REST you will use the GET response data. When using REST with WebSockets you ignore the GET response and just use WebSocket datapoint update. 

For bulk writes, you write the same value to all the datapoints. You will get a HTTP 204 response if there is nothing wrong with the bulk write request. You will get a HTTP 422 if one of the datapoints is already using a higher priority then the one included in the request.

Methods to do bulk read/writes:

1. Use wild cards for parts of in the request URI - take care when writing to multiple datapoints as you may end up writing to an unintended datapoint.
2. Use a list of dpQualifiers to write to specific dataponts (a datapoint dpQualifier is shown in the CMS Datapoint Widget "Show Detail Properties")
3. Use datapoint tags - you will need to add the datapoint tag to the datapoint's tag property prior to using for the datapoint read/write.

URI Definition

Method          

URI and Fields

GET


/iap/devs/{id}/if/{block}/{block_index}/{datapoint_name}/value/{prop_name}

Gets the current value for the specified datapoint.

See examples below.

XIFname vs Instance Name

  • The block path element uses the block XIFname.
  • The datapoint_name path element uses the datapoint instance name.

Path Parameters

The optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page.

The following list describes the optional path parameters for the prop_name path element of the Datapoint Value endpoint:

Path Parameter                                                        

Description

type={prop_type}Filters for properties with the specified property type.
value={prop_value}Filters for properties with the specified property value.
PUT/iap/devs/{id}/if/{block}/{block_index}/{datapoint_name}/value/{prop_name}

Updates the default value for the specified datapoint, and will not be published until all overrides are cleared.

See examples below.

XIFname vs Instance Name

  • The block path element uses the block XIFname.
  • The datapoint_name path element uses the datapoint instance name.

Path Parameters

The optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page.

The following list describes the optional path parameters for the prop_name path element of the Datapoint Value endpoint:

Path Parameter                                                        

Description

type={prop_type}Filters for properties with the specified property type.
value={prop_value}Filters for properties with the specified property value.

Queries

You can include queries with your IAP/REST request to specify a selection rule for your request.  As described in Queries and Parameters, you can specify a query as a  query parameter appended to the end of your URI preceded with a "?" character, or as a path parameter within a path element of the path component.

The optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page.

Examples

Get all datapoints named nviValue:

GET      /iap/devs/*/if/*/*/nviValue/*


Get all datapoints with a name starting with nvi from devices with normal device health.

GET      /iap/devs/*+health==normal/if/*/*/*+name=+^nvi/*


Get all datapoints from devices with provisioned status.

GET      /iap/devs/*+status==provisioned/if/*/*/*/*


An example of a datapoint value Response in JSON format:

GET    /iap/devs/*+name==PulseGen1/if/device/0/nviCount/value


Response:
[
    {
        "deviceId":2,
        "deviceName":"PulseGen1",
        "deviceHealth":"normal",
        "deviceState":"provisioned",
        "blockName":"device",
        "blockIndex":0,
        "utc":"2020-08-07T00:03:43.237Z[UTC]",
        "local":"2020-08-06T17:03:43.237-07:00[America/Los_Angeles]",
        "dpQualifier":"17qam88/lon/1/device/0/nviCount",
        "datapointName":"nviCount",
        "name":"nviCount",
        "presetValue":null,
        "locValue":18,
        "value":18
    }
]


Getting datapoint values using dpQualifier list.  A datapoints dpQualifer's is shown in the CMS Datapoint Widget "Show Detail View" or you can programmatically create it.

dpQualifier: <SmartServer SID>/<protocol>/<device DID>/<blockName><blockIndex>/<datapoint XIF name>

Read Request Format:

GET /iap/devs/*/if/*/*/*+qualifier=-<encloded dpQualifierList>/value?max_age=2&noxs=true

Example:  dpQualifier List = 17qam88/lon/6/device/0/nviLamp1,17qam88/lon/6/device/0/nviLamp2

Read request (unencoded):

GET     /iap/devs/*/if/*/*/*+qualifier=-17qam88/lon/6/device/0/nviLamp1,17qam88/lon/6/device/0/nviLamp2/value?max_age=2&noxs=true

Get request encoded:

GET     /iap/devs/*/if/*/*/*+qualifier=-17qam88%2Flon%2F6%2Fdevice%2F0%2FnviLamp1,17qam88%2Flon%2F6%2Fdevice%2F0%2FnviLamp2/value?max_age=2&noxs=true


Writing to a datapoint using device name and preset value, without specifying priority (sent at Normal (17) priority).

PUT      /iap/dp/+*name==PulseGen1/if/device/0/nviHVACMode/presets/value         

Payload: ON


Writing to a datapoint using device name and preset value, specifying Normal (17) priority.

PUT      /iap/devs/+*name==PulseGen1/if/device/0/nviHVACMode/overrides/17/presets/value         

Payload: ON


Writing to a structured datapoint using device name and preset value, without specifying priority (sent at Normal (17) priority).

PUT     /iap/dp/+*name==PulseGen1/if/device/0/nviSwitch/localization/value         

Payload: {"state":1, "value":100}


Writing to a structured datapoint using device name and preset value, specifying Normal (17) priority.

PUT     /iap/devs/+*name==PulseGen1/if/device/0/nviSwitch/overrides/17/localization/value         

Payload: {"state":1, "value":100}


Writing to datapoint using device name and preset value, without specifying priority (sent at Normal (17) priority).

PUT     /iap/devs/+*name==PulseGen1/if/device/0/nviTemp/value         

Payload: 30


Writing to datapoint using device name and preset value, specifying Normal (17) priority.

PUT     /iap/devs/+*name==PulseGen1/if/device/0/nviTemp/overrides/17/value         

Payload: 22


Writing the same value to multiple datapoints using dpQualifier list (batch write).  A datapoints dpQualifer's is shown in the CMS Datapoint Widget "Show Detail View" or you can programmatically create it.

dpQualifier: <SmartServer SID>/<protocol>/<device DID>/<blockName><blockIndex>/<datapoint XIF name>

Request Format:

PUT /iap/devs/*/if/*/*/*+qualifier=-<encloded dpQualifierList>/value?max_age=2&noxs=true?maxage=2

Payload: <payload value>

Example: dpQualifier List = 17qam88/lon/6/device/0/nviCount1,17qam88/lon/6/device/0/nviCount2

Write request (unencoded):

PUT     /iap/devs/*/if/*/*/*+qualifier=-17qam88/lon/6/device/0/nviCount1,17qam88/lon/6/device/0/nviCount2/value

Payload: 5

write request encoded:

PUT    /iap/devs/*/if/*/*/*+qualifier=-17qam88%2Flon%2F6%2Fdevice%2F0%2FnviCount1,17qam88%2Flon%2F6%2Fdevice%2F0%2FnviCount2/value?max_age=2&noxs=true

Payload: 5


If nviTemp is 22 degrees C, and the datapoint has localization (CMS Datapoint Property Widget or DLA) to convert it to 71.6 degrees F, but you want to change it to 95 deg F using priority 14.  You can use either one of the following two PUT requests:

  • Sending Fahrenheit value: 95

    PUT     /iap/devs/+*name==PulseGen1/if/device/0/nviCount/overrides/14/localization/value         

    Payload: 95


  • Sending Celsius value: 35

    PUT     /iap/devs/+*name==PulseGen1/if/device/0/nviCount/overrides/14/localization/value         

    Payload: 35