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!

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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