Types and Dictionaries
The types and dictionaries listed below are used by multiple CloudKit web service requests that correspond to types or classes in CloudKit JS and the native API.
Types
CKValue
A CKValue
represents a field type value. The table shows the supported field types.
Schema field type |
JavaScript type |
Description |
---|---|---|
Asset |
|
A large file that is associated with a record but stored separately. Represented by a dictionary, described in Asset Dictionary. |
|
|
A |
Bytes |
|
A wrapper for byte buffers that is stored with the record. Represented by a Base64-encoded string. |
Date/Time |
|
A date or time value. Represented as a number in milliseconds between midnight on January 1, 1970, and the specified date or time. |
Double |
|
A double. |
Int(64) |
|
An integer. |
Location |
|
A geographical coordinate and altitude, represented by a dictionary, described in Location Dictionary. |
Reference |
|
A relationship from one object to another, represented by a dictionary, described in Reference Dictionary. |
String |
|
A text string. |
List |
|
An array containing any of the above field types. |
Dictionaries
Several common dictionaries are used by multiple requests and responses throughout CloudKit web services.
Asset Dictionary
An asset dictionary represents an Asset field type with the following keys:
Key |
Description |
---|---|
|
The signature of a file returned from the file upload step. This key is required for the public and private database. |
|
The size of the file, calculated by the asset upload step. This key is required for the public and private database. |
|
The checksum of the wrapping key returned from the upload step. This key is required for the private database. |
|
The secret key used to encrypt the asset. This key is required for the private database. |
|
The receipt for uploading the asset, described in Upload Asset Data. This key is required for the public and private database when saving the enclosing record. |
|
The location of the asset data to download. This key is present only when fetching the enclosing record. |
Filter Dictionary
A filter dictionary defines the logical conditions for determining whether a record matches the query.
Key |
Description |
---|---|
|
A string representing the filter comparison operator. Possible values are described in Comparator Values. This key is required. |
|
The name of a field belonging to the record type. |
|
A field-value dictionary, described in Record Field Dictionary, representing the value of the field that you want all fetched records to match. This key is required. |
|
A radius in meters used to determine whether a field of type |
Comparator Values
The following values are allowed for the comparator
key in a filter dictionary.
Key |
Description |
---|---|
|
The left-hand value is equal to the right-hand value. |
|
The left-hand value is not equal to the right-hand value. |
|
The left-hand value is less than the right-hand value. |
|
The left-hand value is less than or equal to the right-hand value. |
|
The left-hand value is greater than the right-hand value. |
|
The left-hand value is greater than or equal to the right-hand value. |
|
The left-hand location is within the specified distance of the right-hand location. |
|
The records have text fields that contain all specified tokens. |
|
The left-hand value is in the right-hand list. |
|
The left-hand value is not in the right-hand list. |
|
The records with text fields contain any of the specified tokens. |
|
The records contain values in a list field. |
|
The records don’t contain the specified values in a list field. |
|
The records don’t contain any of the specified values in a list field. |
|
The records with a field that begins with a specified value. |
|
The records with a field that doesn’t begin with a specified value. |
|
The records contain a specified value as the first item in a list field. |
NOT_LIST_MEMBER_BEGINS_WITH |
The records don’t contain a specified value as the first item in a list field. |
|
The records contain all values in a list field. |
|
The records don’t contain all specified values in a list field. |
Location Dictionary
A location dictionary represents values used to set a field of type Location with the following keys:
Key |
Description |
---|---|
|
The latitude of the coordinate point. This key is required. |
|
The longitude of the coordinate point. This key is required. |
|
The radius of uncertainty for the location, measured in meters. |
|
The accuracy of the altitude value in meters. |
|
The altitude measured in meters. |
|
The instantaneous speed of the device in meters per second. |
|
The direction in which the device is traveling. |
|
The time at which this location was determined. |
Name Components Dictionary
A user dictionary describes a user's name with the following keys:
Key |
Description |
---|---|
|
The user’s prefix. |
|
The user’s first name. |
|
The user’s last name. |
|
The user’s nickname. |
|
The user’s suffix. |
|
The user’s middle name. |
|
A phonetic representation of the user’s name. |
Notification Info Dictionary
A notification info dictionary represents information about a notification with the following keys:
Key |
Description |
---|---|
|
The text of the alert message. |
|
A key to a localized alert message. |
|
An array of strings to appear as variables if |
|
A key to get a localized right button title that appears in the alert dialog. |
|
The filename of an image file located in the app bundle to use as a launch image. |
|
The name of a sound file located in the app bundle to use as an alert sound. |
|
A Boolean value indicating whether a badge should be displayed. If |
|
A Boolean value indicating whether new content is available. If |
For more information on these keys and push notifications, read The Notification Payload in Local and Remote Notification Programming Guide.
Query Dictionary
Use the following search parameters when fetching records from the database:
Key |
Description |
---|---|
|
The name of the record type. This key is required. |
|
An Array of filter dictionaries (described in Filter Dictionary) used to determine whether a record matches the query. |
|
An Array of sort descriptor dictionaries (described in Sort Descriptor Dictionary) that specify how to order the fetched records. |
Record Dictionary
A record dictionary describes a record in a database. Some keys in the record dictionary are used in requests and others appear in responses. Also, some keys are specific to whether the record is shared or is a share, a record of type cloudKit.shared
.
Common Record Keys
These record keys appear in requests and responses:
Key |
Description |
---|---|
|
The unique name used to identify the record within a zone. The default value is a random UUID. |
|
The name of the record type. This key is required for certain operations if the record doesn’t exist. |
|
A string containing the server change token for the record. Use this tag to indicate which version of the record you last fetched.
This key is required if the operation type is |
|
The dictionary of key-value pairs whose keys are the record field names and values are field-value dictionaries, described in Record Field Dictionary. The default value is an empty dictionary.
If the operation is |
Request Keys
Some keys are specific to the request of an endpoint.
Shared Record Request Keys
To share a record, set the createShortGUID
key to true
in a request. To create collections of records to share, include the parent
key.
Key |
Description |
---|---|
|
A Boolean value indicating whether to create a short GUID for sharing this record. The default value is |
|
A dictionary with a single |
Share Request Keys
To create a share record (a record of type cloudKit.share
), include these keys in the request:
Key |
Description |
---|---|
|
A dictionary indicating the record that is being shared. The dictionary keys are |
|
Indicates the public read-write permissions of the shared record. Possible values are |
|
An array of participants in the shared record. Participants are represented by a dictionary, described in Share Participant Dictionary. |
A share record dictionary also contains the parent
, publicPermission
, and participants
keys in the response.
Response Keys
Common Response Keys
These record keys appear in responses:
Key |
Description |
---|---|
|
The dictionary representation of the date the record was created. The dictionary keys are:
|
|
The dictionary representation of the date the record was modified. The dictionary keys are:
|
|
A Boolean value indicating whether the record was deleted. If |
|
A global ID that identifies the record, described in ShortGUID Dictionary.
NOTE: A |
Shared Record Response Keys
These record keys appear in a response for a record that is shared:
Key |
Description |
---|---|
|
A dictionary with a single |
The parent
key also appears in the request to create a collection of shared records.
Share Response Keys
These keys appear in a response for a share record, a record of type cloudKit.share
.
Key |
Description |
---|---|
|
A dictionary with a single |
|
The owner of a shared record, described in Share Participant Dictionary. |
|
Indicates the public read-write permissions of the shared record. Possible values are |
|
An array of participants in the shared record. Participants are represented by a dictionary, described in Share Participant Dictionary. |
|
Information on the current user’s participation in the share, described in Share Participant Dictionary. |
The publicPermission
, and participants
keys, also appear in the request.
Record Field Dictionary
A record field dictionary represents the value of a field and is of the form { value: CKValue, type: string (optional) }
. CKValue represents field values of type String, Number, Boolean, Reference, Asset, and Location.
Reference Dictionary
A reference dictionary represents a Reference field type with the following keys:
Key |
Description |
---|---|
|
The unique name used to identify the record within a zone. This key is required. |
|
The dictionary that identifies a record zone in the database, described in Zone ID Dictionary. |
|
The delete action for the reference object. Possible values are:
This key is required unless the dictionary is included in a query. |
Share Participant Dictionary
A dictionary that represents a participant in a shared record.
Value |
Description |
---|---|
|
A user identity dictionary representing the participant in a shared record, described in User Identity Dictionary. |
|
The participant’s read and write permissions. Possible values are: |
|
Type of participant. Possible values are: |
|
Indicates the status of accepting the shared record. Possible values are: |
ShortGUID Dictionary
A global identifier for a record.
Value |
Description |
---|---|
|
String representing the value of the short global ID. This key is required. |
|
A Boolean value that indicates whether the root record should be fetched with this record. This key is required. |
|
An array of strings containing record field names that limits the amount of data returned in this operation. Only the fields specified in the array are returned in the root record. The default is |
ShortGUID Result Dictionary
A dictionary representing the result of fetching a shared record.
Value |
Description |
---|---|
|
A unique identifier for the app’s container. The container ID begins with |
|
The type of database. Possible values are: |
|
The name of the root record that was shared. |
|
A user identity dictionary representing the owner of the shared record, described in User Identity Dictionary. |
|
The version of the app’s container. Possible values are |
|
A record dictionary, described in Record Dictionary, that represents the shared record. |
|
A dictionary that identifies a record zone in the database, described in Zone ID Dictionary. |
|
The share record, a record dictionary, described in Record Dictionary, where the |
|
A short GUID, described in ShortGUID Dictionary. |
|
If the participant is not identifiable, this array contains potential participants that the user can choose from.
The array contains dictionaries with the following keys:
The |
|
The participant’s read and write permissions. Possible values are: |
|
Indicates the status of accepting the shared record. Possible values are: |
|
Type of participant. Possible values are: |
|
This is the fallback webpage ( |
ShortGUID Fetch Error Dictionary
A dictionary representing the result of fetching a shared record.
Value |
Description |
---|---|
|
A string indicating the reason for the error. |
|
The suggested time to wait before trying this operation again. If this key is not set, the operation can’t be retried. |
|
A string containing the code for the error that occurred. For possible values, see Error Codes. |
Sort Descriptor Dictionary
A sort descriptor dictionary determines the order of the fetched records.
Value |
Description |
---|---|
|
The name of a field belonging to the record type. Used to sort the fetched records. This key is required. |
|
A Boolean value that indicates whether the fetched records should be sorted in ascending order. If |
|
A field-value dictionary, described in Record Field Dictionary, that is the reference location to use when sorting. Records are sorted based on their distance to this location. Used only if |
Subscription Dictionary
A subscription dictionary describes a successful subscription fetch containing the following keys:
Key |
Description |
---|---|
|
A dictionary that identifies a record zone to monitor in the database, described in Zone ID Dictionary. |
|
A unique identifier for the subscription. |
|
The type of subscription. Possible values are: |
|
A dictionary containing the matching criteria to apply to records, described in Query Dictionary. |
|
An array of keywords that specifies the actions that should trigger push notifications. Possible values in the array are: |
|
A Boolean value indicating whether push notifications should be triggered once. If |
|
A dictionary containing information about how the system should alert the user, described in Notification Info Dictionary. |
|
A Boolean value determining whether all zones should be searched. If |
User Dictionary
A user dictionary describes a user with the following keys:
Key |
Description |
---|---|
|
The record name field in the associated |
|
The user’s first name. If not found, |
|
The user’s last name. If not found, |
|
This key is included only when fetching users by email, described in Fetching Users by Email (users/lookup/email). |
User Identity Dictionary
A dictionary that identifies a user with the following keys:
Key |
Description |
---|---|
|
A dictionary identifying the user, described in User Identity Lookup Information Dictionary. |
|
The record name field in the associated |
|
A dictionary representing the user’s name, described in Name Components Dictionary. |
User Identity Lookup Information Dictionary
A dictionary used to lookup user information:
Key |
Description |
---|---|
|
A string representing user’s email address. |
|
A string representing user’s phone number. |
|
The record name field in the associated |
Zone Dictionary
A zone dictionary describes a successful zone fetch containing the following keys:
Key |
Description |
---|---|
|
The dictionary that identifies a record zone in the database, described in Zone ID Dictionary. |
|
The current point in the zone’s change history. |
|
A Boolean value indicating whether this zone supports atomic operations. |
Zone ID Dictionary
The zone ID identifies an area for organizing related records in a database.
Key |
Description |
---|---|
|
The name that identifies the record zone. The default value is |
|
String representing the zone owner’s user record name. Use this key to identify a zone owned by another user. The default value is the current user’s record name. |
Registering Tokens (tokens/register)
Copyright © 2018 Apple Inc. All rights reserved. Terms of Use | Privacy Policy | Updated: 2016-06-13