Apple Open CloudKit to Server-to-Server Requests

| by Sergio De Simone Follow 8 Followers on Feb 09, 2016. Estimated reading time: 1 minute |

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.

Apple has recently announced that CloudKit, OS X and iOS framework that provides access to Apple’s cloud platform, is now open to server-to-server web requests. This removes the previous restriction that limited access to the CloudKit public database only from iOS and Mac apps and through Apple’s web site.

CloudKit server-to-server requests adds to the previously existing features that allowed developers to providing a web interface so users could access their iCloud data. Server-to-server requests aim to give access to iCloud public database and could partially provide an alternative to Parse DBaaS, whose shutdown has been recently announced.

In order to read or write to the public CloudKit database from a server-side process or script, developers need to first generate a key pair using OpenSSL:

openssl ecparam -name prime256v1 -genkey -noout -out eckey.pem

Then, they should associate the public key with a CloudKit container by going to the CloudKit dashboard and then to API Access/Server-to-Server Keys. Once the public key has been stored, a keyID is generated that shall be included in the subpath of web services requests. Apple provides some JavaScript sample code that shows how developers can use the new method to authenticate against CloudKit. In particular, developers should build a string that concatenates three parameters:

[Current date]:[Request body]:[Web Service URL]

to be used in the request, as the following Apple-provided curl example shows:

curl -X POST -H "content-type: text/plain" -H "X-Apple-CloudKit-Request-KeyID: [keyID]” -H "X-Apple-CloudKit-Request-ISO8601Date: [date]" -H "X-Apple-CloudKit-Request-SignatureV1: [signature]" -d '{"users":[{"emailAddress":"[user email]"}]}'[container ID]/development/public/users/lookup/email

Several users on Stack Overflow have provided alternative implementation in JavaScript, PHP, and Python.

CloudKit provides several services to developers, including authentication, a private and a public database, and structured, e.g. plist-based, asset storage.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you