Skip to content

/AWS1/CL_CGS=>LISTDATASETS()

About 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.

ListDatasets The following examples have been edited for readability. 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=, SignedHeaders=content-type;host;x-amz-date;x-amz-target;x-amzn-requestid, Signature=

{ "Operation": "com.amazonaws.cognito.sync.model#ListDatasets", "Service": "com.amazonaws.cognito.sync.model#AWSCognitoSyncService", "Input": { "IdentityPoolId": "IDENTITY_POOL_ID", "IdentityId": "IDENTITY_ID", "MaxResults": "3" } } 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

{ "Output": { "__type": "com.amazonaws.cognito.sync.model#ListDatasetsResponse", "Count": 1, "Datasets": [ { "CreationDate": 1.412974057151E9, "DataStorage": 16, "DatasetName": "my_list", "IdentityId": "IDENTITY_ID", "LastModifiedBy": "123456789012", "LastModifiedDate": 1.412974057244E9, "NumRecords": 1 }], "NextToken": null }, "Version": "1.0" }

Method Signature

IMPORTING

Required arguments:

iv_identitypoolid TYPE /AWS1/CGSIDENTITYPOOLID /AWS1/CGSIDENTITYPOOLID

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.

iv_identityid TYPE /AWS1/CGSIDENTITYID /AWS1/CGSIDENTITYID

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.

Optional arguments:

iv_nexttoken TYPE /AWS1/CGSSTRING /AWS1/CGSSTRING

A pagination token for obtaining the next page of results.

iv_maxresults TYPE /AWS1/CGSINTEGERSTRING /AWS1/CGSINTEGERSTRING

The maximum number of results to be returned.

RETURNING

oo_output TYPE REF TO /aws1/cl_cgslistdatasetsrsp /AWS1/CL_CGSLISTDATASETSRSP

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_cgs~listdatasets(
  iv_identityid = |string|
  iv_identitypoolid = |string|
  iv_maxresults = 123
  iv_nexttoken = |string|
).

This is an example of reading all possible response values

LOOP AT lo_result->get_datasets( ) into lo_row.
  lv_identityid = lo_row_1->get_identityid( ).
  lv_datasetname = lo_row_1->get_datasetname( ).
  lv_date = lo_row_1->get_creationdate( ).
  lv_date = lo_row_1->get_lastmodifieddate( ).
  lv_string = lo_row_1->get_lastmodifiedby( ).
  lv_long = lo_row_1->get_datastorage( ).
  lv_long = lo_row_1->get_numrecords( ).
ENDLOOP.
lv_integer = lo_result->get_count( ).
lv_string = lo_result->get_nexttoken( ).