Magento 2 – Fix for GET V1/guest-carts/{cartId}/items Not Working

magento2rest

1-Create cart with POST /rest/default/V1/carts/. It returns cartId = 13

2-Invoked GET V1/guest-carts/13/items

3-Get error
rest/default/V1/guest-carts/13/itemsresulted in a404 Not Found` response: {"message":"No such entity with %fieldName = %fieldValue","parameters":{"fieldName":"cartId","fieldValue":null}}

Magento 2.1.1
Please help.

Best Answer

Your POST command created a cart with an admin token, I believe. Guest carts are for anonymous users, so you made the wrong GET call.

Use GET V1/carts/{cartId} if you want to create a cart with an admin token, or use POST V1/guest-carts to create a cart for an anonymous user.

Related Topic