Я вызываю API, но он выдает ошибку:
UriFormatException: абсолютный URI слишком короткий
Код, который выдает эту ошибку:
void updatePlayer ()
{
HttpWebRequest httpWebRequest = WebRequest.Create (requestURL) as HttpWebRequest;
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
httpWebRequest.Method = "POST";
httpWebRequest.Headers.Add ("x-api-key", "e1Zdd1YD92aJtpyDaCtSDTZCrDXtv2c9Cf");
string json = "{" +
"'firstName': '100'," +
"'lastName': 'DEF'" +
"}";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) {
streamWriter.Write (json);
}
httpWebRequest.ContentLength = json.Length;
HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse ();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) {
var responseText = streamReader.ReadToEnd ();
//Now you have your response.
//or false depending on information in the response
Debug.Log (responseText);
}
}
Подробнее здесь: https://stackoverflow.com/questions/373 ... ting-error