i have an issue with Magento ver. 2.2.0-dev i'm trying to create a cart and insert a product for a logged user, with the magento 2 rest api, but when i try to insert a product into the cart (already correctly created) it seems doesn't work and respond with this error:
"message": "No such entity with %fieldName = %fieldValue",
"parameters": {
"fieldName": "cartId",
"fieldValue": null
},
Steps to reproduce:
Create a cart with get rest/V1/carts/mine
Call the rest api for
insert product in the cart with the correct token of the user at rest/V1/carts/mine/itemsHeaders: Authorization Bearer + [TOKEN]
Body: cartItem: testing (sku of the product); qty: 1
Expected Result
- a 200 status and the json of the cart
Actual Result
{
"message": "No such entity with %fieldName = %fieldValue",
"parameters": {
"fieldName": "cartId",
"fieldValue": null
},
How can i solve?? it's a bug or i forgot something? i've seen a lot of thread but no one can help me.
Thanks in advance!
1 Answer 1
SOLVED!
In postman, we was selecting 'form-data', but you have to select 'raw' and insert a json object like this:
{
"cart_item": {
"quote_id": 5,
"sku": "testing2",
"qty": 1
}
}
that should work! hope it helps.
-
<route url="/V2/order/:orderId" method="GET"> <service class="Custom\Test\Api\OrderDetailsRepositoryInterface" method="getOrderDetails"/> <resources> <resource ref="self" /> </resources> <data> <parameter name="customerId" force="true">%customer_id%</parameter> </data> </route> i using this . then geeting same issue "message": "No such entity with %fieldName = %fieldValue", "parameters": { "fieldName": "orderId", "fieldValue": null }, how to pass row data???Vivek– Vivek2021年05月26日 11:22:35 +00:00Commented May 26, 2021 at 11:22