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":...