Updating multiple object arrays for parse. Need some help.

I want to have a function to append (AddUnique) to a parse array column for multiple users in one request. What is the proper way of doing this? I know I could pass in a variable with an object ID to use in the URL, but this would still limit me to only updating a single object. I would like to append to an array column on multiple object’s. Ideas?

I haven’t found anything in mod_parse for handling arrays.

Here is what I have so far:

[lua]
function parseArray(Class, Column, Type, Data )
    local function networkListener(event)
        if event.phase == “ended” then
            local t = json.decode(event.response)
            if t.error then
                print(t.error)
            else
                print(“Array was updated:”)
            end
        end
    end

    local appendArrayData = {
                  [Column] = {["__op"] = Type,[“objects”] = Data },
                  }

    headers = {}
    headers[“X-Parse-Application-Id”] = globals.appId
    headers[“X-Parse-REST-API-Key”] = globals.apiKey
    headers[“X-Parse-Session-Token”] = globals.sessionToken
    headers[“Content-Type”] = “application/json”
    local params = {}
    params.headers = headers
    params.body = json.encode ( appendArrayData )
    network.request( “https://api.parse.com/1/classes/"..Class.."/”…globals.userId, “PUT”, networkListener,     params)

end

myData = {“test1”, “test2”, “test3”}
parseArray("_User", “Column1”, “AddUnique”, myData)

[/lua]

Parse Docs:

https://www.parse.com/docs/rest#objects

I am guessing I may need to do a batch? What would be a good way to take a table of objectId’s and create a batch request so each objectId in a table gets their array updated? (Not sure how this would handle ~100 object’s being updated.

curl -X POST \

  -H “X-Parse-Application-Id: xxxxxxxxxxxxxxxxxxxxxxxx” \

  -H “X-Parse-REST-API-Key: xxxxxxxxxxxxxxxxxxxxx” \

  -H “Content-Type: application/json” \

  -d '{

        “requests”: [

          {

            “method”: “PUT”,

            “path”: “/1/classes/GameScore/Ed1nuqPvcm”,

            “body”: {

              “score”: 999999

            }

          },

          {

            “method”: “DELETE”,

            “path”: “/1/classes/GameScore/Cpl9lrueY5”

          }

        ]

      }’ \

  https://api.parse.com/1/batch

This is not relevant anymore considering a user is unable to modify another users data unless wanting to pass in the master key.

Need to figure out a way to query an array in parse to return all rows that contain a specific string passed into it. Ideas?

I am guessing I may need to do a batch? What would be a good way to take a table of objectId’s and create a batch request so each objectId in a table gets their array updated? (Not sure how this would handle ~100 object’s being updated.

curl -X POST \

  -H “X-Parse-Application-Id: xxxxxxxxxxxxxxxxxxxxxxxx” \

  -H “X-Parse-REST-API-Key: xxxxxxxxxxxxxxxxxxxxx” \

  -H “Content-Type: application/json” \

  -d '{

        “requests”: [

          {

            “method”: “PUT”,

            “path”: “/1/classes/GameScore/Ed1nuqPvcm”,

            “body”: {

              “score”: 999999

            }

          },

          {

            “method”: “DELETE”,

            “path”: “/1/classes/GameScore/Cpl9lrueY5”

          }

        ]

      }’ \

  https://api.parse.com/1/batch

This is not relevant anymore considering a user is unable to modify another users data unless wanting to pass in the master key.

Need to figure out a way to query an array in parse to return all rows that contain a specific string passed into it. Ideas?