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 ?

Florian Shena
  • 1,384
  • 4
  • 19
  • 27

2 Answers2

4

As I found out you can also use the saveAllInBackground static method of ParseObject. You pass in a list of ParseObjects you wish to save.

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

Florian Shena
  • 1,384
  • 4
  • 19
  • 27
2

Using the Parse REST API, you can do batch operations (creating, reading, updating, deleting, etc).

Here is an example of saving a couple objects:

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

See the Batch Operations section of the Parse REST API Guide for more information.

Daniel Bank
  • 3,581
  • 3
  • 39
  • 50