SDK for PHP 3.x

Client: Aws\CognitoSync\CognitoSyncClient
Service ID: cognito-sync
Version: 2014-06-30

This page describes the parameters and results for the operations of the Amazon Cognito Sync (2014-06-30), and shows how to use the Aws\CognitoSync\CognitoSyncClient object to call the described operations. This documentation is specific to the 2014-06-30 API version of the service.

Operation Summary

Each of the following operations can be created from a client using $client->getCommand('CommandName'), where "CommandName" is the name of one of the following operations. Note: a command is a value that encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods available on a client object: $client->commandName(/* parameters */). You can send the command asynchronously (returning a promise) by appending the word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

BulkPublish ( array $params = [] )
Initiates a bulk publish of all existing datasets for an Identity Pool to the configured stream.
DeleteDataset ( array $params = [] )
Deletes the specific dataset.
DescribeDataset ( array $params = [] )
Gets meta data about a dataset by identity and dataset name.
DescribeIdentityPoolUsage ( array $params = [] )
Gets usage details (for example, data storage) about a particular identity pool.
DescribeIdentityUsage ( array $params = [] )
Gets usage information for an identity, including number of datasets and data usage.
GetBulkPublishDetails ( array $params = [] )
Get the status of the last BulkPublish operation for an identity pool.
GetCognitoEvents ( array $params = [] )
Gets the events and the corresponding Lambda functions associated with an identity pool.
GetIdentityPoolConfiguration ( array $params = [] )
Gets the configuration settings of an identity pool.
ListDatasets ( array $params = [] )
Lists datasets for an identity.
ListIdentityPoolUsage ( array $params = [] )
Gets a list of identity pools registered with Cognito.
ListRecords ( array $params = [] )
Gets paginated records, optionally changed after a particular sync count for a dataset and identity.
RegisterDevice ( array $params = [] )
Registers a device to receive push sync notifications.
SetCognitoEvents ( array $params = [] )
Sets the AWS Lambda function for a given event type for an identity pool.
SetIdentityPoolConfiguration ( array $params = [] )
Sets the necessary configuration for push sync.
SubscribeToDataset ( array $params = [] )
Subscribes to receive notifications when a dataset is modified by another device.
UnsubscribeFromDataset ( array $params = [] )
Unsubscribes from receiving notifications when a dataset is modified by another device.
UpdateRecords ( array $params = [] )
Posts updates to records and adds and deletes records for a dataset and user.

Operations

BulkPublish

$result = $client->bulkPublish([/* ... */]);
$promise = $client->bulkPublishAsync([/* ... */]);

Initiates a bulk publish of all existing datasets for an Identity Pool to the configured stream. Customers are limited to one successful bulk publish per 24 hours. Bulk publish is an asynchronous request, customers can see the status of the request via the GetBulkPublishDetails operation.

This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.

Parameter Syntax

