Skip to content

Instantly share code, notes, and snippets.

@insidegui
Last active May 3, 2023 15:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save insidegui/537b5a3227a05534d49970682183854d to your computer and use it in GitHub Desktop.
Save insidegui/537b5a3227a05534d49970682183854d to your computer and use it in GitHub Desktop.
Fetch records from CloudKit's public database with vanilla Javascript.
const query = {
"records": [
{
"recordName": "49A20D8A-A213-F2A4-71C3-E0758908F1D5"
}
]
}
const container = 'iCloud.br.com.guilhermerambo.ChibiStudioModern'
const url = `https://api.apple-cloudkit.com/database/1/${container}/production/public/records/lookup`
fetch(url, {
'method': 'POST',
'headers': {'Content-Type': 'application/json'},
'body': JSON.stringify(query)
}).then(response => {
response.json().then(json => {
console.log(json)
})
}).catch(e => {
console.error(e)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment