其他分享
首页 > 其他分享> > 如何使用android中的PARSE库保存多个对象

如何使用android中的PARSE库保存多个对象

作者:互联网

在我的Android应用程序上,我从Facebook运行FQL查询获得用户的喜欢,我想将结果保存在PARSE平台上.
而不是单独保存每个对象有没有办法进行批量请求?

解决方法:

使用Parse 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 '{
        "requests": [
          {
            "method": "POST",
            "path": "/1/classes/GameScore",
            "body": {
              "score": 1337,
              "playerName": "Sean Plott"
            }
          },
          {
            "method": "POST",
            "path": "/1/classes/GameScore",
            "body": {
              "score": 1338,
              "playerName": "ZeroCool"
            }
          }
        ]
      }' \
  https://api.parse.com/1/batch

有关更多信息,请参见Batch Operations section of the Parse REST API Guide.

标签:android,parse-com
来源: https://codeday.me/bug/20190529/1176172.html