0

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.

1
  • 1
    Just FYI, encrypted cart ID is used in guest API to prevent your cart being stolen. If ordinary ID is used, it is possible to create a cart, see current ID and steal carts with adjacent IDs. Commented Jan 5, 2016 at 7:43

1 Answer 1

0

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

1
  • Can you verify that this works on magento 2.1?
    – Mackelito
    Commented Aug 26, 2016 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.