ZRPL
  • Welcome!
  • Quick Start
  • Reference
    • API Reference
      • Categories List
      • Category Details by ID
      • Create Simple Product
      • Config Product Creation
      • Product List
      • Update Existing Product
      • Product Details by SKU
      • Product Details by ID
      • Products in Category
      • Create Order
      • Order Details
      • Order History
      • Create Customer
      • Customer Token
      • Create Customer Cart
      • Add Item to Cart
      • View Cart
      • Update Cart
      • Delete Cart
      • Country Code
      • Set Shipping and Billing
      • Place Order
      • Customer Details
Powered by GitBook
On this page
  1. Reference
  2. API Reference

Add Item to Cart

This API is offering to add items to the cart.

POST {{Base_url}}/rest/V1/carts/mine/items

The endpoint /rest/V1/carts/mine/items is used to add an item to the customer’s shopping cart in a Magento-based system. The mine keyword ensures the action is performed on the cart of the currently authenticated customer.

Body

{
  "cartItem": {
    "sku": "IFPZMB-RD0",
    "qty": 1,
    "quote_id": "615982"
  }
}
curl --location '{{Base_url}}/rest/V1/carts/mine/items' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJraWQiOiIxIiwiYWxnIjoiSFMyNTYifQ.eyJ1aWQiOjIxMDAyNywidXR5cGlkIjozLCJpYXQiOjE3Mzc0NjQ1NTYsImV4cCI6MTczNzQ2ODE1Nn0.PUmQFwFrXoWtuBJrBifTJ5NtCc05OCO4mcqws7IK6ys' \
--header 'Cookie: PHPSESSID=2639naaq26nbe7st472kk4ms4i' \
--data '{
  "cartItem": {
    "sku": "IFPZMB-RD0",
    "qty": 1,
    "quote_id": "615982"
  }
}
'

cartItem: This object represents an item to be added to the cart.

  • sku: The Stock Keeping Unit (SKU) is a unique identifier for the product. Example: "IFPZMB-RD0". It helps identify the product being added to the cart.

  • qty: The quantity of the item being added to the cart. Example: 1, indicating that one unit of the item should be added.

  • quote_id: The quote ID represents the current cart (quote). It is a unique identifier for the shopping cart/quote. Example: "615982" refers to the cart that this item is being added to.

Responses

{
    "item_id": 97337,
    "sku": "IFPZMB-RD0",
    "qty": 1,
    "name": "iFrogz Audio- Ear Pollution Plugz with Mic - Red",
    "price": 399,
    "product_type": "simple",
    "quote_id": "615982"
}

Response Attributes:

1. item_id:

  • Value: 97337

  • Explanation: The unique identifier for the specific item in the cart. This ID is assigned when the item is added to the cart and is used to manage the cart items (e.g., updating or removing an item).


2. sku:

  • Value: "IFPZMB-RD0"

  • Explanation: The Stock Keeping Unit (SKU) is a unique code for the product. It helps identify the product in the catalog and ensures that the correct item has been added to the cart.


3. qty:

  • Value: 1

  • Explanation: The quantity of this specific item in the cart. In this case, one unit of the product is included.


4. name:

  • Value: "iFrogz Audio- Ear Pollution Plugz with Mic - Red"

  • Explanation: The name of the product added to the cart. This is a human-readable description of the product for display purposes.


5. price:

  • Value: 399

  • Explanation: The price of a single unit of the product. This is the base price fetched from the product catalog, excluding any discounts or tax adjustments.


6. product_type:

  • Value: "simple"

  • Explanation: The type of product added to the cart.

    • simple: A standalone product with no configurable options.

    • Other possible values include configurable, grouped, or bundle for more complex products.


7. quote_id:

  • Value: "615982"

  • Explanation: The unique identifier for the customer’s cart (also called a "quote"). This ID links the item to a specific shopping cart instance for the authenticated user. It is used for cart operations like adding more items or proceeding to checkout.

{
    "message": "The consumer isn't authorized to access %resources.",
    "parameters": {
        "resources": "self"
    }
}
{
    "message": "Request does not match any route.",
    "trace": null
}
PreviousCreate Customer CartNextView Cart

Last updated 4 months ago