thing_def.find

The thing_def.find command is used to find an existing Thing Definition.

TR50 Request

{
  "cmd": {
    "command": "thing_def.find",
    "params": {
      "key": "mythingdef"
    }
  }
}

Request Parameters

Name

Type

Required

Description

key

String

Yes

The key of the Thing Definition to find.

TR50 Response

If the command is sent successfully a success message is returned. Otherwise, an error and error message will be returned.

{
    "1": {
        "success": true,
        "params": {
            "id": "59e6209f74e936232f36226d",
            "ownerOrgId": "599db51574e936608472ccfb",
            "key": "hdc_simple_telemetry_def",
            "name": "hdc_simple_telemetry_def",
            "version": 5,
            "autoDefProps": false,
            "autoDefAttrs": false,
            "properties": {
                "property-1": {
                    "name": "property-1",
                    "calcAggregates": false
                },
                "property-2": {
                    "name": "property-2",
                    "calcAggregates": false
                }
            },
            "attributes": {
                "attribute-1": {
                    "name": "attribute-1"
                },
                "attribute-2": {
                    "name": "attribute-2"
                }
            },
            "alarms": {
                "alarm_1": {
                    "name": "Alarm 1",
                    "states": [
                        {
                            "name": "Good",
                            "color": "#001CF0"
                        },
                        {
                            "name": "Bad",
                            "color": "#EDED05"
                        }
                    ]
                }
            },
            "methods": {
                "quit": {
                    "name": "Quit App"
                },
                "toggle_telemetry": {
                    "name": "Toggle Telemetry"
                }
            },
            "createdBy": "user@example.com",
            "createdOn": "2017-10-17T15:24:15.078Z",
            "updatedBy": "user@example.com",
            "updatedOn": "2017-10-25T19:26:36.113Z"
        }
    }
}

Response Parameters

Name

Type

Description

id

String

The unique identifier of the Thing Definition.

ownerOrgid

String

If the thing definition is shared, then the ownerOrgid displays the id of the organization to which it belongs. If a thing definition is not shared then the orgid and the ownerOrgid are the same.

key

String

The key of the Thing Definition.

name

String

The name of the Thing Definition.

autoDefAttrs

Boolean

Whether to automatically define attributes as they are published.

autoDefProps

Boolean

Whether to automatically define properties as they are published.

alarms

Object

Key-value pairs where the key is the alarm key and the value is an alarm definition object. See thing_def.create.

attributes

Object

Key-value pairs where the key is the attribute key and the value is an attribute definition object.  See thing_def.create.

methods

Object

Key-value pairs where the key is the method key and the value is a method definition object. See thing_def.create.

properties

Object

Key-value pairs where the key is the property key and the value is a property definition object.  See thing_def.create.

createdBy

String

 The creator of the Thing Definition.

createdOn

String

The creation timestamp of the Thing Definition.

updatedBy

String

The updater of the Thing Definition.

updatedOn

String

The update timestamp of the Thing Definition.