Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add product to kolonial cart
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