thing_def.list

The thing_def.list command returns a list of Thing Definitions.

TR50 Request
{
  "cmd": {
    "command": "thing_def.list",
    "params": {
      "sort": "name",
      "offset": 2,
      "limit": 10
    }
  }
}

Request Parameters

Name Type Required Description
sort String sort is an optional parameter that defines the sort order of the result set. It allows to arrange the list in either ascending(+) or descending(-) order. It is possible to sort thing_def.list in the following categories:id, name, and key
offset Integer The starting list offset, used for pagination, defaults to 0 if not specified.
limit Integer Limits the number of results returned. The maximum limit you can set is 2000. Defaults to 2000.

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

TR50 Response
{ 
  "cmd": {
    "success": true,
    "params": {
    "count": 8,
      "result": [
        {
          "id": "531c8f995d80f1330c21acb9",
          "ownerOrgId": "533ef311310046187700007f",
          "key": "connected_car",
          "name": "Connected Car",
          "version": 31,
          "autoDefProps": false,
          "autoDefAttrs": false,
          "createdBy": "admin@devicewise.com",
          "createdOn": "2018-03-09T15:58:17.533Z",
          "updatedBy": "admin@devicewise.com",
          "updatedOn": "2018-03-09T15:58:17.533Z"
        },
        {
          "id": "52fbed495d80f1091b000012",
          "ownerOrgId": "533ef311310046187700007f",
          "key": "default",
          "name": "Default",
          "version": 1,
          "autoDefProps": true,
          "createdBy": "SYSTEM",
          "createdOn": "2018-02-12T21:53:13.354Z",
          "updatedBy": "SYSTEM",
          "updatedOn": "2018-02-12T21:53:13.354Z"
        },
        {
          "id": "533fe9d25d80f1268900fd6c",
          "ownerOrgId": "534c36f53100460721000051"
          "key": "gateway",
          "name": "Gateway",
          "version": 2,
          "autoDefProps": true,
          "autoDefAttrs": true,
          "createdBy": "admin@devicewise.com",
          "createdOn": "2018-03-05T11:32:34.075Z",
          "updatedBy": "admin@devicewise.com",
          "updatedOn": "2018-03-05T11:32:34.075Z"
        },
        {
          "id": "531c81885d80f1330c045d7c",
          "ownerOrgId": "524d36e53100460721000051",
          "key": "hvacmonitor",
          "name": "HVAC Monitor",
          "version": 5,
          "autoDefProps": false,
          "autoDefAttrs": false,
          "createdBy": "admin@devicewise.com",
          "createdOn": "2018-03-09T14:58:16.234Z",
          "updatedBy": "admin@devicewise.com",
          "updatedOn": "2018-03-09T14:58:16.234Z"
        },
        {
          "id": "531c815e5d80f1330c045d51",
          "ownerOrgId": "524d36e53100460721000051",
          "key": "home_power",
          "name": "Home Power Monitor",
          "version": 8,
          "autoDefProps": false,
          "autoDefAttrs": false,
          "createdBy": "admin@devicewise.com",
          "createdOn": "2018-03-09T14:57:34.058Z",
          "updatedBy": "admin@devicewise.com",
          "updatedOn": "2018-03-09T14:57:34.058Z"
        },
        {
          "id": "52fcf1205d80f112a1000057",
          "ownerOrgId": "524d36e53100460721000051",
          "key": "monnit",
          "name": "Monnit Demo Definition",
          "version": 5,
          "autoDefProps": true,
          "createdBy": "admin@devicewise.com",
          "createdOn": "2018-02-13T16:21:52.713Z",
          "updatedBy": "admin@devicewise.com",
          "updatedOn": "2018-02-13T16:21:52.713Z"
        },
        {
          "id": "531bcb1d5d80f1330c02efb5",
          "ownerOrgId": "524d36e53100460721000051",
          "key": "weather_station",
          "name": "Weather Station",
          "version": 12,
          "autoDefProps": false,
          "createdBy": "admin@devicewise.com",
          "createdOn": "2018-03-09T01:59:57.802Z",
          "updatedBy": "admin@devicewise.com",
          "updatedOn": "2018-03-09T01:59:57.802Z"
        },
        {
          "id": "533e1d815d80f153be000b87",
          "ownerOrgId": "524d36e53100460721000051",
          "key": "xerox6180",
          "name": "Xerox 6180 Printer",
          "version": 3,
          "autoDefProps": false,
          "autoDefAttrs": false,
          "firmware": {
             "versions": [
                {
                  "name": "Version 1.0.0",
                  "version": "1.0.0",
                  "url": "https:\/\/www.yoursite.com?ver=1.0.0"
                 }
               ]
             },       
          "createdBy": "admin@devicewise.com",
          "createdOn": "2018-03-04T02:48:33.477Z",
          "updatedBy": "admin@devicewise.com",
          "updatedOn": "2018-03-04T02:48:33.477Z"
        }
      ]
    }
  }
}

Response Parameters

Name Type Description
result Array The array of result objects.

Results Object

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.
version Integer A version number associated with the Thing Definition.
autoDefAttrs Boolean Whether to automatically define attributes as they're published.
autoDefProps Boolean Whether to automatically define properties as they're published.
tunnelAdHoc Boolean If set to true, things of this thing definition will allow ad hoc tunnels.
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::thingDefList([$offset[, $limit]]);