

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 通过跟踪器获取设备的位置记录
<a name="get-location-history"></a>

 您的 Amazon Location 跟踪器资源会将所有被追踪设备的位置记录保存 30 天。您可以从跟踪器资源中检索设备位置记录，包括所有关联的元数据。以下示例使用或 AWS CLI Amazon 地点 APIs。

------
#### [ API ]

**使用 Amazon 位置从追踪器获取设备位置记录 APIs**

使用 Amazon 位置追踪器 APIs中的`[GetDevicePositionHistory](https://docs.aws.amazon.com/location/latest/APIReference/API_WaypointTracking_GetDevicePositionHistory.html)`操作。

以下示例使用 API URI 请求*ExampleDevice*从名为的跟踪器获取设备位置历史记录，该跟踪器*ExampleTracker*起始于`19:05:07`（包含），结尾为`19:20:07`（独家）`2020–10–02`。

```
POST /tracking/v0/trackers/ExampleTracker/devices/ExampleDevice/list-positions 
Content-type: application/json
{
  "StartTimeInclusive": "2020-10-02T19:05:07.327Z",
  "EndTimeExclusive": "2020-10-02T19:20:07.327Z"
}
```

------
#### [ AWS CLI ]

**使用 AWS CLI 命令从追踪器获取设备位置记录**

使用 `[get-device-position-history](https://docs.aws.amazon.com/cli/latest/reference/location/get-device-position-history.html)` 命令。

以下示例使用*ExampleDevice*从名为 “*ExampleTracker*起始于`19:05:07`（包含）”、“独家” 结束于`19:20:07`（独家）的跟踪器获取设备位置历史记录`2020–10–02`。 AWS CLI 

```
aws location \
    get-device-position-history \
        --device-id "ExampleDevice" \
        --start-time-inclusive "2020-10-02T19:05:07.327Z" \
        --end-time-exclusive "2020-10-02T19:20:07.327Z" \
        --tracker-name "ExampleTracker"
```

------