$result = $client->bulkPublish([
    'IdentityPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
IdentityPoolId
Required: Yes
Type: 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.

Result Syntax

[
    'IdentityPoolId' => '<string>',
]

Result Details

Members
IdentityPoolId
Type: 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.

Errors

NotAuthorizedException:

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

InvalidParameterException:

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

ResourceNotFoundException:

Thrown if the resource doesn't exist.

InternalErrorException:

Indicates an internal service error.

DuplicateRequestException:

An exception thrown when there is an IN_PROGRESS bulk publish operation for the given identity pool.

AlreadyStreamedException:

An exception thrown when a bulk publish operation is requested less than 24 hours after a previous bulk publish operation completed successfully.

DeleteDataset

$result = $client->deleteDataset([/* ... */]);
$promise = $client->deleteDatasetAsync([/* ... */]);

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 subsequent operation on this dataset will result in a ResourceNotFoundException.

This API can be called with temporary user credentials provided by Cognito Identity or with developer credentials.

Parameter Syntax

$result = $client->deleteDataset([
    'DatasetName' => '<string>', // REQUIRED
    'IdentityId' => '<string>', // REQUIRED
    'IdentityPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
DatasetName
Required: Yes
Type: string
A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
IdentityId
Required: Yes
Type: 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
Required: Yes
Type: 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.

Result Syntax

[
    'Dataset' => [
        'CreationDate' => <DateTime>,
        'DataStorage' => <integer>,
        'DatasetName' => '<string>',
        'IdentityId' => '<string>',
        'LastModifiedBy' => '<string>',
        'LastModifiedDate' => <DateTime>,
        'NumRecords' => <integer>,
    ],
]

Result Details

Members
Dataset
Type: Dataset structure
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.

Errors

NotAuthorizedException:

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

InvalidParameterException:

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

ResourceNotFoundException:

Thrown if the resource doesn't exist.

InternalErrorException:

Indicates an internal service error.

TooManyRequestsException:

Thrown if the request is throttled.

ResourceConflictException:

Thrown if an update can't be applied because the resource was changed by another call and this would result in a conflict.

DescribeDataset

$result = $client->describeDataset([/* ... */]);
$promise = $client->describeDatasetAsync([/* ... */]);

Gets meta data about a dataset by identity and dataset name. 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.

This API 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.

Parameter Syntax

$result = $client->describeDataset([
    'DatasetName' => '<string>', // REQUIRED
    'IdentityId' => '<string>', // REQUIRED
    'IdentityPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
DatasetName
Required: Yes
Type: string
A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
IdentityId
Required: Yes
Type: 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
Required: Yes
Type: 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.

Result Syntax

[
    'Dataset' => [
        'CreationDate' => <DateTime>,
        'DataStorage' => <integer>,
        'DatasetName' => '<string>',
        'IdentityId' => '<string>',
        'LastModifiedBy' => '<string>',
        'LastModifiedDate' => <DateTime>,
        'NumRecords' => <integer>,
    ],
]

Result Details

Members
Dataset
Type: Dataset structure
Meta data 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.

Errors

NotAuthorizedException:

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

InvalidParameterException:

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

ResourceNotFoundException:

Thrown if the resource doesn't exist.

InternalErrorException:

Indicates an internal service error.

TooManyRequestsException:

Thrown if the request is throttled.

DescribeIdentityPoolUsage

$result = $client->describeIdentityPoolUsage([/* ... */]);
$promise = $client->describeIdentityPoolUsageAsync([/* ... */]);

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

This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.

Parameter Syntax

$result = $client->describeIdentityPoolUsage([
    'IdentityPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
IdentityPoolId
Required: Yes
Type: 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.

Result Syntax

[
    'IdentityPoolUsage' => [
        'DataStorage' => <integer>,
        'IdentityPoolId' => '<string>',
        'LastModifiedDate' => <DateTime>,
        'SyncSessionsCount' => <integer>,
    ],
]

Result Details

Members
IdentityPoolUsage
Type: IdentityPoolUsage structure
Information about the usage of the identity pool.

Errors

NotAuthorizedException:

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

InvalidParameterException:

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

ResourceNotFoundException:

Thrown if the resource doesn't exist.

InternalErrorException:

Indicates an internal service error.

TooManyRequestsException:

Thrown if the request is throttled.

DescribeIdentityUsage

$result = $client->describeIdentityUsage([/* ... */]);
$promise = $client->describeIdentityUsageAsync([/* ... */]);

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

This API can be called with temporary user credentials provided by Cognito Identity or with developer credentials.

Parameter Syntax

$result = $client->describeIdentityUsage([
    'IdentityId' => '<string>', // REQUIRED
    'IdentityPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
IdentityId
Required: Yes
Type: 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
Required: Yes
Type: 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.

Result Syntax

[
    'IdentityUsage' => [
        'DataStorage' => <integer>,
        'DatasetCount' => <integer>,
        'IdentityId' => '<string>',
        'IdentityPoolId' => '<string>',
        'LastModifiedDate' => <DateTime>,
    ],
]

Result Details

Members
IdentityUsage
Type: IdentityUsage structure
Usage information for the identity.

Errors

NotAuthorizedException:

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

InvalidParameterException:

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

ResourceNotFoundException:

Thrown if the resource doesn't exist.

InternalErrorException:

Indicates an internal service error.

TooManyRequestsException:

Thrown if the request is throttled.

GetBulkPublishDetails

$result = $client->getBulkPublishDetails([/* ... */]);
$promise = $client->getBulkPublishDetailsAsync([/* ... */]);

Get the status of the last BulkPublish operation for an identity pool.

This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.

Parameter Syntax

$result = $client->getBulkPublishDetails([
    'IdentityPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
IdentityPoolId
Required: Yes
Type: 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.

Result Syntax

[
    'BulkPublishCompleteTime' => <DateTime>,
    'BulkPublishStartTime' => <DateTime>,
    'BulkPublishStatus' => 'NOT_STARTED|IN_PROGRESS|FAILED|SUCCEEDED',
    'FailureMessage' => '<string>',
    'IdentityPoolId' => '<string>',
]

Result Details

Members
BulkPublishCompleteTime
Type: timestamp (string|DateTime or anything parsable by strtotime)
If BulkPublishStatus is SUCCEEDED, the time the last bulk publish operation completed.
BulkPublishStartTime
Type: timestamp (string|DateTime or anything parsable by strtotime)
The date/time at which the last bulk publish was initiated.
BulkPublishStatus
Type: string
Status of the last bulk publish operation, valid values are:

NOT_STARTED - No bulk publish has been requested for this identity pool

IN_PROGRESS - Data is being published to the configured stream

SUCCEEDED - All data for the identity pool has been published to the configured stream

FAILED - Some portion of the data has failed to publish, check FailureMessage for the cause.

FailureMessage
Type: string
If BulkPublishStatus is FAILED this field will contain the error message that caused the bulk publish to fail.
IdentityPoolId
Type: 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.

Errors

NotAuthorizedException:

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

InvalidParameterException:

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

ResourceNotFoundException:

Thrown if the resource doesn't exist.

InternalErrorException:

Indicates an internal service error.

GetCognitoEvents

$result = $client->getCognitoEvents([/* ... */]);
$promise = $client->getCognitoEventsAsync([/* ... */]);

Gets the events and the corresponding Lambda functions associated with an identity pool.

This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.

Parameter Syntax

$result = $client->getCognitoEvents([
    'IdentityPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
IdentityPoolId
Required: Yes
Type: string

The Cognito Identity Pool ID for the request

Result Syntax

[
    'Events' => ['<string>', ...],
]

Result Details

Members
Events
Type: Associative array of custom strings keys (CognitoEventType) to strings

The Cognito Events returned from the GetCognitoEvents request

Errors

InvalidParameterException:

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

ResourceNotFoundException:

Thrown if the resource doesn't exist.

NotAuthorizedException:

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

InternalErrorException:

Indicates an internal service error.

TooManyRequestsException:

Thrown if the request is throttled.

GetIdentityPoolConfiguration

$result = $client->getIdentityPoolConfiguration([/* ... */]);
$promise = $client->getIdentityPoolConfigurationAsync([/* ... */]);

Gets the configuration settings of an identity pool.

This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.

Parameter Syntax

$result = $client->getIdentityPoolConfiguration([
    'IdentityPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
IdentityPoolId
Required: Yes
Type: string

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.

Result Syntax

[
    'CognitoStreams' => [
        'RoleArn' => '<string>',
        'StreamName' => '<string>',
        'StreamingStatus' => 'ENABLED|DISABLED',
    ],
    'IdentityPoolId' => '<string>',
    'PushSync' => [
        'ApplicationArns' => ['<string>', ...],
        'RoleArn' => '<string>',
    ],
]

Result Details

Members
CognitoStreams
Type: CognitoStreams structure
Options to apply to this identity pool for Amazon Cognito streams.
IdentityPoolId
Type: string

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

PushSync
Type: PushSync structure

Options to apply to this identity pool for push synchronization.

Errors

NotAuthorizedException:

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

InvalidParameterException:

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

ResourceNotFoundException:

Thrown if the resource doesn't exist.

InternalErrorException:

Indicates an internal service error.

TooManyRequestsException:

Thrown if the request is throttled.

ListDatasets

$result = $client->listDatasets([/* ... */]);
$promise = $client->listDatasetsAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->listDatasets([
    'IdentityId' => '<string>', // REQUIRED
    'IdentityPoolId' => '<string>', // REQUIRED
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
]);

Parameter Details

Members
IdentityId
Required: Yes
Type: 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
Required: Yes
Type: 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.
MaxResults
Type: int
The maximum number of results to be returned.
NextToken
Type: string
A pagination token for obtaining the next page of results.

Result Syntax

[
    'Count' => <integer>,
    'Datasets' => [
        [
            'CreationDate' => <DateTime>,
            'DataStorage' => <integer>,
            'DatasetName' => '<string>',
            'IdentityId' => '<string>',
            'LastModifiedBy' => '<string>',
            'LastModifiedDate' => <DateTime>,
            'NumRecords' => <integer>,
        ],
        // ...
    ],
    'NextToken' => '<string>',
]

Result Details

Members
Count
Type: int
Number of datasets returned.
Datasets
Type: Array of Dataset structures
A set of datasets.
NextToken
Type: string
A pagination token for obtaining the next page of results.

Errors

NotAuthorizedException:

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

InvalidParameterException:

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

InternalErrorException:

Indicates an internal service error.

TooManyRequestsException:

Thrown if the request is throttled.

ListIdentityPoolUsage

$result = $client->listIdentityPoolUsage([/* ... */]);
$promise = $client->listIdentityPoolUsageAsync([/* ... */]);

Gets a list of identity pools registered with Cognito.

ListIdentityPoolUsage can only be called with developer credentials. You cannot make this API call with the temporary user credentials provided by Cognito Identity.

Parameter Syntax

$result = $client->listIdentityPoolUsage([
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
]);

Parameter Details

Members
MaxResults
Type: int
The maximum number of results to be returned.
NextToken
Type: string
A pagination token for obtaining the next page of results.

Result Syntax

[
    'Count' => <integer>,
    'IdentityPoolUsages' => [
        [
            'DataStorage' => <integer>,
            'IdentityPoolId' => '<string>',
            'LastModifiedDate' => <DateTime>,
            'SyncSessionsCount' => <integer>,
        ],
        // ...
    ],
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
]

Result Details

Members
Count
Type: int
Total number of identities for the identity pool.
IdentityPoolUsages
Type: Array of IdentityPoolUsage structures
Usage information for the identity pools.
MaxResults
Type: int
The maximum number of results to be returned.
NextToken
Type: string
A pagination token for obtaining the next page of results.

Errors

NotAuthorizedException:

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

InvalidParameterException:

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

InternalErrorException:

Indicates an internal service error.

TooManyRequestsException:

Thrown if the request is throttled.

ListRecords

$result = $client->listRecords([/* ... */]);
$promise = $client->listRecordsAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->listRecords([
    'DatasetName' => '<string>', // REQUIRED
    'IdentityId' => '<string>', // REQUIRED
    'IdentityPoolId' => '<string>', // REQUIRED
    'LastSyncCount' => <integer>,
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'SyncSessionToken' => '<string>',
]);

Parameter Details

Members
DatasetName
Required: Yes
Type: string
A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
IdentityId
Required: Yes
Type: 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
Required: Yes
Type: 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.
LastSyncCount
Type: long (int|float)
The last server sync count for this record.
MaxResults
Type: int
The maximum number of results to be returned.
NextToken
Type: string
A pagination token for obtaining the next page of results.
SyncSessionToken
Type: string
A token containing a session ID, identity ID, and expiration.

Result Syntax

[
    'Count' => <integer>,
    'DatasetDeletedAfterRequestedSyncCount' => true || false,
    'DatasetExists' => true || false,
    'DatasetSyncCount' => <integer>,
    'LastModifiedBy' => '<string>',
    'MergedDatasetNames' => ['<string>', ...],
    'NextToken' => '<string>',
    'Records' => [
        [
            'DeviceLastModifiedDate' => <DateTime>,
            'Key' => '<string>',
            'LastModifiedBy' => '<string>',
            'LastModifiedDate' => <DateTime>,
            'SyncCount' => <integer>,
            'Value' => '<string>',
        ],
        // ...
    ],
    'SyncSessionToken' => '<string>',
]

Result Details

Members
Count
Type: int
Total number of records.
DatasetDeletedAfterRequestedSyncCount
Type: boolean
A boolean value specifying whether to delete the dataset locally.
DatasetExists
Type: boolean
Indicates whether the dataset exists.
DatasetSyncCount
Type: long (int|float)
Server sync count for this dataset.
LastModifiedBy
Type: string
The user/device that made the last change to this record.
MergedDatasetNames
Type: Array of strings
Names of merged datasets.
NextToken
Type: string
A pagination token for obtaining the next page of results.
Records
Type: Array of Record structures
A list of all records.
SyncSessionToken
Type: string
A token containing a session ID, identity ID, and expiration.

Errors

InvalidParameterException:

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

NotAuthorizedException:

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

TooManyRequestsException:

Thrown if the request is throttled.

InternalErrorException:

Indicates an internal service error.

RegisterDevice

$result = $client->registerDevice([/* ... */]);
$promise = $client->registerDeviceAsync([/* ... */]);

Registers a device to receive push sync notifications.

This API can only be called with temporary credentials provided by Cognito Identity. You cannot call this API with developer credentials.

Parameter Syntax

$result = $client->registerDevice([
    'IdentityId' => '<string>', // REQUIRED
    'IdentityPoolId' => '<string>', // REQUIRED
    'Platform' => 'APNS|APNS_SANDBOX|GCM|ADM', // REQUIRED
    'Token' => '<string>', // REQUIRED
]);

Parameter Details

Members
IdentityId
Required: Yes
Type: string

The unique ID for this identity.

IdentityPoolId
Required: Yes
Type: string

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.

Platform
Required: Yes
Type: string

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

Token
Required: Yes
Type: string

The push token.

Result Syntax

[
    'DeviceId' => '<string>',
]

Result Details

Members
DeviceId
Type: string

The unique ID generated for this device by Cognito.

Errors

NotAuthorizedException:

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

InvalidParameterException:

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

ResourceNotFoundException:

Thrown if the resource doesn't exist.

InternalErrorException:

Indicates an internal service error.

InvalidConfigurationException:

This error does not currently have a description.

TooManyRequestsException:

Thrown if the request is throttled.

SetCognitoEvents

$result = $client->setCognitoEvents([/* ... */]);
$promise = $client->setCognitoEventsAsync([/* ... */]);

Sets the AWS Lambda function for a given event type for an identity pool. This request only updates the key/value pair specified. Other key/values pairs are not updated. To remove a key value pair, pass a empty value for the particular key.

This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.

Parameter Syntax

$result = $client->setCognitoEvents([
    'Events' => ['<string>', ...], // REQUIRED
    'IdentityPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
Events
Required: Yes
Type: Associative array of custom strings keys (CognitoEventType) to strings

The events to configure

IdentityPoolId
Required: Yes
Type: string

The Cognito Identity Pool to use when configuring Cognito Events

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

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

ResourceNotFoundException:

Thrown if the resource doesn't exist.

NotAuthorizedException:

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

InternalErrorException:

Indicates an internal service error.

TooManyRequestsException:

Thrown if the request is throttled.

SetIdentityPoolConfiguration

$result = $client->setIdentityPoolConfiguration([/* ... */]);
$promise = $client->setIdentityPoolConfigurationAsync([/* ... */]);

Sets the necessary configuration for push sync.

This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.

Parameter Syntax

$result = $client->setIdentityPoolConfiguration([
    'CognitoStreams' => [
        'RoleArn' => '<string>',
        'StreamName' => '<string>',
        'StreamingStatus' => 'ENABLED|DISABLED',
    ],
    'IdentityPoolId' => '<string>', // REQUIRED
    'PushSync' => [
        'ApplicationArns' => ['<string>', ...],
        'RoleArn' => '<string>',
    ],
]);

Parameter Details

Members
CognitoStreams
Type: CognitoStreams structure
Options to apply to this identity pool for Amazon Cognito streams.
IdentityPoolId
Required: Yes
Type: string

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.

PushSync
Type: PushSync structure

Options to apply to this identity pool for push synchronization.

Result Syntax

[
    'CognitoStreams' => [
        'RoleArn' => '<string>',
        'StreamName' => '<string>',
        'StreamingStatus' => 'ENABLED|DISABLED',
    ],
    'IdentityPoolId' => '<string>',
    'PushSync' => [
        'ApplicationArns' => ['<string>', ...],
        'RoleArn' => '<string>',
    ],
]

Result Details

Members
CognitoStreams
Type: CognitoStreams structure
Options to apply to this identity pool for Amazon Cognito streams.
IdentityPoolId
Type: string

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

PushSync
Type: PushSync structure

Options to apply to this identity pool for push synchronization.

Errors

NotAuthorizedException:

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

InvalidParameterException:

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

ResourceNotFoundException:

Thrown if the resource doesn't exist.

InternalErrorException:

Indicates an internal service error.

TooManyRequestsException:

Thrown if the request is throttled.

ConcurrentModificationException:

Thrown if there are parallel requests to modify a resource.

SubscribeToDataset

$result = $client->subscribeToDataset([/* ... */]);
$promise = $client->subscribeToDatasetAsync([/* ... */]);

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

This API can only be called with temporary credentials provided by Cognito Identity. You cannot call this API with developer credentials.

Parameter Syntax

$result = $client->subscribeToDataset([
    'DatasetName' => '<string>', // REQUIRED
    'DeviceId' => '<string>', // REQUIRED
    'IdentityId' => '<string>', // REQUIRED
    'IdentityPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
DatasetName
Required: Yes
Type: string

The name of the dataset to subcribe to.

DeviceId
Required: Yes
Type: string

The unique ID generated for this device by Cognito.

IdentityId
Required: Yes
Type: string

Unique ID for this identity.

IdentityPoolId
Required: Yes
Type: string

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.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

NotAuthorizedException:

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

InvalidParameterException:

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

ResourceNotFoundException:

Thrown if the resource doesn't exist.

InternalErrorException:

Indicates an internal service error.

InvalidConfigurationException:

This error does not currently have a description.

TooManyRequestsException:

Thrown if the request is throttled.

UnsubscribeFromDataset

$result = $client->unsubscribeFromDataset([/* ... */]);
$promise = $client->unsubscribeFromDatasetAsync([/* ... */]);

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

This API can only be called with temporary credentials provided by Cognito Identity. You cannot call this API with developer credentials.

Parameter Syntax

$result = $client->unsubscribeFromDataset([
    'DatasetName' => '<string>', // REQUIRED
    'DeviceId' => '<string>', // REQUIRED
    'IdentityId' => '<string>', // REQUIRED
    'IdentityPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
DatasetName
Required: Yes
Type: string

The name of the dataset from which to unsubcribe.

DeviceId
Required: Yes
Type: string

The unique ID generated for this device by Cognito.

IdentityId
Required: Yes
Type: string

Unique ID for this identity.

IdentityPoolId
Required: Yes
Type: string

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.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

NotAuthorizedException:

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

InvalidParameterException:

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

ResourceNotFoundException:

Thrown if the resource doesn't exist.

InternalErrorException:

Indicates an internal service error.

InvalidConfigurationException:

This error does not currently have a description.

TooManyRequestsException:

Thrown if the request is throttled.

UpdateRecords

$result = $client->updateRecords([/* ... */]);
$promise = $client->updateRecordsAsync([/* ... */]);

Posts updates to records and adds and deletes records for a dataset and user.

The sync count in the record patch is your last known sync count for that record. The server will reject an UpdateRecords request with a ResourceConflictException if you try to patch a record with a new value but a stale sync count.

For example, if the sync count on the server is 5 for a key called highScore and you try and submit a new highScore with sync count of 4, the request will be rejected. To obtain the current sync count for a record, call ListRecords. On a successful update of the record, the response returns the new sync count for that record. You should present that sync count the next time you try to update that same record. When the record does not exist, specify the sync count as 0.

This API can be called with temporary user credentials provided by Cognito Identity or with developer credentials.

Parameter Syntax

$result = $client->updateRecords([
    'ClientContext' => '<string>',
    'DatasetName' => '<string>', // REQUIRED
    'DeviceId' => '<string>',
    'IdentityId' => '<string>', // REQUIRED
    'IdentityPoolId' => '<string>', // REQUIRED
    'RecordPatches' => [
        [
            'DeviceLastModifiedDate' => <integer || string || DateTime>,
            'Key' => '<string>', // REQUIRED
            'Op' => 'replace|remove', // REQUIRED
            'SyncCount' => <integer>, // REQUIRED
            'Value' => '<string>',
        ],
        // ...
    ],
    'SyncSessionToken' => '<string>', // REQUIRED
]);

Parameter Details

Members
ClientContext
Type: string
Intended to supply a device ID that will populate the lastModifiedBy field referenced in other methods. The ClientContext field is not yet implemented.
DatasetName
Required: Yes
Type: string
A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
DeviceId
Type: string

The unique ID generated for this device by Cognito.

IdentityId
Required: Yes
Type: 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
Required: Yes
Type: 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.
RecordPatches
Type: Array of RecordPatch structures
A list of patch operations.
SyncSessionToken
Required: Yes
Type: string
The SyncSessionToken returned by a previous call to ListRecords for this dataset and identity.

Result Syntax

[
    'Records' => [
        [
            'DeviceLastModifiedDate' => <DateTime>,
            'Key' => '<string>',
            'LastModifiedBy' => '<string>',
            'LastModifiedDate' => <DateTime>,
            'SyncCount' => <integer>,
            'Value' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
Records
Type: Array of Record structures
A list of records that have been updated.

Errors

InvalidParameterException:

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

LimitExceededException:

Thrown when the limit on the number of objects or operations has been exceeded.

NotAuthorizedException:

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

ResourceNotFoundException:

Thrown if the resource doesn't exist.

ResourceConflictException:

Thrown if an update can't be applied because the resource was changed by another call and this would result in a conflict.

InvalidLambdaFunctionOutputException:

The AWS Lambda function returned invalid output or an exception.

LambdaThrottledException:

AWS Lambda throttled your account, please contact AWS Support

TooManyRequestsException:

Thrown if the request is throttled.

InternalErrorException:

Indicates an internal service error.

Shapes

AlreadyStreamedException

Description
An exception thrown when a bulk publish operation is requested less than 24 hours after a previous bulk publish operation completed successfully.
Members
message
Required: Yes
Type: string
The message associated with the AlreadyStreamedException exception.

CognitoStreams

Description
Configuration options for configure Cognito streams.
Members
RoleArn
Type: string
The ARN of the role Amazon Cognito can assume in order to publish to the stream. This role must grant access to Amazon Cognito (cognito-sync) to invoke PutRecord on your Cognito stream.
StreamName
Type: string
The name of the Cognito stream to receive updates. This stream must be in the developers account and in the same region as the identity pool.
StreamingStatus
Type: string
Status of the Cognito streams. Valid values are:

ENABLED - Streaming of updates to identity pool is enabled.

DISABLED - Streaming of updates to identity pool is disabled. Bulk publish will also fail if StreamingStatus is DISABLED.

ConcurrentModificationException

Description

Thrown if there are parallel requests to modify a resource.

Members
message
Required: Yes
Type: string

The message returned by a ConcurrentModicationException.

Dataset

Description
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.
Members
CreationDate
Type: timestamp (string|DateTime or anything parsable by strtotime)
Date on which the dataset was created.
DataStorage
Type: long (int|float)
Total size in bytes of the records in this dataset.
DatasetName
Type: string
A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
IdentityId
Type: 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.
LastModifiedBy
Type: string
The device that made the last change to this dataset.
LastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)
Date when the dataset was last modified.
NumRecords
Type: long (int|float)
Number of records in this dataset.

DuplicateRequestException

Description
An exception thrown when there is an IN_PROGRESS bulk publish operation for the given identity pool.
Members
message
Required: Yes
Type: string
The message associated with the DuplicateRequestException exception.

IdentityPoolUsage

Description
Usage information for the identity pool.
Members
DataStorage
Type: long (int|float)
Data storage information for the identity pool.
IdentityPoolId
Type: 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
Type: timestamp (string|DateTime or anything parsable by strtotime)
Date on which the identity pool was last modified.
SyncSessionsCount
Type: long (int|float)
Number of sync sessions for the identity pool.

IdentityUsage

Description
Usage information for the identity.
Members
DataStorage
Type: long (int|float)
Total data storage for this identity.
DatasetCount
Type: int
Number of datasets for the identity.
IdentityId
Type: 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
Type: 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
Type: timestamp (string|DateTime or anything parsable by strtotime)
Date on which the identity was last modified.

InternalErrorException

Description
Indicates an internal service error.
Members
message
Required: Yes
Type: string
Message returned by InternalErrorException.

InvalidConfigurationException

Members
message
Required: Yes
Type: string
Message returned by InvalidConfigurationException.

InvalidLambdaFunctionOutputException

Description

The AWS Lambda function returned invalid output or an exception.

Members
message
Required: Yes
Type: string

A message returned when an InvalidLambdaFunctionOutputException occurs

InvalidParameterException

Description
Thrown when a request parameter does not comply with the associated constraints.
Members
message
Required: Yes
Type: string
Message returned by InvalidParameterException.

LambdaThrottledException

Description

AWS Lambda throttled your account, please contact AWS Support

Members
message
Required: Yes
Type: string

A message returned when an LambdaThrottledException is thrown

LimitExceededException

Description
Thrown when the limit on the number of objects or operations has been exceeded.
Members
message
Required: Yes
Type: string
Message returned by LimitExceededException.

NotAuthorizedException

Description
Thrown when a user is not authorized to access the requested resource.
Members
message
Required: Yes
Type: string
The message returned by a NotAuthorizedException.

PushSync

Description

Configuration options to be applied to the identity pool.

Members
ApplicationArns
Type: Array of strings

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

RoleArn
Type: string

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

Record

Description
The basic data structure of a dataset.
Members
DeviceLastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)
The last modified date of the client device.
Key
Type: string
The key for the record.
LastModifiedBy
Type: string
The user/device that made the last change to this record.
LastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)
The date on which the record was last modified.
SyncCount
Type: long (int|float)
The server sync count for this record.
Value
Type: string
The value for the record.

RecordPatch

Description
An update operation for a record.
Members
DeviceLastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)
The last modified date of the client device.
Key
Required: Yes
Type: string
The key associated with the record patch.
Op
Required: Yes
Type: string
An operation, either replace or remove.
SyncCount
Required: Yes
Type: long (int|float)
Last known server sync count for this record. Set to 0 if unknown.
Value
Type: string
The value associated with the record patch.

ResourceConflictException

Description
Thrown if an update can't be applied because the resource was changed by another call and this would result in a conflict.
Members
message
Required: Yes
Type: string
The message returned by a ResourceConflictException.

ResourceNotFoundException

Description
Thrown if the resource doesn't exist.
Members
message
Required: Yes
Type: string
Message returned by a ResourceNotFoundException.

TooManyRequestsException

Description
Thrown if the request is throttled.
Members
message
Required: Yes
Type: string
Message returned by a TooManyRequestsException.