0

I'm pretty weak at HTTP requests and im trying to practice my skills in it, however im really stuck.. i have googled and searched and tried but yet here i am... I have made task for my self Where i want to fetch all this data from the api as json and use the data. I can't see to get the data.

I'm trying to

  1. Request From server

  2. Get JSON Response from it

  3. Use the JSON as i want.

However i'm even failing at step 1...

Here's what im doing:-

I need to get the json from this url > URL JSON RESPONSE CLICK

and i just want to get the json in the unity.

I'm trying to make a HTTP request but it's failing

 private void GetJSONFromWeb()
{
    HttpWebRequest request =
    (HttpWebRequest)WebRequest.Create("https://ow-api.com/v1/stats/pc/eu/Epzz-2845/profile");
    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    StreamReader reader = new StreamReader(response.GetResponseStream());
    string jsonResponse = reader.ReadToEnd();
    object info = JsonUtility.FromJson<object>(jsonResponse);

    Debug.Log(info);

}

and i get a

TlsException: The authentication or decryption has failed.

I have tried several solutions including THIS and doesn't work... i'm really

I Dont want to use Unity API, i want to use HTTP request and .net

Programmer
  • 121,791
  • 22
  • 236
  • 328
Nanopl
  • 77
  • 1
  • 13
  • Why Duplicate? The link you provided is unity api – Nanopl May 22 '18 at 12:09
  • It's a duplicate because you are asking how to make restful request. Yes, the link I provided uses Unity API because this question has the Unity tag and is also using Unity's `JsonUtility` API. – Programmer May 22 '18 at 12:13
  • But i want to use the HTTP and not the Unity api. i know it has the unity tag in it. but for my purposes i want to learn the HTTP way not the untiy way.. – Nanopl May 22 '18 at 12:14
  • and HTTP is fully achievable in unity – Nanopl May 22 '18 at 12:14
  • I think you're confused. The Unity's API is also doing an HTTP request. I've decided to change the title and the duplicate link to .NET API. Without changing both, this will mislead new Unity users and make them think that HttpWebRequest is proper way to make http request in Unity. The new link should fix your issue. – Programmer May 22 '18 at 12:30

0 Answers0