Skip to content

Add a simple product to a cart [Web API Tutorial]

Ievgen Shakhsuvarov edited this page Jul 16, 2019 · 7 revisions

To add a simple product to a cart, you must provide SKU, the quantity, and the quote ID, which was generated when the cart was created.

Endpoint
POST http://<host>/rest/test/V1/carts/mine

Headers
Content-Type application/json Authorization Bearer <customer token>

Payload
None

Response Magento returns the quote_id, which is an integer: 1

Complete cURL request sample

curl -X POST "$endpoint/test/V1/carts/mine/items" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $customer_token" \
-d '{"cartItem":{"sku":"'"$simple_product_SKU"'","qty":1,"quote_id":"'"$cart_id"'"}}' | json_pp

◀️ Previous Step 📖 Table of Contents Next Step ▶️

MSI Documentation:

  1. Technical Vision. Catalog Inventory
  2. Installation Guide
  3. List of Inventory APIs and their legacy analogs
  4. MSI Roadmap
  5. Known Issues in Order Lifecycle
  6. MSI User Guide
  7. DevDocs Documentation
  8. User Stories
  9. User Scenarios:
  10. Technical Designs:
  11. Admin UI
  12. MFTF Extension Tests
  13. Weekly MSI Demos
  14. Tutorials
Clone this wiki locally