ListDatasets
Lists datasets for an 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.
ListDatasets can be called with temporary user credentials provided by Cognito Identity or with developer credentials. You should use the Cognito Identity credentials to make this API call.
Request Syntax
GET /identitypools/IdentityPoolId
/identities/IdentityId
/datasets?maxResults=MaxResults
&nextToken=NextToken
HTTP/1.1
URI Request Parameters
The request uses the following URI parameters.
- 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
- MaxResults
-
The maximum number of results to be returned.
Length Constraints: Maximum length of 19.
Pattern:
^[1-9]\d*
- NextToken
-
A pagination token for obtaining the next page of results.
Request Body
The request does not have a request body.
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"Count": number,
"Datasets": [
{
"CreationDate": number,
"DatasetName": "string",
"DataStorage": number,
"IdentityId": "string",
"LastModifiedBy": "string",
"LastModifiedDate": number,
"NumRecords": number
}
],
"NextToken": "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.
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
ListDatasets
The following examples have been edited for readability.
Sample Request
POST / HTTP/1.1
CONTENT-TYPE: application/json
X-AMZN-REQUESTID: 15225768-209f-4078-aaed-7494ace9f2db
X-AMZ-TARGET: com.amazonaws.cognito.sync.model.AWSCognitoSyncService.ListDatasets
HOST: cognito-sync.us-east-1.amazonaws.com:443
X-AMZ-DATE: 20141111T215640Z
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",
"MaxResults": "3"
}
Sample Response
1.1 200 OK
x-amzn-requestid: 15225768-209f-4078-aaed-7494ace9f2db, 15225768-209f-4078-aaed-7494ace9f2db
content-type: application/json
content-length: 355
date: Tue, 11 Nov 2014 21:56:40 GMT
{
"Count": 1,
"Datasets": [
{
"CreationDate": 1.412974057151E9,
"DataStorage": 16,
"DatasetName": "my_list",
"IdentityId": "IDENTITY_ID",
"LastModifiedBy": "123456789012",
"LastModifiedDate": 1.412974057244E9,
"NumRecords": 1
}],
"NextToken": null
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: