Last active
July 26, 2019 15:32
-
-
Save nspeet/3bdb3327beb4f93b0c7d227424f2200d to your computer and use it in GitHub Desktop.
HTTP request C#
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
// Create Cart | |
using (var client = new HttpClient()) | |
{ | |
// assembledEndpoint: {{host}}/{{projectKey}}/me/carts | |
var endpoint = assembledEndpoint; | |
var body = new Dictionary<string, string> | |
{ | |
{ "currency", "USD" }, | |
{ "shippingAddress", { | |
"country": "US" | |
} | |
}, | |
}; | |
var content = new FormUrlEncodedContent(body); | |
var response = await client.PostAsync(endpoint, content); | |
var responseString = await response.Content.ReadAsStringAsync(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment