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.

{
  "cmd": {
    "success": true,
    "params": {
      "id": "531c8f995d80f1330c21acb9",
      "ownerOrgId": "532ef300310046187700017f",
      "key": "connected_car",
      "name": "Connected Car",
      "version": 31,
      "autoDefProps": false,
      "autoDefAttrs": false,
      "properties": {
        "fuelecon": {
          "name": "Fuel Economy",
	   "calcAggregates": false,
	   "deDuplicate": false,
	   "searchable": true,
          "unit": "MPG"
        },
        "fuellevel": {
          "name": "Fuel Level",
	   "calcAggregates": false,
	   "deDuplicate": false,
	   "searchable": false,
          "unit": "%"
        },
        "speed": {
          "name": "Speed",
	   "calcAggregates": false,
	   "deDuplicate": false,
	   "searchable": true,
          "unit": "MPH"
        }
      },
      "attributes": {
        "vin": {
        "name": "VIN"
	"default": "WBA3C1G52DNRXX594",
	"searchable": true
        }
      },
      "alarms": {
        "engine": {
          "name": "Engine",
          "states": [
            {
              "name": "Off",
              "color": "#777777"
            },
            {
              "name": "On",
              "color": "#0000CC"
            }
          ]
	"searchable": true
        }
      },
      "methods": {
        "setreportinginterval": {
          "name": "Set Reporting Interval",
          "notificationVariables": {
            "engineoff": {
              "name": "Reporting while engine off",
              "type": "int",
              "uiType": "text"
            },
            "engineon": {
              "name": "Reporting while engine on",
              "type": "int",
              "uiType": "text"
            }
          }
        }
      },
      "tunnels":{
        "workbench":{"name":"deviceWISE Workbench", "port":4012},
        "ssh":{"name":"SSH", "port":22},
        "rdp":{"name":"RDP", "port":3389},
        "vnc":{"name":"VNC", "port":5900}
      },
      "createdBy": "admin@devicewise.com",
      "createdOn": "2017-03-09T15:58:17.533Z",
      "updatedBy": "admin@devicewise.com",
      "updatedOn": "2017-09-21T15:58:17.533Z"
    }
  }
}

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 to. 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.
tunnels Object Key-value pairs where the key is the tunnel key and the value is a tunnel definition object.See thing_def.create.
tunnelAdHoc Boolean If set to true, things of this thing definition will allow ad hoc tunnels.
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.

PHP API

mixed TR50httpWorker::thingDefFind($key);