Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server 500 Error #8

Open
dkrancer opened this issue Mar 7, 2022 · 0 comments
Open

Server 500 Error #8

dkrancer opened this issue Mar 7, 2022 · 0 comments

Comments

@dkrancer
Copy link

dkrancer commented Mar 7, 2022

I am getting a server error when I try to get the request response (request.GetResponseAsync)

WebRequest request = WebRequest.Create("https://play.ht/api/v1/convert");
           request.Method = "POST";
               request.ContentType = "application/json";
               request.Headers.Set("Authorization", "authkey");
               request.Headers.Set("X-User-ID", "userid");

               using (var streamWriter = new StreamWriter(request.GetRequestStream()))
               {
                   string json = "{\"voice\":\"es-ES-Standard-A\"," +
                                 "\"content\":\"What is the weather today\"}";

                   streamWriter.Write(json);
               }

  WebResponse response = await request.GetResponseAsync();
               Console.WriteLine(((HttpWebResponse)response).StatusDescription);
              
                  using (var dataStream = new StreamReader(response.GetResponseStream()))
               {
                      string responseFromServer = dataStream.ReadToEnd();
                 
        Console.WriteLine("Server Response: " + responseFromServer);
               }

          
               response.Close();
          
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant