remote control variables with parse

Hi all,

I am working with corona app and my client wants me to use parse to remote control the variables. Like we can update the variables on sever and app updates them from there. Now my client wants me to use parse for this purpose. I am not really sure that parse can be used for this purpose or not. Also I searched for help on this but could not find anything very useful. I need some comprehensive guide about using parse and how to integrate it with corona. I will be thankful for help.

[import]uid: 126619 topic_id: 33391 reply_id: 333391[/import]

The biggest restriction here is you are going to need Corona Enterprise, since Parse comes with a client-side SDK. You can’t integrate Parse until you have Corona Enterprise.

Otherwise it looks like you could get away with much simpler tech, but a quick look of the API makes it look like storing a simple array of Key-Value pairs (Variable Name - Value) would be definitely doable.

If your only use is some server-side control variables, it looks like overkill, but depending on your game, it looks like it could cover a lot of server-side requirements and features. [import]uid: 134101 topic_id: 33391 reply_id: 132660[/import]

Search in the Community Code. I know someone uploaded a Parse helper script that makes using their REST API calls easy.

Parse is basically a database in the cloud solution and you should be able to get/set values to/from any Corona SDK based app. As far as updating the variables directly with Parse, I’m not sure if they provide an interface for that or not. But because their service is using simple REST API type calls, it would be easy enough to host a web page on some server that makes calls with PHP or some other scripting language to update them. You would setup whatever HTML form necessary and when you submit it, that script takes your form values and does the necessary calls with Parse.

Unfortunately I’ve never worked with Parse, so I don’t have a ready example of it. [import]uid: 199310 topic_id: 33391 reply_id: 132666[/import]

I have been using Parse for a while in my app I am currently working on. You interact with their API using network.request calls. I am at work so I can not offer specific examples. The basics of it are you would send a POST request to create a record. PUT request to update a record and GET to retrieve data.

They also have a console through their website that allows you to interact with the databases directly. So you could do what your wanting pretty easily I think. [import]uid: 56820 topic_id: 33391 reply_id: 132681[/import]

Hi All

Thanks a lot for help. Please guide me if I am able to use parse for this purpose then is it possible to remote control the variables for each downloaded app individually? Like when user downloads the free version from App store then I will be able to control the variables individually for each downloaded app. Is it possible with parse?

Thanks [import]uid: 126619 topic_id: 33391 reply_id: 132749[/import]

Yes I do not see why not. You have control over the data you put in Parse. You could have one database for each app and have a record in the database for each user or something more simple like one database with global variables for all apps or each app. It’s just an online database system. It’s up to you how you use it. [import]uid: 56820 topic_id: 33391 reply_id: 132773[/import]

The biggest restriction here is you are going to need Corona Enterprise, since Parse comes with a client-side SDK. You can’t integrate Parse until you have Corona Enterprise.

Otherwise it looks like you could get away with much simpler tech, but a quick look of the API makes it look like storing a simple array of Key-Value pairs (Variable Name - Value) would be definitely doable.

If your only use is some server-side control variables, it looks like overkill, but depending on your game, it looks like it could cover a lot of server-side requirements and features. [import]uid: 134101 topic_id: 33391 reply_id: 132660[/import]

Search in the Community Code. I know someone uploaded a Parse helper script that makes using their REST API calls easy.

Parse is basically a database in the cloud solution and you should be able to get/set values to/from any Corona SDK based app. As far as updating the variables directly with Parse, I’m not sure if they provide an interface for that or not. But because their service is using simple REST API type calls, it would be easy enough to host a web page on some server that makes calls with PHP or some other scripting language to update them. You would setup whatever HTML form necessary and when you submit it, that script takes your form values and does the necessary calls with Parse.

Unfortunately I’ve never worked with Parse, so I don’t have a ready example of it. [import]uid: 199310 topic_id: 33391 reply_id: 132666[/import]

I have been using Parse for a while in my app I am currently working on. You interact with their API using network.request calls. I am at work so I can not offer specific examples. The basics of it are you would send a POST request to create a record. PUT request to update a record and GET to retrieve data.

They also have a console through their website that allows you to interact with the databases directly. So you could do what your wanting pretty easily I think. [import]uid: 56820 topic_id: 33391 reply_id: 132681[/import]

Hi All

Thanks a lot for help. Please guide me if I am able to use parse for this purpose then is it possible to remote control the variables for each downloaded app individually? Like when user downloads the free version from App store then I will be able to control the variables individually for each downloaded app. Is it possible with parse?

Thanks [import]uid: 126619 topic_id: 33391 reply_id: 132749[/import]

Yes I do not see why not. You have control over the data you put in Parse. You could have one database for each app and have a record in the database for each user or something more simple like one database with global variables for all apps or each app. It’s just an online database system. It’s up to you how you use it. [import]uid: 56820 topic_id: 33391 reply_id: 132773[/import]

Hi,
Actually I am new to this kind of work so may be asking too much. Actually there is not much help available for parse corona integration so facing problems. Now I have downloaded parse for corona library from github. Now first I want to ask that can I make calls to parse from corona simulator?
I have created a user object on parse and trying to communicate with from corona simulator but not successful yet. I will be much glad and thankful if some one can give some sample code with explanation.

Thanks [import]uid: 126619 topic_id: 33391 reply_id: 132944[/import]

I personally only briefly looked at the github library. I decided to just write all my own code to access Parse and yes, you can access Parse from the simulator. Below is some basics of how you would access Parse. There are more details to it which you can research on with the Parse REST API docs page located at the link below.

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

Demonstration code:

-- here are some basics for sending network requests to parse.com  
  
