通过跟踪器获取设备的位置记录 - Amazon Location Service

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

通过跟踪器获取设备的位置记录

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

API

使用 Amazon Location API 从跟踪器获取设备位置记录

使用 Amazon Location 跟踪器 API 中的 GetDevicePositionHistory 操作。

以下示例使用 API URI 请求从名为 ExampleTracker 的跟踪器获取 ExampleDevice 的设备位置记录,始于 2020–10–02 19:05:07(包括),止于 19:20:07(不包括)。

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 命令。

以下示例使用 AWS CLI 从名为 ExampleTracker 的跟踪器获取 ExampleDevice 的设备位置历史记录,始于 2020–10–02 19:05:07(包括),止于 19:20:07(不包括)。

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"