Created
March 19, 2017 06:54
-
-
Save JoachimL/16cedc5d5e45773a41b758ae47b40121 to your computer and use it in GitHub Desktop.
Add product to kolonial cart
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
public static async Task AddProductToCartAsync(HttpClient httpClient, KolonialProduct kolonialProduct, TraceWriter log) | |
{ | |
var productsJson = JsonConvert.SerializeObject( | |
new { items = new []{ new { product_id = kolonialProduct.Id, quantity = 1 } }}); | |
log.Info($"Updating Kolonial with {productsJson}"); | |
var response = await httpClient.PostAsync( | |
"https://kolonial.no/api/v1/cart/items/", | |
new StringContent(productsJson, Encoding.UTF8, "application/json")); | |
response.EnsureSuccessStatusCode(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment