我使用REST API调用创建一个安装对象:
curl -X POST \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"deviceType": "ios",
"deviceToken": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"channels": [
""
]
}' \
https://<your.parseprovider.here>/1/installations
创建安装对象并由响应指示:
{
"objectId": "EmqGmZXGEm",
"createdAt": "2017-02-15T10:13:18.647Z"
}
现在假设我想更新渠道字段以在安装对象中包含“foo”频道,我可以简单地发出如下呼叫:
curl -X PUT \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"channels": [
"",
"foo"
]
}' \
https://<your.parseprovider.here>/1/installations/EmqGmZXGEm
响应表明成功:
{
"updatedAt": "2017-02-15T10:18:31.055Z"
}
但是,当我像这样执行PUT调用时(如REST API docs中所示,请注意包含deviceType和deviceToken字段):
curl -X PUT \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"deviceType":"ios",
"deviceToken":"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"channels": [
"",
"foo"
]
}' \
https://<your.parseprovider.here>/1/installations/EmqGmZXGEm
我现在收到以下回复:
{
"code": 101,
"error": "Object not found."
}
现在突然从Parse服务器数据库中删除了安装对象。
只要deviceToken字段包含在PUT请求中,这似乎就会发生。
这应该发生,还是我错过了什么?我正在使用Delphi的Parse API,因为这种“现象”而破产。如果错误是由于应该在服务器端修复的Parse错误,我宁愿不破解API。