- Home /
How to use POST service using www class?
I have POST Login Service, I have set the header files and form and sent the request using www class but there is 400 Bad request error. I have recheck edthe parameter i have sent but everything seems fine from my end.
Any help would be appreciated. Please find the code snippet below.
 public IEnumerator LoginBtn()
 {
     Debug.Log("trying to login");
     WWWForm form = new WWWForm();
     form.AddField("username", "ankush");
     form.AddField("password", "123123");
     Dictionary<string, string> headers = form.headers;
     headers["Content-Type"]="application/json";
     headers["Application-Type"]="ANDROID";
     headers["Application-Token"]="AIzaSyBKr8GDKDDmlFg_6bh3sPivP54Hj94332";
     byte[] rawData = form.data;
     Debug.Log("CREATING WWW");
     WWW www = new WWW("http://100.248.100.76:8083/ws/user/loginUser",rawData,headers);
     yield return www;
     Debug.Log("HAVE RESULTS" + www.text);
     //.. process results from WWW request here...
     if (www.error!= null)
     {
         Debug.Log("Erro: " + www.error);
     }
     else
     {
         Debug.Log("All OK");
         Debug.Log("Text: " + www.text);
     }
 }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Necessary Data Rewind Wasn't Possible WWWForm Error 0 Answers
WWW Class is acting up 1 Answer
Use the data received from WWW in UI 1 Answer
WWW+WWWForm 500 Internal Server Error 3 Answers
Screenshot in WebGL 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                