public static WWW POST(string details) { details = QuerySorter(details); Debug.Log(details); Query query = new Query(); string jsonData = ""; WWWForm form = new WWWForm(); query = new Query { query = details }; jsonData = JsonUtility.ToJson(query); byte[] postData = Encoding.ASCII.GetBytes(jsonData); Console.WriteLine(Encoding.UTF8.GetString(postData)); Dictionary <string, string> postHeader = form.headers; if (postHeader.ContainsKey("Content-Type")) { postHeader.Add("Authorization", authToken); postHeader["Content-Type"] = "application/json"; } else { postHeader.Add("Content-Type", "application/json"); } WWW www = new WWW(url, postData, postHeader); instance.StartCoroutine(WaitForRequest(www)); queryStatus = Status.Loading; return(www); }
public static void POST(string details) { details = details.Replace("{NAME}", pokemonName); var query = new Query { query = details }; instance.StartCoroutine(GraphQlPost(url, JsonUtility.ToJson(query))); queryStatus = Status.Loading; }