Last active
July 26, 2019 15:30
-
-
Save nspeet/ae4d5b00c15703ebe715024afd217cbe to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// add line item to Cart | |
using (var client = new HttpClient()) | |
{ | |
// assembledEndpoint: {{host}}/{{projectKey}}/me/carts/cartId | |
var endpoint = assembledEndpoint; | |
var body = new Dictionary<string, string> | |
{ | |
{ "version", "1" }, | |
{ "actions": [{ | |
"action": "addLineItem", | |
"productId": "f5635f84-7c0b-4df7-8ea2-5134911cd5ea", | |
"variantId": 1 | |
}] | |
}, | |
}; | |
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