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?”

Get All Sales/Cart rules associated with product by REST API Magento 2.

You can retrieve all the Sales rules that are related to the given product by Cart Price Rule Search REST API in Magneto.

Let’s say product SKU “A10001” is associated with two different cart price rules and you want to fetch a list of all the sales rules that are associated with the given SKU.

Magento native supports Cart Rule Search Rest API which will be helpful to fetch products associated with cart rules. Continue reading “Get All Sales/Cart rules associated with product by REST API Magento 2.”