Question

Hi I am following this flow to add products to a guest cart:

1.Create a guest cart (this will give me the cartID)-> POST: http://192.168.1.5:8100/magento/index.php/rest/V1/guest-carts

2. Get cart details-> GET: http://192.168.1.5:8100/magento/index.php/rest/V1/guest-carts/{cartID}

3. add items to cart-> POST: http://192.168.1.5:8100/magento/V1/guest-carts/19/items

BODY: {
  "cartItem": {
      "sku" : "For JAIIB Principles and Practices Of Banking (English) ",
  "qty": 1,
"quoteId":19
}
}

3rd step gives 404 not found. IS there something missing?

UPDATE:

The endpoint was wrong for the third request. But also, the first request generates the guest cartID, something like this 6089be92f22d8cd70f24d33d3588c1c2. We need this cart id to be added as a quoteId parameter for the third request. Not the "id" received in the 2nd request. If it was for a customer (not guest) then we would use the "id" instead.

Was it helpful?

Solution

index.php/rest part is missing in third request, try POST http://192.168.1.5:8100/magento/index.php/rest/V1/guest-carts/19/items

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top