Amazon Cognito Sync

2014/11/06 - Amazon Cognito Sync - 5 new 1 updated api methods

GetIdentityPoolConfiguration (new) Link ¶

Gets the configuration settings of an identity pool.

Request Syntax

client.get_identity_pool_configuration(
    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. This is the ID of the pool for which to return a configuration.

rtype

dict

returns

Response Syntax

{
    'IdentityPoolId': 'string',
    'PushSync': {
        'ApplicationArns': [
            'string',
        ],
        'RoleArn': 'string'
    }
}

Response Structure

  • (dict) --

    The response from GetIdentityPoolConfigurationResponse .

    • IdentityPoolId (string) --

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

    • PushSync (dict) --

      Configuration options applied to the identity pool.

      • ApplicationArns (list) --

        List of SNS platform application ARNs that could be used by clients.

        • (string) --

      • RoleArn (string) --

        A role configured to allow Cognito to call SNS on behalf of the developer.

SubscribeToDataset (new) Link ¶

Subscribes to receive notifications when a dataset is modified by another device.

Request Syntax

client.subscribe_to_dataset(
    IdentityPoolId='string',
    IdentityId='string',
    DatasetName='string',
    DeviceId='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. The ID of the pool to which the identity belongs.

type IdentityId

string

param IdentityId

[REQUIRED]

Unique ID for this identity.

type DatasetName

string

param DatasetName

[REQUIRED]

The name of the dataset to subcribe to.

type DeviceId

string

param DeviceId

[REQUIRED]

The unique ID generated for this device by Cognito.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

    Response to a SubscribeToDataset request.

RegisterDevice (new) Link ¶

Registers a device to receive push sync notifications.

Request Syntax

client.register_device(
    IdentityPoolId='string',
    IdentityId='string',
    Platform='APNS'|'APNS_SANDBOX'|'GCM'|'ADM',
    Token='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. Here, the ID of the pool that the identity belongs to.

type IdentityId

string

param IdentityId

[REQUIRED]

The unique ID for this identity.

type Platform

string

param Platform

[REQUIRED]

The SNS platform type (e.g. GCM, SDM, APNS, APNS_SANDBOX).

type Token

string

param Token

[REQUIRED]

The push token.

rtype

dict

returns

Response Syntax

{
    'DeviceId': 'string'
}

Response Structure

  • (dict) --

    Response to a RegisterDevice request.

    • DeviceId (string) --

      The unique ID generated for this device by Cognito.

UnsubscribeFromDataset (new) Link ¶

Unsubscribe from receiving notifications when a dataset is modified by another device.

Request Syntax

client.unsubscribe_from_dataset(
    IdentityPoolId='string',
    IdentityId='string',
    DatasetName='string',
    DeviceId='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. The ID of the pool to which this identity belongs.

type IdentityId

string

param IdentityId

[REQUIRED]

Unique ID for this identity.

type DatasetName

string

param DatasetName

[REQUIRED]

The name of the dataset from which to unsubcribe.

type DeviceId

string

param DeviceId

[REQUIRED]

The unique ID generated for this device by Cognito.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

    Response to an UnsubscribeFromDataset request.

SetIdentityPoolConfiguration (new) Link ¶

Sets the necessary configuration for push sync.

Request Syntax

client.set_identity_pool_configuration(
    IdentityPoolId='string',
    PushSync={
        'ApplicationArns': [
            'string',
        ],
        'RoleArn': '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. This is the ID of the pool to modify.

type PushSync

dict

param PushSync

Configuration options to be applied to the identity pool.

  • ApplicationArns (list) --

    List of SNS platform application ARNs that could be used by clients.

    • (string) --

  • RoleArn (string) --

    A role configured to allow Cognito to call SNS on behalf of the developer.

rtype

dict

returns

Response Syntax

{
    'IdentityPoolId': 'string',
    'PushSync': {
        'ApplicationArns': [
            'string',
        ],
        'RoleArn': 'string'
    }
}

Response Structure

  • (dict) --

    Response to a SetIdentityPoolConfiguration request.

    • IdentityPoolId (string) --

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

    • PushSync (dict) --

      Configuration options applied to the identity pool.

      • ApplicationArns (list) --

        List of SNS platform application ARNs that could be used by clients.

        • (string) --

      • RoleArn (string) --

        A role configured to allow Cognito to call SNS on behalf of the developer.

UpdateRecords (updated) Link ¶
Changes (request)
{'DeviceId': 'string'}

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',
    DeviceId='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 DeviceId

string

param DeviceId

The unique ID generated for this device by Cognito.

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.