1

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/items

  • Headers: 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!

asked Feb 20, 2017 at 13:44

1 Answer 1

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.

answered Feb 20, 2017 at 14:28
1
  • <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??? Commented May 26, 2021 at 11:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.