cancel
Showing results for 
Search instead for 
Did you mean: 

How to add items to cart using REST API

How to add items to cart using REST API

API: [PUT] http://192.168.1.180/magento/index.php/rest/V1/carts/items/15

 

Headers: Authrorization, Bearer Token

 

Error: "message": "Request does not match any route."

 

A put request to add item ID 15 to my cart. Any idea whats wrong ?

2 REPLIES 2

Re: How to add items to cart using REST API

api call is wrong

if it is PUT then  /V1/carts/{cartId}/items/{itemId} 

and if it is POST  /V1/carts/{cartId}/items

Re: How to add items to cart using REST API

Hi there,

 In magento 2.0 REST API to add item in cart POST api call (/V1/carts/{cartId}/items) is used and to edit the item of the cart PUT api(/V1/carts/{cartId}/items/{itemId}) call is called. You can refer to the below blog to add item into your cart: http://www.ipragmatech.com/magento-mobile-app-shopping-cart/