public IEnumerator RequestCheckApi(System.Action <SkillsModel> callback) { WWWForm form = new WWWForm(); form.AddField("api_key", api_key); form.AddField("api_password", api_password); form.AddField("user_id", user_id); //making the post request using (UnityWebRequest www = UnityWebRequest.Post(EndPoints.GET_SKILLS, form)) { yield return(www.SendWebRequest()); if (www.isNetworkError || www.isHttpError) { SkillsModel mSkillsModel = new SkillsModel(); mSkillsModel.error = true; callback(mSkillsModel); } else { string responseText = www.downloadHandler.text; Debug.Log(responseText); SkillsModel mSkillsModel = JsonUtility.FromJson <SkillsModel>(responseText); JSONNode data = JSON.Parse(responseText); foreach (JSONNode skill in data["skills"]) { SkillModel mSkillModel = new SkillModel(); mSkillModel.skill_id = skill["skill_id"]; mSkillModel.name = skill["name"]; mSkillModel.setClassType(skill["class_type"]); mSkillModel.row = skill["row"]; mSkillsModel.addSkill(mSkillModel); } callback(mSkillsModel); } } }