Intro
Description
The updates stream returns a sorted list of changes made to accounts in a specific site group, in time order of application, Only the most recent change for a given account is guaranteed to be provided, for example if an account has had fields added, and then deleted, the API will not necessarily receive the intermediate state of the added account.
The updates stream can be used to listen for modifications of accounts for post processing or synchronization, a continuously polling of the updates stream is a reasonable approach for generating a real-time log for most applications.
The events stream supports following changes:
Uid changes (see more)
Sync user id changes with down stream systems (see more)
| Description |
|---|
| when an account is deleted. |
| when tow accounts merged . |
| when an account's uid is renamed. |
Account data update
Sync account changes with down stream systems (see more)
| Change type | Description |
|---|---|
| upsert | when a user record is updated or created |
| login | when a user successfully logged in. |
API
Stream registration
use this endpoint to create a registration for account updates stream.
Api parameters
| Name | Description | Type | Default |
|---|---|---|---|
| query | an SQL-like query specifying the events to retrieve. Please refer to the Query language specification section bellow. | string | select * from changelog |
| since | Unix time, represent earliest time of events in UTC, limited to now-30d | long represents a UTC time in milliseconds | now-10m |
Stream Scrolling
use this endpoint to fetch next batch of an existing stream.
Api parameters
| Name | Description | Type |
|---|---|---|
| cusrsorId | A token identifier for the next batch of results | string (optional) |
| limit | results count limit | int (optional) |
Query Syntax Specification
Same as other gigya queries with the following specifications
Supported clauses (must be ordered in the following way)
- Select clause
- uid
- type
- From clause
- changelog
- Where clause
- uid
- type
- Limit clause
- specify the maximum number of a batch size.
- if not specified, the default is 300. The maximum number of results that will be returned is 10000;.
- setting a limit higher than 10000 will have no affect on number of results.
- there is no guarantee of the exact number in batch (TODO rephrase)
Query examples
select * from changelog where uid = '13' limit 500
select * from changelog where type in ('upsert')
select * from changelog where type in ('delete', 'move', 'merge')
Event Format
uid: the event's subject.operation: the type of operation.details: json patch format that describing the data changesuid changes details: see here
{
"results": [
{
"uid": "123",
"operation": "upsert"
},
{
"uid": "0d3034fc1bb944a7a70362cfdb61af55",
"operation": "upsert"
},
{
"uid": "gigyaumtests+q50co3pwagv2ixht",
"operation": "delete",
"details": [".."]
},
{
"uid": "8bc3f6984513471e8dc4ca4c6e8db049",
"operation": "merge",
"details": [".."]
}
],
"nextCursorId": "Bub3RpZmljYXRpb25dXG4gIEEgLS0-IHx1aWQ6J2EnLCBuZXdVaWQ6J2InfCBTKChub3Rp"
}