/// <summary> /// Makes an API call to the base URL defined in AppData.cs using the POST method. /// </summary> /// <param name="url">The API function to hit.</param> /// <param name="jsonString">Any necesary data required to make the call.</param> /// <returns>The string response returned from the API call.</returns> public static async Task <string> MakeApiCallPost(string url, string jsonString, bool showDialog) { var httpClient = new HttpClient(); Uri uri = new Uri(URL_BASE_SECURE + url); var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, uri); httpRequestMessage.Headers.Add("User-Agent", "HudlWin8/1.0.0"); httpRequestMessage.Content = new StringContent(jsonString); httpRequestMessage.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); var response = await httpClient.SendAsync(httpRequestMessage); //response.StatusCode 404 500 401 if (!response.IsSuccessStatusCode) { APIExceptionDialog.ShowStatusCodeExceptionDialog(response.StatusCode.ToString(), uri.ToString()); return(null); } return(await response.Content.ReadAsStringAsync()); }