Created
November 28, 2016 17:38
-
-
Save eprugh/7e028c85e94daefc5cdcc4b446eef893 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Common testing requirement. If you are consuming an API in a sandbox/test region, uncomment this line of code ONLY for non production uses. | |
//System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; | |
//Be sure to run "Install-Package Microsoft.Net.Http" from your nuget command line. | |
using System; | |
using System.Net.Http; | |
var baseAddress = new Uri("https://private-anon-6009d9f50c-pactsafe.apiary-mock.com/"); | |
using (var httpClient = new HttpClient{ BaseAddress = baseAddress }) | |
{ | |
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("authorization", "Bearer {access_token}"); | |
using (var content = new StringContent("{ \"name\": \"New Request\", \"description\": \"This is an internal description of the request\", \"subject\": \"Subject line for email\", \"message\": \"Message to signers\", \"signing_order\": false, \"invite_only\": true}", System.Text.Encoding.Default, "application/json")) | |
{ | |
using (var response = await httpClient.PostAsync("undefined", content)) | |
{ | |
string responseData = await response.Content.ReadAsStringAsync(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment