thing_def.keys

The thing_def.keys command is used to find and return a list of alarm, attribute, or property keys, and the thing definitions that contain them.

TR50 Request


                        {
  "1": {
    "command": "thing_def.keys",
    "params": {
      "type": "alarm"
    }
  }
}
      

Request Parameters

Name

Type

Required

Description

type

String

Yes

A string that defines the the thing definition member keys that are needed. The options are alarm, attribute, or property. No other string are allowed.

TR50 Response

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


                         {
    "1": {
        "success": true,
        "params": {
            "keys": {
                "counter": [
                    {
                        "id": "58752ed01c5bd777a964e347",
                        "key": "gateway",
                        "name": "Gateway"
                    }
                ],
                "cpu_usage": [
                    {
                        "id": "534c36e53100460721000054",
                        "key": "default",
                        "name": "Default"
                    },
                    {
                        "id": "5669fcff681fdc5bb3ba349f",
                        "key": "win_laptop",
                        "name": "Windows Laptop"
                    },
                    {
                        "id": "58752ed01c5bd777a964e347",
                        "key": "gateway",
                        "name": "Gateway"
                    },
                    {
                        "id": "5892296afe2a131b830950cd",
                        "key": "multitech-h5",
                        "name": "MutliTech H5"
                    }
                ],
                "fuellevel": [
                    {
                        "id": "580fbebcfe2a1344a355c013",
                        "key": "danlaw_vehicle",
                        "name": "Danlaw Car"
                    },
                    {
                        "id": "581236ea1c5bd7515763098f",
                        "key": "connected_car",
                        "name": "Connected Car"
                    },
                    {
                        "id": "589899d9fe2a131faf79dfde",
                        "key": "seleniumcarthingdef",
                        "name": "Selenium car thing def"
                    },
                    {
                        "id": "5919dffbfe2a130a064db8f5",
                        "key": "pst_vehicle",
                        "name": "PST Vehicle"
                    }
                ],
                "odometer": [
                    {
                        "id": "580fbebcfe2a1344a355c013",
                        "key": "danlaw_vehicle",
                        "name": "Danlaw Car"
                    },
                    {
                        "id": "581236ea1c5bd7515763098f",
                        "key": "connected_car",
                        "name": "Connected Car"
                    },
                    {
                        "id": "5919dffbfe2a130a064db8f5",
                        "key": "pst_vehicle",
                        "name": "PST Vehicle"
                    }
                ],
                "rpm": [
                    {
                        "id": "580fbebcfe2a1344a355c013",
                        "key": "danlaw_vehicle",
                        "name": "Danlaw Car"
                    },
                    {
                        "id": "581236ea1c5bd7515763098f",
                        "key": "connected_car",
                        "name": "Connected Car"
                    },
                    {
                        "id": "589899d9fe2a131faf79dfde",
                        "key": "seleniumcarthingdef",
                        "name": "Selenium car thing def"
                    },
                    {
                        "id": "5919dffbfe2a130a064db8f5",
                        "key": "pst_vehicle",
                        "name": "PST Vehicle"
                    }
                ],
                "rssi": [
                    {
                        "id": "56e1f10e681fdc029cfc0db6",
                        "key": "template_data",
                        "name": "Template Data"
                    },
                    {
                        "id": "580fbebcfe2a1344a355c013",
                        "key": "danlaw_vehicle",
                        "name": "Danlaw Car"
                    },
                    {
                        "id": "5919dffbfe2a130a064db8f5",
                        "key": "pst_vehicle",
                        "name": "PST Vehicle"
                    }
                ],
                "speed": [
                    {
                        "id": "56d73f5d681fdc7de5adcc7c",
                        "key": "pump",
                        "name": "Pump"
                    },
                    {
                        "id": "580fbebcfe2a1344a355c013",
                        "key": "danlaw_vehicle",
                        "name": "Danlaw Car"
                    },
                    {
                        "id": "581236ea1c5bd7515763098f",
                        "key": "connected_car",
                        "name": "Connected Car"
                    },
                    {
                        "id": "589899d9fe2a131faf79dfde",
                        "key": "seleniumcarthingdef",
                        "name": "Selenium car thing def"
                    },
                    {
                        "id": "5919dffbfe2a130a064db8f5",
                        "key": "pst_vehicle",
                        "name": "PST Vehicle"
                    }
                ],
                "temp": [
                    {
                        "id": "56d73f5d681fdc7de5adcc7c",
                        "key": "pump",
                        "name": "Pump"
                    },
                    {
                        "id": "58752ed01c5bd777a964e347",
                        "key": "gateway",
                        "name": "Gateway"
                    },
                    {
                        "id": "589899d9fe2a131faf79dfde",
                        "key": "seleniumcarthingdef",
                        "name": "Selenium car thing def"
                    }
                ]
            }
        }
    }
}
      

Response Parameters

Name

Type

Description

keys

Array

An array of Thing Definition Identification Records, indexed by the member key. Each thing definition identification record is a structure identifying the thing definition(s) that have this member key.

Thing Definition Identification Record Parameters

Name

Type

Description

id

String

The ID of the thing definition.

key

String

The key of the thing definition.

name

String

The name of the thing definition.