Skip to content

Magento 2.2 REST API Add Item to cart issue #8620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
FreshHaze opened this issue Feb 20, 2017 · 2 comments
Closed

Magento 2.2 REST API Add Item to cart issue #8620

FreshHaze opened this issue Feb 20, 2017 · 2 comments
Assignees

Comments

@FreshHaze
Copy link

Hi all! 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:

  1. Create a cart with get rest/V1/carts/mine
  2. Call the rest api for insert product in the cart with the correct token of the user at rest/V1/carts/mine/items
  3. Headers: Authorization Bearer + [TOKEN]
  4. Body: cartItem: testing (sku of the product); qty: 1

Expected Result

  1. 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!

@FreshHaze
Copy link
Author

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.

@mbrinton01
Copy link

Glad you were able to solve the issue. Closing.

magento-devops-reposync-svc pushed a commit that referenced this issue Nov 28, 2023
ACPT-1669: GraphQl\Config & Search\Request\Config need to be cleaned when attributes change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants