Skip to content

get_device_position_history

get_device_position_history(
    tracker_name: ResourceName,
    device_id: Id,
    *,
    config_overrides: Optional[LocationClientConfig] = None,
    next_token: Optional[Token] = None,
    start_time_inclusive: Optional[Timestamp] = None,
    end_time_exclusive: Optional[Timestamp] = None,
    max_results: Optional[int] = None,
) -> GetDevicePositionHistoryResponse

Retrieves the device position history from a tracker resource within a specified range of time.

Device positions are deleted after 30 days.

Parameters:

  • tracker_name (ResourceName) –

    The tracker resource receiving the request for the device position history.

  • device_id (Id) –

    The device whose position history you want to retrieve.

  • next_token (Optional[Token], default: None ) –

    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

  • start_time_inclusive (Optional[Timestamp], default: None ) –

    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 StartTimeInclusive must be before EndTimeExclusive.

  • end_time_exclusive (Optional[Timestamp], default: None ) –

    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 EndTimeExclusive must be after the time for StartTimeInclusive.

  • max_results (Optional[int], default: None ) –

    An optional limit for the number of device positions returned in a single call.

    Default value: 100

Raises:

  • AccessDeniedException –

    The request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions.

  • InternalServerException –

    The request has failed to process because of an unknown server error, exception, or failure.

  • ResourceNotFoundException –

    The resource that you've entered was not found in your AWS account.

  • ThrottlingException –

    The request was denied because of request throttling.

  • ValidationException –

    The input failed to meet the constraints specified by the AWS service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_location/_services/location.py
def get_device_position_history(
    self,
    tracker_name: "capo_location.types.resource_name.ResourceName",
    device_id: "capo_location.types.id.Id",
    *,
    config_overrides: Optional[LocationClientConfig] = None,
    next_token: Optional["capo_location.types.token.Token"] = None,
    start_time_inclusive: Optional[
        "capo_location.types.timestamp.Timestamp"
    ] = None,
    end_time_exclusive: Optional["capo_location.types.timestamp.Timestamp"] = None,
    max_results: Optional[int] = None,
) -> "capo_location.types.get_device_position_history_response.GetDevicePositionHistoryResponse":
    """<p>Retrieves the device position history from a tracker resource within a specified range of time.</p> <note> <p>Device positions are deleted after 30 days.</p> </note>

    Args:
        tracker_name: <p>The tracker resource receiving the request for the device position history.</p>
        device_id: <p>The device whose position history you want to retrieve.</p>
        next_token: <p>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. </p> <p>Default value: <code>null</code> </p>
        start_time_inclusive: <p>Specify the start time for the position history in <a href="https://www.iso.org/iso-8601-date-and-time-format.html"> ISO 8601</a> format: <code>YYYY-MM-DDThh:mm:ss.sssZ</code>. By default, the value will be 24 hours prior to the time that the request is made.</p> <p>Requirement:</p> <ul> <li> <p>The time specified for <code>StartTimeInclusive</code> must be before <code>EndTimeExclusive</code>.</p> </li> </ul>
        end_time_exclusive: <p>Specify the end time for the position history in <a href="https://www.iso.org/iso-8601-date-and-time-format.html"> ISO 8601</a> format: <code>YYYY-MM-DDThh:mm:ss.sssZ</code>. By default, the value will be the time that the request is made.</p> <p>Requirement:</p> <ul> <li> <p>The time specified for <code>EndTimeExclusive</code> must be after the time for <code>StartTimeInclusive</code>.</p> </li> </ul>
        max_results: <p>An optional limit for the number of device positions returned in a single call.</p> <p>Default value: <code>100</code> </p>

    Raises:
        capo_location.errors.access_denied_exception.AccessDeniedException: <p>The request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions.</p>
        capo_location.errors.internal_server_exception.InternalServerException: <p>The request has failed to process because of an unknown server error, exception, or failure.</p>
        capo_location.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource that you've entered was not found in your AWS account.</p>
        capo_location.errors.throttling_exception.ThrottlingException: <p>The request was denied because of request throttling.</p>
        capo_location.errors.validation_exception.ValidationException: <p>The input failed to meet the constraints specified by the AWS service. </p>
        capo_location.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_location.types.get_device_position_history_request.GetDevicePositionHistoryRequest]",
    ) -> OperationResponse[
        "capo_location.types.get_device_position_history_response.GetDevicePositionHistoryResponse"
    ]:
        import capo_location._operations.location_service.get_device_position_history

        output, http_response = (
            capo_location._operations.location_service.get_device_position_history.get_device_position_history(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_location.types.get_device_position_history_request.GetDevicePositionHistoryRequest",
    ) -> dict[str, Any]:
        import capo_location.types.get_device_position_history_request

        return capo_location.types.get_device_position_history_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_location.types.get_device_position_history_response.GetDevicePositionHistoryResponse",
    ) -> dict[str, Any]:
        import capo_location.types.get_device_position_history_response

        return capo_location.types.get_device_position_history_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "GetDevicePositionHistory",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_location.types.get_device_position_history_request.GetDevicePositionHistoryRequest = {
        "tracker_name": tracker_name,
        "device_id": device_id,
    }
    if next_token is not None:
        input_["next_token"] = next_token
    if start_time_inclusive is not None:
        input_["start_time_inclusive"] = start_time_inclusive
    if end_time_exclusive is not None:
        input_["end_time_exclusive"] = end_time_exclusive
    if max_results is not None:
        input_["max_results"] = max_results

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output