I’m using Unity 4.5, and build toward Flash.
In that setting, the Parse Plugin for Unity is not supported.
However, I think it should be possible to use Parse via its REST-API.
For that, I’m missing a piece of the puzzle:
How to pass multiple data specified as “-G --data-urlencode” via Unity’s WWW call?
For example, I can sign in a user at Parse with the curl command (at the commandline) that is constructed as:
string strCurl = "curl -X GET ";
strCurl += "-H "X-Parse-Application-Id: {APP_ID}" ";
strCurl += "-H "X-Parse-REST-API-Key: {APP_KEY}" ";
strCurl += "-H "X-Parse-Revocable-Session: 1" ";
strCurl += "-G --data-urlencode ‘username={Username}’ ";
strCurl += "–data-urlencode ‘password={Password}’ ";
strCurl += “https://api.parse.com/1/login”;
strCurl = strCurl.Replace(“{APP_ID}”,strAppId);
strCurl = strCurl.Replace(“{APP_KEY}”,strRestApiKey);
strCurl = strCurl.Replace(“{Username}”,strUsername);
strCurl = strCurl.Replace(“{Password}”,strPassword);
Now, I’d like to mimic this CURL call from Unity.
Right now, I’ve got as far as:
WWWForm form = new WWWForm();
string strUrl = “https://api.parse.com/1/login”;
form.headers[“Method”] = “GET”;
form.headers[“X-Parse-Application-Id”] = strAppId;
form.headers[“X-Parse-REST-API-Key”] = strRestApiKey;
form.headers[“X-Parse-Revocable-Session”] = “1”;
var headers = form.headers;
WWW download = new WWW( strUrl, new byte[ ]{0}, headers );
Obviously, the dummy byte array I’m passing should be replaced with something that represents next lines of the curl example:
strCurl += "-G --data-urlencode ‘username={Username}’ ";
strCurl += "–data-urlencode ‘password={Password}’ ";
Does anyone know how that can be done?