local params = {}  
local headers = {}  
  
headers["X-Parse-Application-Id"] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  
-- this will be your app id supplied by parse  
  
headers["X-Parse-REST-API-Key"] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  
-- this will be your rest-api key supplied by parse  
  
headers["Content-Type"] = "application/json" -- json is what parse will expect  
  
params.headers = headers -- set the headers for the network.request  
  
-- GET example showing basic access to parse - for example searching for record(s)  
local postData = {}  
local sendData = {}  
postData.myField = "myData"  
sendData = "?where=" .. URLencode(json.encode(postData))  
network.request( "https://api.parse.com/1/classes/YourDatabase" .. sendData, "GET", myResponder, params)  
  
-- PUT example showing basic request to update a record's information  
local postData = {}  
local sendData = {}  
local SomeRecordID = "objectIDGivenByParse"  
postData.myField = "myData"  
sendData = json.encode(postData)  
params.body = sendData  
network.request( "https://api.parse.com/1/classes/YourDatabase/SomeRecordID", "PUT", myResponder, params)  
-- SomeRecordID is the objectID returned when creating a record or when found via GET  
-- params.body will contain json encoded data matching whatever fields you want updated  
-- in the record  
  
-- POST example showing basic request to create a record  
local postData = {}  
local sendData = {}  
postData.myField = "myData"  
sendData = json.encode(postData)  
params.body = sendData  
network.request( "https://api.parse.com/1/classes/YourDatabase", "POST", myResponder, params) -- this returns the newly created records objectID  
-- params.body will contain json encoded data matching whatever data you want in the  
-- new record  
  
-- DELETE example showing basic request to delete a record  
local SomeRecordID = "objectIDGivenByParse"  
network.request( "https://api.parse.com/1/classes/YourDatabase/SomeRecordID", "DELETE", myResponder, params)  
-- SomeRecordID is the objectID returned when creating a record or when found via GET  

[import]uid: 56820 topic_id: 33391 reply_id: 132991[/import]

Hi,
Actually I am new to this kind of work so may be asking too much. Actually there is not much help available for parse corona integration so facing problems. Now I have downloaded parse for corona library from github. Now first I want to ask that can I make calls to parse from corona simulator?
I have created a user object on parse and trying to communicate with from corona simulator but not successful yet. I will be much glad and thankful if some one can give some sample code with explanation.

Thanks [import]uid: 126619 topic_id: 33391 reply_id: 132944[/import]

I personally only briefly looked at the github library. I decided to just write all my own code to access Parse and yes, you can access Parse from the simulator. Below is some basics of how you would access Parse. There are more details to it which you can research on with the Parse REST API docs page located at the link below.

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

Demonstration code:

-- here are some basics for sending network requests to parse.com  
  
local params = {}  
local headers = {}  
  
headers["X-Parse-Application-Id"] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  
-- this will be your app id supplied by parse  
  
headers["X-Parse-REST-API-Key"] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  
-- this will be your rest-api key supplied by parse  
  
headers["Content-Type"] = "application/json" -- json is what parse will expect  
  
params.headers = headers -- set the headers for the network.request  
  
-- GET example showing basic access to parse - for example searching for record(s)  
local postData = {}  
local sendData = {}  
postData.myField = "myData"  
sendData = "?where=" .. URLencode(json.encode(postData))  
network.request( "https://api.parse.com/1/classes/YourDatabase" .. sendData, "GET", myResponder, params)  
  
-- PUT example showing basic request to update a record's information  
local postData = {}  
local sendData = {}  
local SomeRecordID = "objectIDGivenByParse"  
postData.myField = "myData"  
sendData = json.encode(postData)  
params.body = sendData  
network.request( "https://api.parse.com/1/classes/YourDatabase/SomeRecordID", "PUT", myResponder, params)  
-- SomeRecordID is the objectID returned when creating a record or when found via GET  
-- params.body will contain json encoded data matching whatever fields you want updated  
-- in the record  
  
-- POST example showing basic request to create a record  
local postData = {}  
local sendData = {}  
postData.myField = "myData"  
sendData = json.encode(postData)  
params.body = sendData  
network.request( "https://api.parse.com/1/classes/YourDatabase", "POST", myResponder, params) -- this returns the newly created records objectID  
-- params.body will contain json encoded data matching whatever data you want in the  
-- new record  
  
-- DELETE example showing basic request to delete a record  
local SomeRecordID = "objectIDGivenByParse"  
network.request( "https://api.parse.com/1/classes/YourDatabase/SomeRecordID", "DELETE", myResponder, params)  
-- SomeRecordID is the objectID returned when creating a record or when found via GET  

[import]uid: 56820 topic_id: 33391 reply_id: 132991[/import]

Hi anderoth,

Thanks a lot for help. Now I am successfully communicating with parse. I have created, updated and deleted objects at parse through corona. Now I am facing some problem while reading the values. Actually I can do the read operation and get the values but I am not able to load the values in local variables. Please guide me about how can I load the values from parse in local variables. I will thankful for help. [import]uid: 126619 topic_id: 33391 reply_id: 134036[/import]

Hi anderoth,

Thanks a lot for help. Now I am successfully communicating with parse. I have created, updated and deleted objects at parse through corona. Now I am facing some problem while reading the values. Actually I can do the read operation and get the values but I am not able to load the values in local variables. Please guide me about how can I load the values from parse in local variables. I will thankful for help. [import]uid: 126619 topic_id: 33391 reply_id: 134036[/import]

Hello rhmueed,

you find solution for your problem?

Hello rhmueed,

you find solution for your problem?