.NET


Installing & Making a Request

Please download this entire unirest-net library and reference it in your project.

C#
Task<HttpResponse<MyClass>> response = Unirest.post(API_URL)
.header("X-Mashape-Key", API_KEY)
.header("Content-Type", "application/x-www-form-urlencoded")
.asJson();
Asynchronous Requests
C#
Task<HttpResponse<MyClass>> myClassTask = Unirest.post(API_URL)
  .header("X-Mashape-Key", API_KEY)
  .header("Content-Type", "application/x-www-form-urlencoded")
  .asJsonAsync<MyClass>();
File Uploads
C#
Task<HttpResponse<MyClass>> response = Unirest.post(API_URL)
  .header("X-Mashape-Key", API_KEY)
  .header("Content-Type", "application/x-www-form-urlencoded")
  .field("content", File.ReadAllBytes(@"/path/to/file"))
  .asJson();