POST-запрос

Вы уже всё знаете. По-этому, сразу к коду.

            var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://gql.twitch.tv/gql");
            httpWebRequest.ContentType = "application/json";
            httpWebRequest.Headers.Add("Client-ID", "kimne78kx3ncx6brgo4mv6wki5h1ko");
            httpWebRequest.Method = "POST";
            using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                string body = "{\"operationName\": \"PlaybackAccessToken\", \"extensions\": {\"persistedQuery\"" +
                    " {\"version\": 1, \"sha256Hash\": \"0828119ded1c13477966434e15800ff57ddacf13ba1911c129dc2200705b0712\"}}," +
                    " \"variables\": {\"isLive\": true, \"login\": \"kkkkk\", \"isVod\": false, \"vodID\": \"\", \"playerType\": \"embed\"}}";
                streamWriter.Write(body);
            }
            try
            {
                var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
                using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                {
                    var result = streamReader.ReadToEnd();
                    MessageBox.Show(result);
                }
            }
            catch (WebException ex)
            {
                if (ex.Status == WebExceptionStatus.ProtocolError)
                {
                    HttpWebResponse httpWebResponse = (HttpWebResponse)ex.Response;
                    MessageBox.Show(ex.Message);
                }
            }

В фиддлере написано:

POST https://gql.twitch.tv/gql HTTP/1.1
Content-Type: application/json
Client-ID: kimne78kx3ncx6brgo4mv6wki5h1ko
Host: gql.twitch.tv
Content-Length: 272
Expect: 100-continue
Connection: Keep-Alive

{"operationName": "PlaybackAccessToken", "extensions": {"persistedQuery" {"version": 1, "sha256Hash": "0828119ded1c13477966434e15800ff57ddacf13ba1911c129dc2200705b0712"}}, "variables": {"isLive": true, "login": "kkkkk", "isVod": false, "vodID": "", "playerType": "embed"}}

ответ:

{
  "error": "Bad Request",
  "status": 400,
  "message": "invalid character '{' after object key"
}

Почти заработало! Чего еще не хватает?

Нет :

image

Я уже увидел . Я очень сильно опаздываю, просто.