I Have this problem when trying to add a product to cart:
{"message":"No such entity with %fieldName = %fieldValue","parameters":{"fieldName":"cartId","fieldValue":null}}
My API:
POST
on:
https://domain.com/rest/V1/guest-carts/ce7b9f063fb07fcb03d71a2eff922d8d/items?cartItem[sku]=1508110&cartItem[qty]=1&cartItem[quote_id]=353
-
ce7b9f063fb07fcb03d71a2eff922d8d
is the cart-key which I got through API: -
quote_id = 353
is the id which I got from cart details through API:GET
http://domain.com/rest/V1/guest-carts/ce7b9f063fb07fcb03d71a2eff922d8d
Please help.
Best Answer
You can refer to the offical swagger documentation : http://devdocs.magento.com/swagger/index_20.html#/
1/ You need to create a guest cart :
Which return a guest cart id such as
881d962b14c14764a0f5939be4722cbc
.2/ (Optional) Retrieve the quote id from this API call :
Where a field id correspond to the quote id, for example
"id": 31
.3/ Add a product to your cart :
The payload pattern is :
An example for a basic configurable product :
Magento uses both cartId and quoteId that referece on different internal id.