thing.list

The thing.list command is used to find and return a list of things.

TR50 Request


                        {
  "cmd": {
    "command": "thing.list",
    "params": {
      "show": [
        "key",
        "name"
      ],
      "offset": 0,
      "limit": 10,
      "sort": "+name",
      "tags": ["tag1", "tag2"],
      "keys": ["thingkey1", "thingkey2"],
      "hasLoc": true
    }
  }
}
      

Request Parameters

Name

Type

Required

Description

show

Array

 

An array of field names of the data columns to return.

offset

Integer

 

The starting list offset, used for pagination. Defaults to 0 if not specified.

limit

Integer

 

Limits the number of results returned. Defaults to the maximum configured size.

sort

String

 

A string indicated the direction (+ for ascending, - for descending) and column to sort the results by. To sort by the key descending, use "-key". Defaults to "+name".

tags

Array

 

If specified, the command will only return things that have all tags in this parameter.

keys

Array

 

If specified, the command will only return things that have the keys specified in this parameter.

hasLoc

Boolean

 

Only return things that have a location. Defaults to false.

hideFields

Boolean

 

If set to true, the response won't include the fields in the response parameters.

TR50 Response

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

{
    "1": {
        "success": true,
        "params": {
            "count": 3,
            "fields": [
                "id",
                "key",
                "name",
                "ownerOrgId",
                "permission",
                "defKey",
                "defName",
                "gateway",
                "iccid",
                "esn",
                "meid",
                "imei",
                "imsi",
                "connected",
                "lastSeen",
                "lastCommunication",
                "loc",
                "proto",
                "remoteAddr",
                "data",
                "properties",
                "alarms",
                "attrs",
                "createdOn",
                "updatedOn",
                "apiCounts.daily",
                "apiCounts.monthToDate",
                "apiCounts.total",
                "storage",
                "varBillingPlanCode",
                "varVasPackageCode"
            ],
            "result": [
                {
                    "alarms": {},
                    "apiCounts": {
                        "daily": 7,
                        "monthToDate": 129,
                        "total": 123
                    },
                    "attrs": {
                        "architecture": {
                            "ts": "2017-10-27T19:06:20.365Z",
                            "since": "2017-10-19T13:29:04.761Z",
                            "value": "AMD64"
                        },
                        "hdc_version": {
                            "ts": "2017-10-27T19:06:20.365Z",
                            "since": "2017-10-19T13:29:04.761Z",
                            "value": "17.8.25"
                        },
                        "hostname": {
                            "ts": "2017-10-27T19:06:20.365Z",
                            "since": "2017-10-19T13:29:04.761Z",
                            "value": "YVS15-W1"
                        },
                        "kernel": {
                            "ts": "2017-10-27T19:06:20.365Z",
                            "since": "2017-10-19T17:13:23.52Z",
                            "value": "10.0.15063"
                        },
                        "mac_address": {
                            "ts": "2017-10-27T19:06:20.365Z",
                            "since": "2017-10-19T13:29:04.808Z",
                            "value": "00:00:02:72:D1:04"
                        },
                        "os_name": {
                            "ts": "2017-10-27T19:06:20.365Z",
                            "since": "2017-10-19T13:29:04.761Z",
                            "value": "Windows"
                        },
                        "os_version": {
                            "ts": "2017-10-27T19:06:20.365Z",
                            "since": "2017-10-19T13:29:04.761Z",
                            "value": "10"
                        }
                    },
                    "connected": false,
                    "createdOn": "2017-10-19T13:28:54.472Z",
                    "defKey": "hdc_device_manager_def",
                    "defName": "hdc_device_manager_def",
                    "id": "59e8a896790289591bb0db70",
                    "key": "a66a07d3-8755-4133-8f13-fe6c845d8dba-device_manager_py",
                    "lastCommunication": "2017-10-27T19:09:37.777Z",
                    "lastSeen": "2017-10-27T19:09:37.777Z",
                    "name": "auto:a66a07d3-8755-4133-8f13-fe6c845d8dba-device_manager_py",
                    "ownerOrgId": "599db51574e936608472ccfb",
                    "permission": "rw",
                    "properties": {},
                    "storage": 52822,
                    "updatedOn": "2017-10-27T18:28:51.979Z",
                    "varBillingPlanCode": "",
                    "varVasPackageCode": ""
                }
            ]
        }
    }
}

Response Parameters

Name

Type

Description

count

Integer

The total number of matching things.

fields

Array

An array of field names of data columns that can be returned.

result

Array

The array of thing objects.

Result Array Object

Name

Type

Description

id

String

The id of the thing.

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.

permission

String

The permissions for the thing in the current organization.

key

String

The key of the thing.

name

String

The name of the thing.

defName

String

The thing definition name.

connected

Bool

Is the thing currently connected.

lastSeen

String

The last time the thing was connected.

lastCommunication

String

The last time the thing indicated that it was still connected (the keep-alive heartbeat).

defKey

String

The key of the thing's definition.

proto

String

Connection protocol.

remoteAddr

String

The remote address of the thing.

locWithin

Array

 

locUpdated

String

The date and time that the thing location was last updated.

loc

Object

The array containing the location information.

loc.lat

Float

The latitude of the thing.

loc.lng

Float

The longitude of the thing.

loc.acc

Integer

The accuracy of the location.

loc.fixType

String

The method used to determine the location of the thing.

loc.addr

Object

The array containing the address information.

loc.addr.streetNumber

String

The street number.

loc.addr.street

String

The street.

loc.addr.city

String

The city.

loc.addr.state

String

The state.

loc.addr.zipCode

String

The zip code.

loc.addr.country

String

The country.

apiCounts.daily

Integer

The number of API calls by this Thing for the current day (estimate).

apiCounts.monthToDate

Integer

The number of API calls by this Thing since the beginning of the current month.

apiCounts.total

Integer

The number of API calls by this Thing since the beginning of time.

storage

Integer

The amount of storage a thing is using (in bytes)