thing.near
The thing.near command is used to find and return a list of nearby things.
TR50 Request
{
"cmd": {
"command": "thing.near",
"params": {
"key": "mything",
"radius": 100.0
}
}
}
Request Parameters
Name |
Type |
Required |
Description |
---|---|---|---|
key |
String |
|
The key identifying the Thing. |
point |
Array |
|
Optionally instead of key, the point of reference. A point consists of two floats: [latitude, longitude] |
radius |
Float |
|
The search radius in kilometers. |
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. |
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.
{
"cmd": {
"success": true,
"params": {
"count": 2,
"result": [
{
"distance": 81.104269405115,
"key": "352054052651966",
"lat": 80,
"lng": 80
},
{
"distance": 90.060254724569,
"key": "358901046469182",
"lat": 70,
"lng": 70
}
]
}
}
}
Response Parameters
Name |
Type |
Description |
---|---|---|
count |
Integer |
The total number of matching things. |
result |
Array |
The array of thing objects. |
Result Array Object
Name |
Type |
Description |
---|---|---|
key |
String |
The key of the thing. |
distance |
Float |
The relative distance of the thing. |
lat |
Float |
The latitude of the thing. |
lng |
Float |
The longitude of the thing. |