ListRecords - Amazon Cognito Sync

ListRecords

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.

Request Syntax

GET /identitypools/IdentityPoolId/identities/IdentityId/datasets/DatasetName/records?lastSyncCount=LastSyncCount&maxResults=MaxResults&nextToken=NextToken&syncSessionToken=SyncSessionToken HTTP/1.1

URI Request Parameters

The request uses the following URI parameters.

DatasetName

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

Length Constraints: Minimum length of 1. Maximum length of 128.

Pattern: [a-zA-Z0-9_.:-]+

Required: Yes

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.

Length Constraints: Minimum length of 1. Maximum length of 55.

Pattern: [\w-]+:[0-9a-f-]+

Required: Yes

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.

Length Constraints: Minimum length of 1. Maximum length of 55.

Pattern: [\w-]+:[0-9a-f-]+

Required: Yes

LastSyncCount

The last server sync count for this record.

MaxResults

The maximum number of results to be returned.

NextToken

A pagination token for obtaining the next page of results.

SyncSessionToken

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

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200 Content-type: application/json { "Count": number, "DatasetDeletedAfterRequestedSyncCount": boolean, "DatasetExists": boolean, "DatasetSyncCount": number, "LastModifiedBy": "string", "MergedDatasetNames": [ "string" ], "NextToken": "string", "Records": [ { "DeviceLastModifiedDate": number, "Key": "string", "LastModifiedBy": "string", "LastModifiedDate": number, "SyncCount": number, "Value": "string" } ], "SyncSessionToken": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Count

Total number of records.

Type: Integer

DatasetDeletedAfterRequestedSyncCount

A boolean value specifying whether to delete the dataset locally.

Type: Boolean

DatasetExists

Indicates whether the dataset exists.

Type: Boolean

DatasetSyncCount

Server sync count for this dataset.

Type: Long

LastModifiedBy

The user/device that made the last change to this record.

Type: String

MergedDatasetNames

Names of merged datasets.

Type: Array of strings

NextToken

A pagination token for obtaining the next page of results.

Type: String

Records

A list of all records.

Type: Array of Record objects

SyncSessionToken

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

Type: String

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalErrorException

Indicates an internal service error.

HTTP Status Code: 500

InvalidParameterException

Thrown when a request parameter does not comply with the associated constraints.

HTTP Status Code: 400

NotAuthorizedException

Thrown when a user is not authorized to access the requested resource.

HTTP Status Code: 403

TooManyRequestsException

Thrown if the request is throttled.

HTTP Status Code: 429

Examples

ListRecords

The following examples have been edited for readability.

Sample 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> { "IdentityPoolId": "IDENTITY_POOL_ID", "IdentityId": "IDENTITY_ID", "DatasetName": "newDataSet" }

Sample 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 { "Count": 0, "DatasetDeletedAfterRequestedSyncCount": false, "DatasetExists": false, "DatasetSyncCount": 0, "LastModifiedBy": null, "MergedDatasetNames": null, "NextToken": null, "Records": [], "SyncSessionToken": "SYNC_SESSION_TOKEN" }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: