Hi, so I’m experimenting on Parse’s REST API. According to the documentation, this GET method will retrieve data from the specified class. By the way, develephant has a library for Parse and it’s awesome, thank you for that develephant. I just want to learn this.
curl -X GET \ -H "X-Parse-Application-Id: ParseAppID" \ -H "X-Parse-REST-API-Key: RESTAPIKey" \ https://api.parse.com/1/classes/GameScore
I have successfully coded this with LUA and it works fine. This is my LUA code translation to the code above.
local headers = {} headers["Content-Type"] = "application/json" headers["X-Parse-Application-Id"] = ParseAppID headers["X-Parse-REST-API-Key"] = RESTAPIKey local body = "" local params = {} params.headers = headers params.body = body network.request("https://api.parse.com/1/classes/GameScore", "GET", networkListener, params)
Now I want to query data with specific conditions. Parse’s documentation has this GET method.
curl -X GET \ -H "X-Parse-Application-Id: ParseAppID" \ -H "X-Parse-REST-API-Key: RESTAPIKey" \ -G \ --data-urlencode 'where={"playerName":"Sean Plott","cheatMode":false}' \ https://api.parse.com/1/classes/GameScore
How do I translate this to LUA code? I have this code so far but it does not work. This is really a noob question. I am sorry for this. What does -G and --data mean? -H stands for Headers if I’m not mistaken.
local headers = {} headers["Content-Type"] = "application/json" headers["X-Parse-Application-Id"] = ParseAppID headers["X-Parse-REST-API-Key"] = RESTAPIKey local body = urlencode("where={playerName:Sean Plott,cheatMode:false}") local params = {} params.headers = headers params.body = body network.request("https://api.parse.com/1/classes/GameScore", "GET", networkListener, params)
I’d appreciate some guidance on this one, even just a bit Thank you very much.