Returns a list of all thing templates belonging to an account as per the specified criteria. This API is paginated and returns 20 thing templates by default. An thing template is uniquely identified by an 'thing_template_key'. This key should be used in all the other API referencing a particular thing template.
Param name | Description |
---|---|
page optional |
Page number of results to be fetched, Default 1 Value: Must be Integer. |
per optional |
Number of thing templates to be returned in one page, Default 20 Value: Must be Integer. |
order_by optional |
Field on which thing templates should be sorted Value: Must be a String |
order optional |
Order, “asc” or “desc”, in which results should be sorted Value: Must be a String |
search optional |
Keywords based on which thing templates should be searched. Currently you can search thing templates on - thing_template_key, name, tags or user_defined_properties Value: Must be a String |
scope optional |
Matching condition if multiple keywords are specified for search. Valid values are “all” or “any”. Default is “all” Value: Must be a String |
timestamp_format optional |
Format, “str” or “int”, in which timestamps should be returned, Default “int” Value: Must be a String |
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
field_list optional |
List of fields required in the result. Value: Must be an array of any type |
is_oem optional |
Return thing templates of child accounts along with thing templates of oem account if is_oem flag is true. Value: Must be one of: <code>true</code>, <code>false</code>, <code>true</code>, <code>false</code>. |
Request - listing all thing templates without any criteria curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:olezAZXGQn9MutnfNerKDQ" https://api.datonis.io/api/v3/thing_templates Response (returns first 20 records) { "total_count": 3, "page": 1, "thing_templates": [ { "created_at": 1448361986, "description": "Template for Refrigerators", "name": "Refrigerator", "thing_template_key": "2a5t58bbt8", "updated_at": 1448361986, "user_defined_properties": { "Firmware Ver": "1.0", "STATE": "OK" }, "metrics": [ { "metric_key": "d3tdc136b3", "metric_name": "temperature" }, { "metric_key": "b44c32be53", "metric_name": "power" }, { "metric_key": "c6a86c8576", "metric_name": "voltage" } ] }, { "created_at": 1448361987, "description": "Template for washing...
Request - listing thing templates by specifying number of thing templates to be returned at a time (page size) and specific set to be returned (page) curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:olezAZXGQn9MutnfNerKDQ" -d '{"per":"2","page":"2"}' https://api.datonis.io/api/v3/thing_templates Response (returns page 2 with 2 thing templates per page) { "total_count": 3, "page": "2", "thing_templates": [ { "created_at": 1448361987, "description": "Template for Energy Meters", "name": "Energy Meter", "thing_template_key": "bdb1fd1ae1", "updated_at": 1448361987, "user_defined_properties": { "Firmware Ver": "1.0", "STATE": "OK" }, "metrics": [ { "metric_key": "3et13bet93", "metric_name": "consumption" }, { "metric_key": "ef15ed79t1", "metric_name": "voltage" }, { "metric_key": "caf425fb7f", "metric_name": "current" } ] } ] }
Request - listing thing templates ordered by a field with string formatted timestamps curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:olezAZXGQn9MutnfNerKDQ" -d '{"timestamp_format":"str","order_by":"name","order":"desc"}' https://api.datonis.io/api/v3/thing_templates Response (returns thing templates in the reverse order of their name and timestamps in string format) { "total_count": 3, "page": 1, "thing_templates": [ { "created_at": "2015/11/24 10:46:27", "description": "Template for washing machines", "name": "Washing Machine", "thing_template_key": "af31ae5fb2", "updated_at": "2015/11/24 10:46:27", "user_defined_properties": { "Firmware Ver": "1.0", "STATE": "OK" }, "metrics": [ { "metric_key": "4f9b9764t7", "metric_name": "capacity" }, { "metric_key": "4tb363cc88", "metric_name": "maximum_rotational_speed" }, { "metric_key": "278t29123d", "metric_name": "noise_level" }, { "metric_key": "492c52bf56", ...
Request - listing thing templates based on some search criteria with all keywords matching curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:olezAZXGQn9MutnfNerKDQ" -d '{"search":"refrigerator state"}' https://api.datonis.io/api/v3/thing_templates Response (returns thing templates containing both keywords 'refrigerator' as well as 'state') { "total_count": 1, "page": 1, "thing_templates": [ { "created_at": 1448361986, "description": "Template for Refrigerators", "name": "Refrigerator", "thing_template_key": "2a5t58bbt8", "updated_at": 1448361986, "user_defined_properties": { "Firmware Ver": "1.0", "STATE": "OK" }, "metrics": [ { "metric_key": "d3tdc136b3", "metric_name": "temperature" }, { "metric_key": "b44c32be53", "metric_name": "power" }, { "metric_key": "c6a86c8576", "metric_name": "voltage" } ] } ] }
Request - listing thing templates based on some search criteria with any of the keywords matching curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:olezAZXGQn9MutnfNerKDQ" -d '{"search":"refrigerator state","scope":"any"}' https://api.datonis.io/api/v3/thing_templates Response (returns thing templates containing either of the keywords 'refrigerator' or 'state') { "total_count": 3, "page": 1, "thing_templates": [ { "created_at": 1448361986, "description": "Template for Refrigerators", "name": "Refrigerator", "thing_template_key": "2a5t58bbt8", "updated_at": 1448361986, "user_defined_properties": { "Firmware Ver": "1.0", "STATE": "OK" }, "metrics": [ { "metric_key": "d3tdc136b3", "metric_name": "temperature" }, { "metric_key": "b44c32be53", "metric_name": "power" }, { "metric_key": "c6a86c8576", "metric_name": "voltage" } ] }, { "created_at": 1448361987, "description": "Template for washing machines", "name": "Washing Machine", "thing_template_key": "af31ae5fb2", "updated_at": 1448361987, "user_defined_properties":...
Creates an thing template with given parameters
Param name | Description |
---|---|
thing_template required |
Map containing details of the thing template to be created Value: Must be a Hash |
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
is_oem optional |
Create thing template in child account by oem user if is_oem flag is true. Value: Must be a Boolean |
child_organisation_key optional |
Organisation key of child account where oem user wants to create thing template. Required field if is_oem is present. Value: Must be a String |
Request curl -X POST -H "Content-Type:application/json" -H "X-Auth-Token:olezAZXGQn9MutnfNerKDQ" -d '{"thing_template":{"name":"Refrigerator","description":"Template for Refrigerators","user_defined_properties":{"Firmware Ver":"1.0","STATE":"OK"}}}' https://api.datonis.io/api/v3/thing_templates Response (containing details of the thing template created) { "thing_template": { "created_at": 1448361986, "description": "Template for Refrigerators", "name": "Refrigerator", "thing_template_key": "2a5t58bbt8", "updated_at": 1448361986, "user_defined_properties": { "Firmware Ver": "1.0", "STATE": "OK" }, "metrics": [ ] } }
Get details of an thing template
Param name | Description |
---|---|
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
is_oem optional |
Show thing template of child account if is_oem flag is true. Value: Must be one of: <code>true</code>, <code>false</code>, <code>true</code>, <code>false</code>. |
Request curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:olezAZXGQn9MutnfNerKDQ" https://api.datonis.io/api/v3/thing_templates/2a5t58bbt8 Response (containing details of the thing template) { "thing_template": { "created_at": 1448361986, "description": "Template for Refrigerators", "name": "Refrigerator", "thing_template_key": "2a5t58bbt8", "updated_at": 1448361986, "user_defined_properties": { "Firmware Ver": "1.0", "STATE": "OK" }, "metrics": [ { "metric_key": "d3tdc136b3", "metric_name": "temperature" }, { "metric_key": "b44c32be53", "metric_name": "power" }, { "metric_key": "c6a86c8576", "metric_name": "voltage" } ] } }
Updates an thing template with given parameters
Param name | Description |
---|---|
thing_template required |
Map containing details of the thing template to be updated Value: Must be a Hash |
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
is_oem optional |
Update thing template in child account by oem user if is_oem flag is true. Value: Must be a Boolean |
Request curl -X PUT -H "Content-Type:application/json" -H "X-Auth-Token:olezAZXGQn9MutnfNerKDQ" -d '{"thing_template":{"description":"Thing Template for Refrigerators"}}' https://api.datonis.io/api/v3/thing_templates/2a5t58bbt8 Response (containing details of the thing template updated) { "thing_template": { "created_at": 1448361986, "description": "Thing Template for Refrigerators", "name": "Refrigerator", "thing_template_key": "2a5t58bbt8", "updated_at": 1448366573, "user_defined_properties": { "Firmware Ver": "1.0", "STATE": "OK" }, "metrics": [ { "metric_key": "d3tdc136b3", "metric_name": "temperature" }, { "metric_key": "b44c32be53", "metric_name": "power" }, { "metric_key": "c6a86c8576", "metric_name": "voltage" } ] } }
Deletes an thing template from the system and also deletes its dependent things and metrics
Param name | Description |
---|---|
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
is_oem optional |
Delete thing template in child account by oem user if is_oem flag is true. Value: Must be a Boolean |
Request curl -X DELETE -H "Content-Type:application/json" -H "X-Auth-Token:olezAZXGQn9MutnfNerKDQ" https://api.datonis.io/api/v3/thing_templates/2a5t58bbt8 Response { }
Adds specified user defined properties on a thing template
Param name | Description |
---|---|
user_defined_properties optional |
map of key value pairs to be set Value: Must be a Hash |
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
is_oem optional |
Add user defined properties in thing template of child account by oem user if is_oem flag is true. Value: Must be a Boolean |
Request - containing user defined properties to be added curl -X PUT -H "Content-Type:application/json" -H "X-Auth-Token:WtUFnj8pvSxVnH9e_xkq7A" -d '{"user_defined_properties":{"Color":"Red"}}' https://api.datonis.io/api/v3/thing_templates/2a5t58bbt8/set_user_defined_properties Response (returns details of the thing template with updated user defined properties) { "thing_template": { "created_at": 1448361986, "description": "Thing Template for Refrigerators", "name": "Refrigerator", "thing_template_key": "2a5t58bbt8", "updated_at": 1448367485, "user_defined_properties": { "Firmware Ver": "1.0", "STATE": "OK", "Color": "Red" }, "metrics": [ { "metric_key": "d3tdc136b3", "metric_name": "temperature" }, { "metric_key": "b44c32be53", "metric_name": "power" }, { "metric_key": "c6a86c8576", "metric_name": "voltage" } ] } }
Removes specified user defined properties on a thing template
Param name | Description |
---|---|
user_defined_properties optional |
List of user defined properties keys to be removed Value: Must be an array of any type |
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
is_oem optional |
Remove user defined properties from thing tempalte of child account by oem user if is_oem flag is true. Value: Must be a Boolean |
Request - containing user defined properties to be removed curl -X PUT -H "Content-Type:application/json" -H "X-Auth-Token:WtUFnj8pvSxVnH9e_xkq7A" -d '{"user_defined_properties":["Color"]}' https://api.datonis.io/api/v3/thing_templates/2a5t58bbt8/remove_user_defined_properties Response (returns details of the thing template with updated user defined properties) { "thing_template": { "created_at": 1448361986, "description": "Thing Template for Refrigerators", "name": "Refrigerator", "thing_template_key": "2a5t58bbt8", "updated_at": 1448367534, "user_defined_properties": { "Firmware Ver": "1.0", "STATE": "OK" }, "metrics": [ { "metric_key": "d3tdc136b3", "metric_name": "temperature" }, { "metric_key": "b44c32be53", "metric_name": "power" }, { "metric_key": "c6a86c8576", "metric_name": "voltage" } ] } }