Amazon Cognito Sync

2014/10/16 - Amazon Cognito Sync - 8 new api methods

DescribeIdentityUsage (new) Link ¶

Gets usage information for an identity, including number of datasets and data usage.

Request Syntax

client.describe_identity_usage(
    IdentityPoolId='string',
    IdentityId='string'
)
type IdentityPoolId

string

param IdentityPoolId

[REQUIRED] 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.

type IdentityId

string

param IdentityId

[REQUIRED] 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.

rtype

dict

returns

Response Syntax

{
    'IdentityUsage': {
        'IdentityId': 'string',
        'IdentityPoolId': 'string',
        'LastModifiedDate': datetime(2015, 1, 1),
        'DatasetCount': 123,
        'DataStorage': 123
    }
}

Response Structure

  • (dict) -- The response to a successful DescribeIdentityUsage request.

    • IdentityUsage (dict) -- Usage information for the identity.

      • IdentityId (string) -- 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.

      • IdentityPoolId (string) -- 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.

      • LastModifiedDate (datetime) -- Date on which the identity was last modified.

      • DatasetCount (integer) -- Number of datasets for the identity.

      • DataStorage (integer) -- Total data storage for this identity.

DescribeDataset (new) Link ¶

Gets metadata about a dataset by identity and dataset name. The credentials used to make this API call need to have access to the identity data. With Amazon Cognito Sync, each identity has access only to its own data. You should use Amazon Cognito Identity service to retrieve the credentials necessary to make this API call.

Request Syntax

client.describe_dataset(
    IdentityPoolId='string',
    IdentityId='string',
    DatasetName='string'
)
type IdentityPoolId

string

param IdentityPoolId

[REQUIRED] 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.

type IdentityId

string

param IdentityId

[REQUIRED] 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.

type DatasetName

string

param DatasetName

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

rtype

dict

returns

Response Syntax

{
    'Dataset': {
        'IdentityId': 'string',
        'DatasetName': 'string',
        'CreationDate': datetime(2015, 1, 1),
        'LastModifiedDate': datetime(2015, 1, 1),
        'LastModifiedBy': 'string',
        'DataStorage': 123,
        'NumRecords': 123
    }
}

Response Structure

  • (dict) -- Response to a successful DescribeDataset request.

    • Dataset (dict) -- Metadata for a collection of data for an identity. An identity can have multiple datasets. A dataset can be general or associated with a particular entity in an application (like a saved game). Datasets are automatically created if they don't exist. Data is synced by dataset, and a dataset can hold up to 1MB of key-value pairs.

      • IdentityId (string) -- 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.

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

      • CreationDate (datetime) -- Date on which the dataset was created.

      • LastModifiedDate (datetime) -- Date when the dataset was last modified.

      • LastModifiedBy (string) -- The device that made the last change to this dataset.

      • DataStorage (integer) -- Total size in bytes of the records in this dataset.

      • NumRecords (integer) -- Number of records in this dataset.

ListIdentityPoolUsage (new) Link ¶

Gets a list of identity pools registered with Cognito.

Request Syntax

client.list_identity_pool_usage(
    NextToken='string',
    MaxResults=123
)
type NextToken

string

param NextToken

A pagination token for obtaining the next page of results.

type MaxResults

integer

param MaxResults

The maximum number of results to be returned.

rtype

dict

returns

Response Syntax

{
    'IdentityPoolUsages': [
        {
            'IdentityPoolId': 'string',
            'SyncSessionsCount': 123,
            'DataStorage': 123,
            'LastModifiedDate': datetime(2015, 1, 1)
        },
    ],
    'MaxResults': 123,
    'Count': 123,
    'NextToken': 'string'
}

Response Structure

  • (dict) -- Returned for a successful ListIdentityPoolUsage request.

    • IdentityPoolUsages (list) -- Usage information for the identity pools.

      • (dict) -- Usage information for the identity pool.

        • IdentityPoolId (string) -- 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.

        • SyncSessionsCount (integer) -- Number of sync sessions for the identity pool.

        • DataStorage (integer) -- Data storage information for the identity pool.

        • LastModifiedDate (datetime) -- Date on which the identity pool was last modified.

    • MaxResults (integer) -- The maximum number of results to be returned.

    • Count (integer) -- Total number of identities for the identity pool.

    • NextToken (string) -- A pagination token for obtaining the next page of results.

ListRecords (new) Link ¶

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

Request Syntax

client.list_records(
    IdentityPoolId='string',
    IdentityId='string',
    DatasetName='string',
    LastSyncCount=123,
    NextToken='string',
    MaxResults=123,
    SyncSessionToken='string'
)
type IdentityPoolId

string

param IdentityPoolId

[REQUIRED] 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.

type IdentityId

string

param IdentityId

