I have a php script that's trying to create a record in a CloudKit database.
It returns this error:
object(stdClass)#1 (3) { ["uuid"]=> string(36) "c70072a1-fab6-491b-a68f-03b9056223e1" ["serverErrorCode"]=>
string(11) "BAD_REQUEST" ["reason"]=> string(62) "BadRequestException: Unexpected input at [line: 2, column: 10]" }
I presume this tells me exactly what the problem is, but I don't know how to interpret it. Where is line 2 and column 10?
I think its related to the JSON I'm sending in the create record request.
$url = 'https://api.apple-cloudkit.com/database/1/' . $CONTAINER . '/development/public/records/modify';
$opDict = '{"operationType": "create",
"record":"Artists",
"fields": {"firstName":{"value":"Mei"},
"lastName": {"value":"Chen"},
"principalDiscipline": {"value":""},
"secondaryDiscipline":{"value":""}},
"recordName":"Mei Chen"}';
$body = '{"operations":['.$opDict.']}';
echo $body;
When I check the output from $body
{"operations":[{"operationType": "create", "record":"Artists", "fields": {"firstName":{"value":"Mei"}, "lastName": {"value":"Chen"}, "principalDiscipline": {"value":""}, "secondaryDiscipline":{"value":""}}, "recordName":"Mei Chen"}]}
it passes JSON lint, so I am not sure it is a JSON problem.
Can someone explain to me how to interpret the error I'm getting from CloudKit. The docs are a little vague on errors.