Skip to content

list_records

list_records(
    identity_pool_id: IdentityPoolId,
    identity_id: IdentityId,
    dataset_name: DatasetName,
    *,
    config_overrides: Optional[CognitoSyncClientConfig] = None,
    last_sync_count: Optional[Long] = None,
    next_token: Optional[String] = None,
    max_results: Optional[IntegerString] = None,
    sync_session_token: Optional[SyncSessionToken] = None,
) -> ListRecordsResponse

Gets paginated records, optionally changed after a particular sync count for a dataset and identity. With Amazon Cognito Sync, each identity has access only to its own data. Thus, the credentials used to make this API call need to have access to the identity data.

ListRecords can be called with temporary user credentials provided by Cognito Identity or with developer credentials. You should use Cognito Identity credentials to make this API call.

ListRecords The following examples have been edited for readability. POST / HTTP/1.1 CONTENT-TYPE: application/json X-AMZN-REQUESTID: b3d2e31e-d6b7-4612-8e84-c9ba288dab5d X-AMZ-TARGET: com.amazonaws.cognito.sync.model.AWSCognitoSyncService.ListRecords HOST: cognito-sync.us-east-1.amazonaws.com:443 X-AMZ-DATE: 20141111T183230Z AUTHORIZATION: AWS4-HMAC-SHA256 Credential=, SignedHeaders=content-type;host;x-amz-date;x-amz-target;x-amzn-requestid, Signature= { "Operation": "com.amazonaws.cognito.sync.model#ListRecords", "Service": "com.amazonaws.cognito.sync.model#AWSCognitoSyncService", "Input": { "IdentityPoolId": "IDENTITY_POOL_ID", "IdentityId": "IDENTITY_ID", "DatasetName": "newDataSet" } } 1.1 200 OK x-amzn-requestid: b3d2e31e-d6b7-4612-8e84-c9ba288dab5d content-type: application/json content-length: 623 date: Tue, 11 Nov 2014 18:32:30 GMT { "Output": { "__type": "com.amazonaws.cognito.sync.model#ListRecordsResponse", "Count": 0, "DatasetDeletedAfterRequestedSyncCount": false, "DatasetExists": false, "DatasetSyncCount": 0, "LastModifiedBy": null, "MergedDatasetNames": null, "NextToken": null, "Records": [], "SyncSessionToken": "SYNC_SESSION_TOKEN" }, "Version": "1.0" }

Parameters:

  • identity_pool_id (IdentityPoolId) –

    A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.

  • identity_id (IdentityId) –

    A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.

  • dataset_name (DatasetName) –

    A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).

  • last_sync_count (Optional[Long], default: None ) –

    The last server sync count for this record.

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

    A pagination token for obtaining the next page of results.

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

    The maximum number of results to be returned.

  • sync_session_token (Optional[SyncSessionToken], default: None ) –

    A token containing a session ID, identity ID, and expiration.

Raises:

Source code in docs_src/capo_cognito_sync/_services/cognito_sync.py
def list_records(
    self,
    identity_pool_id: "capo_cognito_sync.types.identity_pool_id.IdentityPoolId",
    identity_id: "capo_cognito_sync.types.identity_id.IdentityId",
    dataset_name: "capo_cognito_sync.types.dataset_name.DatasetName",
    *,
    config_overrides: Optional[CognitoSyncClientConfig] = None,
    last_sync_count: Optional["capo_cognito_sync.types.long.Long"] = None,
    next_token: Optional["capo_cognito_sync.types.string.String"] = None,
    max_results: Optional[
        "capo_cognito_sync.types.integer_string.IntegerString"
    ] = None,
    sync_session_token: Optional[
        "capo_cognito_sync.types.sync_session_token.SyncSessionToken"
    ] = None,
) -> "capo_cognito_sync.types.list_records_response.ListRecordsResponse":
    """<p>Gets paginated records, optionally changed after a particular sync count for a dataset and identity. With Amazon Cognito Sync, each identity has access only to its own data. Thus, the credentials used to make this API call need to have access to the identity data.</p> <p>ListRecords can be called with temporary user credentials provided by Cognito Identity or with developer credentials. You should use Cognito Identity credentials to make this API call.</p> <examples> <example> <name>ListRecords</name> <description>The following examples have been edited for readability.</description> <request> POST / HTTP/1.1 CONTENT-TYPE: application/json X-AMZN-REQUESTID: b3d2e31e-d6b7-4612-8e84-c9ba288dab5d X-AMZ-TARGET: com.amazonaws.cognito.sync.model.AWSCognitoSyncService.ListRecords HOST: cognito-sync.us-east-1.amazonaws.com:443 X-AMZ-DATE: 20141111T183230Z AUTHORIZATION: AWS4-HMAC-SHA256 Credential=<credential>, SignedHeaders=content-type;host;x-amz-date;x-amz-target;x-amzn-requestid, Signature=<signature> { "Operation": "com.amazonaws.cognito.sync.model#ListRecords", "Service": "com.amazonaws.cognito.sync.model#AWSCognitoSyncService", "Input": { "IdentityPoolId": "IDENTITY_POOL_ID", "IdentityId": "IDENTITY_ID", "DatasetName": "newDataSet" } } </request> <response> 1.1 200 OK x-amzn-requestid: b3d2e31e-d6b7-4612-8e84-c9ba288dab5d content-type: application/json content-length: 623 date: Tue, 11 Nov 2014 18:32:30 GMT { "Output": { "__type": "com.amazonaws.cognito.sync.model#ListRecordsResponse", "Count": 0, "DatasetDeletedAfterRequestedSyncCount": false, "DatasetExists": false, "DatasetSyncCount": 0, "LastModifiedBy": null, "MergedDatasetNames": null, "NextToken": null, "Records": [], "SyncSessionToken": "SYNC_SESSION_TOKEN" }, "Version": "1.0" } </response> </example> </examples>

    Args:
        identity_pool_id: A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        identity_id: A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        dataset_name: A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
        last_sync_count: The last server sync count for this record.
        next_token: A pagination token for obtaining the next page of results.
        max_results: The maximum number of results to be returned.
        sync_session_token: A token containing a session ID, identity ID, and expiration.

    Raises:
        capo_cognito_sync.errors.internal_error_exception.InternalErrorException: Indicates an internal service error.
        capo_cognito_sync.errors.invalid_parameter_exception.InvalidParameterException: Thrown when a request parameter does not comply with the associated constraints.
        capo_cognito_sync.errors.not_authorized_exception.NotAuthorizedException: Thrown when a user is not authorized to access the requested resource.
        capo_cognito_sync.errors.too_many_requests_exception.TooManyRequestsException: Thrown if the request is throttled.
        capo_cognito_sync.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cognito_sync.types.list_records_request.ListRecordsRequest]",
    ) -> OperationResponse[
        "capo_cognito_sync.types.list_records_response.ListRecordsResponse"
    ]:
        import capo_cognito_sync._operations.aws_cognito_sync_service.list_records

        output, http_response = (
            capo_cognito_sync._operations.aws_cognito_sync_service.list_records.list_records(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListRecords")
    )
    input_: capo_cognito_sync.types.list_records_request.ListRecordsRequest = {
        "identity_pool_id": identity_pool_id,
        "identity_id": identity_id,
        "dataset_name": dataset_name,
    }
    if last_sync_count is not None:
        input_["last_sync_count"] = last_sync_count
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if sync_session_token is not None:
        input_["sync_session_token"] = sync_session_token

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