Documentation Archive

Developer

CloudKit Web Services Reference

On This Page

Fetching Database Changes (changes/database)

Fetches the zones that changed since a specified sync token.

Path

POST [path]/database/[version]/[container]/[environment]/[database]/changes/database

Parameters

path

The URL to the CloudKit web service, which is https://api.apple-cloudkit.com.

version

The protocol version—currently, 1.

container

A unique identifier for the app’s container. The container ID begins with iCloud..

environment

The version of the app’s container. Pass development to use the environment that is not accessible by apps available on the store. Pass production to use the environment that is accessible by development apps and apps available on the store.

database

The database to store the data within the container. The possible values are:

private

The database that contains private data that is visible only to the current user.

shared

The database that contains records shared with the current user.

Request

The POST request is a JSON dictionary containing the following keys:

Key

Description

syncToken

Identifies a point in the database’s change history.

resultsLimit

The maximum number of records to fetch. The default is the maximum number of records allowed in a request, described in Data Size Limits.

Response

Dictionary containing the results of the operation with the following keys:

Key

Description

zones

An array containing a result dictionary for each zone in the specified database. If successful, the result dictionary contains the keys described in Zone Dictionary. If unsuccessful, the result dictionary contains the keys described in Zone Fetch Error Dictionary.

syncToken

Identifies a point in the database’s change history.

moreComing

Boolean value that indicates whether there are more changes to request. If moreComing is true, request more changes using the value of the included syncToken key. If moreComing is false, there are no more changes.

Discussion

Use the Fetching Record Zone Changes (changes/zone) endpoint to fetch the changes in each zone returned in this response.