Add item to cart for login customer by V1/carts/mine/items REST API Magento 2.

You can add any product type to the cart by REST API in Magento 2 using V1/carts/mine/items endpoint with a custom token as a Header parameter.

This API is useful when you add items to the cart with a third-party platform for the logged-in customer.

To run successfully with this API, you first need to generate a customer token that we have to pass to the Header parameter in the call request. Continue reading “Add item to cart for login customer by V1/carts/mine/items REST API Magento 2.”

How to Get/Create Customer Active Quote Id by V1/carts/mine REST API Magento 2?

Magento Create an empty cart for login customer by REST API, You need to first fetch the current customer active quote id by V1/carts/mine endpoint.

By using given endpoint, You will get the current customer quote id with a simple API and if the customer doesn’t have any active cart, it will create an empty cart with the use of API.

Action: POST

Header: Authorization: Bearer <CUSTOMER_TOKEN> 
You can check the link to Generate Customer Token by Rest API.

URL: https://magento.test/rest/V1/carts/mine

Payload: null

Response: Quote ID. (Example: 12 Here 12 is the quote id for the customer.)

The response of the API will be helpful to add items to the cart for the login customer with Rest API.

How to update product images by REST Web API Magento 2?

You can upload product images by REST API Magento with the PUT action and the help of /V1/products/<sku>.

Action: PUT

URL: <BASE_URL>/rest/V1/products/<SKU>
(Example URL: https://magento.test/rest/V1/products/my-sku)

Header: Authorization: Bearer <ADMIN TOKEN> Continue reading “How to update product images by REST Web API Magento 2?”