getDevicePositionHistory method
Retrieves the device position history from a tracker resource within a specified range of time.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter deviceId :
The device whose position history you want to retrieve.
Parameter trackerName :
The tracker resource receiving the request for the device position
history.
Parameter endTimeExclusive :
Specify the end time for the position history in ISO
8601 format: YYYY-MM-DDThh:mm:ss.sssZ. By default, the
value will be the time that the request is made.
Requirement:
-
The time specified for
EndTimeExclusivemust be after the time forStartTimeInclusive.
Parameter maxResults :
An optional limit for the number of device positions returned in a single
call.
Default value: 100
Parameter nextToken :
The pagination token specifying which page of results to return in the
response. If no token is provided, the default page is the first page.
Default value: null
Parameter startTimeInclusive :
Specify the start time for the position history in ISO
8601 format: YYYY-MM-DDThh:mm:ss.sssZ. By default, the
value will be 24 hours prior to the time that the request is made.
Requirement:
-
The time specified for
StartTimeInclusivemust be beforeEndTimeExclusive.
Implementation
Future<GetDevicePositionHistoryResponse> getDevicePositionHistory({
required String deviceId,
required String trackerName,
DateTime? endTimeExclusive,
int? maxResults,
String? nextToken,
DateTime? startTimeInclusive,
}) async {
final $payload = <String, dynamic>{
if (endTimeExclusive != null)
'EndTimeExclusive': iso8601ToJson(endTimeExclusive),
if (maxResults != null) 'MaxResults': maxResults,
if (nextToken != null) 'NextToken': nextToken,
if (startTimeInclusive != null)
'StartTimeInclusive': iso8601ToJson(startTimeInclusive),
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/tracking/v0/trackers/${Uri.encodeComponent(trackerName)}/devices/${Uri.encodeComponent(deviceId)}/list-positions',
hostPrefix: 'tracking.',
exceptionFnMap: _exceptionFns,
);
return GetDevicePositionHistoryResponse.fromJson(response);
}