---
name: "getOutdoorsTracksLocation"
mode: "kit"
versionRequirements:
  - { name: "@tuya-miniapp/cloud-api", version: "1.0.5" }
---

## getOutdoorsTracksLocation

> [VERSION] @tuya-miniapp/cloud-api >= 1.0.5

> 💡 该接口为云能力，需开通授权后使用，关于云能力可[查看文档](/cn/miniapp/common/desc/tech-stack/api)。
> 注意：目前云能力在「开发者工具」环境无法使用，需要打包后或真机调试使用。

### 描述

根据设备 ID 批量查询设备实时位置。

### 参数

`Params`

| 参数 | 类型 | 必填 | 默认值 | 描述 |
| --- | --- | --- | --- | --- |
| `data` | `GetOutdoorsTracksLocationParams` | 是 | - | 请求体 |

### 引用对象

##### `type` GetOutdoorsTracksLocationParams

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `deviceIds` | `string` | 设备 ID 集合，以逗号分开，最多 50 个 |
| `coordType` | `string` | 经纬度定位坐标系类型：WGS84、GCJ02、BD09LL；不传时国内默认高德，国外默认谷歌 |

##### `type` DeviceLocationItem

实时位置项：文档「DeviceLocationItem 说明」将 `protocol` 写作数值类型，「返回示例」为字符串（如 `"GPS"`）；上报时间参数表为 `reportTime`，返回示例为 `timestamp`。

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `deviceId` | `string` | 设备 ID |
| `lon` | `number` | 经度 |
| `lat` | `number` | 纬度 |
| `speed` | `number` | 速度 |
| `protocol` | `string` | 定位协议 |
| `reportTime` | `number` | 上报时间（参数表） |
| `timestamp` | `number` | 时间戳（部分返回示例） |


### 示例代码

#### 请求示例

```typescript
import { getOutdoorsTracksLocation } from '@tuya-miniapp/cloud-api';

getOutdoorsTracksLocation({
  deviceIds: 'vdevo16245017293',
})
  .then((response) => {
    console.log(response);
  })
  .catch();
```

#### 返回示例

```json
{
  "deviceLocationList": [
    {
      "deviceId": "vdevo16245017293****",
      "lon": 114.003117,
      "speed": 100,
      "protocol": "GPS",
      "lat": 22.594031,
      "timestamp": 1625198100154
    }
  ]
}
```
