4

On my Android application I'm getting the user's likes from facebook running an FQL query and I want to save the results on the PARSE platform. Instead of saving each object separately is there a way to make a batch request ?

4

2 回答 2

4

我发现你也可以使用 ParseObject 的 saveAllInBackground 静态方法。你传入一个你想要保存的 ParseObjects 列表。

http://www.parse.com/docs/android/api/com/parse/ParseObject.html#saveAllInBackground(java.util.List)

于 2013-11-12T12:31:03.540 回答
2

使用 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

有关详细信息,请参阅Parse REST API 指南的批处理操作部分

于 2013-11-04T01:30:23.433 回答