Closed Clint66 closed 5 years ago
C# without RestClient
var request = WebRequest.CreateHttp("https://api.whispir.com/messages?apikey=<REPLACE_ME>"); request.Method = "POST"; request.ContentType = "application/vnd.whispir.message-v1+json"; request.Accept = "application/vnd.whispir.message-v1+json"; request.Headers.Add("authorization", "<REPLACE_ME>"); var bytes = Encoding.UTF8.GetBytes("{\"to\":\"<REPLACE_ME>\",\"subject\":\"<REPLACE_ME>\",\"body\":\"<REPLACE_ME>\"}"); request.ContentLength = bytes.Length; using (var stream = request.GetRequestStream()) { stream.Write(bytes, 0, bytes.Length); try { using (var response = request.GetResponse()) { var result = (new StreamReader(response.GetResponseStream())).ReadToEnd(); } } catch (WebException wex) { using (var response = wex.Response) { var error = (new StreamReader(response.GetResponseStream())).ReadToEnd(); } } }
Cleaning up old issues, so closing this out, this should be raised on HTTPSnippet if it is still an issue. Thank you!
C# without RestClient