0

I am working on unity webgl build on our existing IOS running app. All the data about users are saving on Parse. I have implemented Rest API to communicate with Parse. Implemented Get and Post(without passing the method header) they are working fine but when i am trying to update the data using PUT :

string url = "https://api.parse.com/1/"
string ObjectID = "ERd99Q0kmd"

string CallLink = url + "classes/PlayerProfile/" + ObjectID ;
            string jsonString = "{\"TotalCoins\":40}";

            WWWForm form = new WWWForm();
            var headers = form.headers;
            headers["X-Parse-Application-Id"] = appID;
            headers["X-Parse-REST-API-Key"] = restapikey;
            headers["Content-Type"] = "application/json";
            headers["Content-Length"] = jsonString.Length.ToString();

            var encoding = new System.Text.UTF8Encoding();

            WWW www = new WWW(CallLink,encoding.GetBytes(jsonString),headers);

            yield return www;
            if (www.error != null)
            {
                Debug.Log( "CallGet:Error:"+www.error);
            }
            else
            {
                Debug.Log("CallGet:Success:"+www.text);
            }

It gives Bad Request error. I also tried the header "Method" it also give Bad Request but when i tried "X-HTTP-Method-Override" it works in unity editor but still it doesn't working in Browser and getting following Error :

Request header field X-HTTP-Method-Override is not allowed by Access-Control-Allow-Headers in preflight response.

Please help me out how can i update the data.

gman
  • 100,619
  • 31
  • 269
  • 393
  • You know that Parse is **closing down** ??? Most are change to Firebase, which is about the same. – Fattie Feb 18 '16 at 17:36
  • Yup i know that but our WebGL build was around the corner when parse announced the closing down. So we have decided that for now we should create build of WebGL with Parse and make it live and after that we switch to some thing else like Firebase and then upload a version 2 of the app. – Umair Bhatti Feb 19 '16 at 07:05

0 Answers0