解析REST API - 批处理操作中不支持POST

时间:2015-08-18 06:55:00

标签: c# parse-platform

我使用C#调用解析api并尝试执行基本的批量创建操作给我这个错误

"{"code":107,"error":"Method 'POST' to '/1/classes/NewObject/' not supported in batch operations."}

我尝试将我的方法更改为PUT,但错误只是更改为

"{"code":107,"error":"Method 'PUT' to '/1/classes/NewObject/' not supported in batch operations."}

NewObject 已作为我的Parse应用程序中的类存在,并且已经有一条我通过REST API创建的记录

修改 来自c#观察者的我的请求参数

[0] {Accept=application/json}   RestSharp.Parameter
[1] {X-Parse-Application-Id=XXXXXXXXXXXXXXXXXXXXX}  RestSharp.Parameter
[2] {X-Parse-REST-API-Key=XXXXXXXXXXXXXXXXXXX}  RestSharp.Parameter
[3] {application/json={"requests":[{"method":"POST","path":"/1/classes/NewObject/","body":{"name":"luke","element":"Fir"}},{"method":"POST","path":"/1/classes/NewObject/","body":{"name":"tsitsi","element":"qwee"}}]}}    RestSharp.Parameter

1 个答案:

答案 0 :(得分:1)

检查http请求正文中的json是否格式正确,因为Parse.com REST Api支持批量操作POST。请在您的问题中添加您尝试执行的详细http请求。尝试从路径对象中删除尾部斜杠/。样品:

{
  "requests": [
    {
      "method": "POST",
      "path": "/1/classes/NewObject",
      "body": {
        "name": "luke",
        "element": "Fir"
      }
    },
    {
      "method": "POST",
      "path": "/1/classes/NewObject",
      "body": {
        "name": "tsitsi",
        "element": "qwee"
      }
    }
  ]
}