[REQUIRED] 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.

type DatasetName

string

param DatasetName

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

type LastSyncCount

integer

param LastSyncCount

The last server sync count for this record.

type NextToken

string

param NextToken

A pagination token for obtaining the next page of results.

type MaxResults

integer

param MaxResults

The maximum number of results to be returned.

type SyncSessionToken

string

param SyncSessionToken

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

rtype

dict

returns

Response Syntax

{
    'Records': [
        {
            'Key': 'string',
            'Value': 'string',
            'SyncCount': 123,
            'LastModifiedDate': datetime(2015, 1, 1),
            'LastModifiedBy': 'string',
            'DeviceLastModifiedDate': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string',
    'Count': 123,
    'DatasetSyncCount': 123,
    'LastModifiedBy': 'string',
    'MergedDatasetNames': [
        'string',
    ],
    'DatasetExists': True|False,
    'DatasetDeletedAfterRequestedSyncCount': True|False,
    'SyncSessionToken': 'string'
}

Response Structure

  • (dict) -- Returned for a successful ListRecordsRequest.

    • Records (list) -- A list of all records.

      • (dict) -- The basic data structure of a dataset.

        • Key (string) -- The key for the record.

        • Value (string) -- The value for the record.

        • SyncCount (integer) -- The server sync count for this record.

        • LastModifiedDate (datetime) -- The date on which the record was last modified.

        • LastModifiedBy (string) -- The user/device that made the last change to this record.

        • DeviceLastModifiedDate (datetime) -- The last modified date of the client device.

    • NextToken (string) -- A pagination token for obtaining the next page of results.

    • Count (integer) -- Total number of records.

    • DatasetSyncCount (integer) -- Server sync count for this dataset.

    • LastModifiedBy (string) -- The user/device that made the last change to this record.

    • MergedDatasetNames (list) -- Names of merged datasets.

      • (string) --

    • DatasetExists (boolean) -- Indicates whether the dataset exists.

    • DatasetDeletedAfterRequestedSyncCount (boolean) -- A boolean value specifying whether to delete the dataset locally.

    • SyncSessionToken (string) -- A token containing a session ID, identity ID, and expiration.

DeleteDataset (new) Link ¶

Deletes the specific dataset. The dataset will be deleted permanently, and the action can't be undone. Datasets that this dataset was merged with will no longer report the merge. Any consequent operation on this dataset will result in a ResourceNotFoundException.

Request Syntax

client.delete_dataset(
    IdentityPoolId='string',
    IdentityId='string',
    DatasetName='string'
)
type IdentityPoolId

string

param IdentityPoolId

[REQUIRED] 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.

type IdentityId

string

param IdentityId

[REQUIRED] 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.

type DatasetName

string

param DatasetName

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

rtype

dict

returns

Response Syntax

{
    'Dataset': {
        'IdentityId': 'string',
        'DatasetName': 'string',
        'CreationDate': datetime(2015, 1, 1),
        'LastModifiedDate': datetime(2015, 1, 1),
        'LastModifiedBy': 'string',
        'DataStorage': 123,
        'NumRecords': 123
    }
}

Response Structure

  • (dict) -- Response to a successful DeleteDataset request.

    • Dataset (dict) -- A collection of data for an identity pool. An identity pool can have multiple datasets. A dataset is per identity and can be general or associated with a particular entity in an application (like a saved game). Datasets are automatically created if they don't exist. Data is synced by dataset, and a dataset can hold up to 1MB of key-value pairs.

      • IdentityId (string) -- 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.

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

      • CreationDate (datetime) -- Date on which the dataset was created.

      • LastModifiedDate (datetime) -- Date when the dataset was last modified.

      • LastModifiedBy (string) -- The device that made the last change to this dataset.

      • DataStorage (integer) -- Total size in bytes of the records in this dataset.

      • NumRecords (integer) -- Number of records in this dataset.

DescribeIdentityPoolUsage (new) Link ¶

Gets usage details (for example, data storage) about a particular identity pool.

Request Syntax

client.describe_identity_pool_usage(
    IdentityPoolId='string'
)
type IdentityPoolId

string

param IdentityPoolId

[REQUIRED] 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.

rtype

dict

returns

Response Syntax

{
    'IdentityPoolUsage': {
        'IdentityPoolId': 'string',
        'SyncSessionsCount': 123,
        'DataStorage': 123,
        'LastModifiedDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) -- Response to a successful DescribeIdentityPoolUsage request.

    • IdentityPoolUsage (dict) -- Information about the usage of the identity pool.

      • IdentityPoolId (string) -- 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.

      • SyncSessionsCount (integer) -- Number of sync sessions for the identity pool.

      • DataStorage (integer) -- Data storage information for the identity pool.

      • LastModifiedDate (datetime) -- Date on which the identity pool was last modified.

ListDatasets (new) Link ¶

Lists datasets for an identity. The credentials used to make this API call need to have access to the identity data. With Amazon Cognito Sync, each identity has access only to its own data. You should use Amazon Cognito Identity service to retrieve the credentials necessary to make this API call.

Request Syntax

client.list_datasets(
    IdentityPoolId='string',
    IdentityId='string',
    NextToken='string',
    MaxResults=123
)
type IdentityPoolId

string

param IdentityPoolId

[REQUIRED] 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.

type IdentityId

string

param IdentityId

[REQUIRED] 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.

type NextToken

string

param NextToken

A pagination token for obtaining the next page of results.

type MaxResults

integer

param MaxResults

The maximum number of results to be returned.

rtype

dict

returns

Response Syntax

{
    'Datasets': [
        {
            'IdentityId': 'string',
            'DatasetName': 'string',
            'CreationDate': datetime(2015, 1, 1),
            'LastModifiedDate': datetime(2015, 1, 1),
            'LastModifiedBy': 'string',
            'DataStorage': 123,
            'NumRecords': 123
        },
    ],
    'Count': 123,
    'NextToken': 'string'
}

Response Structure

  • (dict) -- Returned for a successful ListDatasets request.

    • Datasets (list) -- A set of datasets.

      • (dict) -- A collection of data for an identity pool. An identity pool can have multiple datasets. A dataset is per identity and can be general or associated with a particular entity in an application (like a saved game). Datasets are automatically created if they don't exist. Data is synced by dataset, and a dataset can hold up to 1MB of key-value pairs.

        • IdentityId (string) -- 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.

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

        • CreationDate (datetime) -- Date on which the dataset was created.

        • LastModifiedDate (datetime) -- Date when the dataset was last modified.

        • LastModifiedBy (string) -- The device that made the last change to this dataset.

        • DataStorage (integer) -- Total size in bytes of the records in this dataset.

        • NumRecords (integer) -- Number of records in this dataset.

    • Count (integer) -- Number of datasets returned.

    • NextToken (string) -- A pagination token for obtaining the next page of results.

UpdateRecords (new) Link ¶

Posts updates to records and add and delete records for a dataset and user. The credentials used to make this API call need to have access to the identity data. With Amazon Cognito Sync, each identity has access only to its own data. You should use Amazon Cognito Identity service to retrieve the credentials necessary to make this API call.

Request Syntax

client.update_records(
    IdentityPoolId='string',
    IdentityId='string',
    DatasetName='string',
    RecordPatches=[
        {
            'Op': 'replace'|'remove',
            'Key': 'string',
            'Value': 'string',
            'SyncCount': 123,
            'DeviceLastModifiedDate': datetime(2015, 1, 1)
        },
    ],
    SyncSessionToken='string',
    ClientContext='string'
)
type IdentityPoolId

string

param IdentityPoolId

[REQUIRED] 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.

type IdentityId

string

param IdentityId

[REQUIRED] 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.

type DatasetName

string

param DatasetName

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

type RecordPatches

list

param RecordPatches

A list of patch operations.

  • (dict) -- An update operation for a record.

    • Op (string) -- [REQUIRED] An operation, either replace or remove.

    • Key (string) -- [REQUIRED] The key associated with the record patch.

    • Value (string) -- The value associated with the record patch.

    • SyncCount (integer) -- [REQUIRED] Last known server sync count for this record. Set to 0 if unknown.

    • DeviceLastModifiedDate (datetime) -- The last modified date of the client device.

type SyncSessionToken

string

param SyncSessionToken

[REQUIRED] The SyncSessionToken returned by a previous call to ListRecords for this dataset and identity.

type ClientContext

string

param ClientContext

Intended to supply a device ID that will populate the lastModifiedBy field referenced in other methods. The ClientContext field is not yet implemented.

rtype

dict

returns

Response Syntax

{
    'Records': [
        {
            'Key': 'string',
            'Value': 'string',
            'SyncCount': 123,
            'LastModifiedDate': datetime(2015, 1, 1),
            'LastModifiedBy': 'string',
            'DeviceLastModifiedDate': datetime(2015, 1, 1)
        },
    ]
}

Response Structure

  • (dict) -- Returned for a successful UpdateRecordsRequest.

    • Records (list) -- A list of records that have been updated.

      • (dict) -- The basic data structure of a dataset.

        • Key (string) -- The key for the record.

        • Value (string) -- The value for the record.

        • SyncCount (integer) -- The server sync count for this record.

        • LastModifiedDate (datetime) -- The date on which the record was last modified.

        • LastModifiedBy (string) -- The user/device that made the last change to this record.

        • DeviceLastModifiedDate (datetime) -- The last modified date of the client device.