Skip to content

Step 3. Create additional Stock [Wb API Tutorial]

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

The stock.name attribute is required.

Endpoint
POST http://<host>/rest/all/V1/inventory/stocks

Headers

Content-Type: application/json
Authorization: Bearer <admin_token>

Payload

{
   "stock" : {
      "name" : "Stock 2"
   }
}

Response
Magento returns the stock_id, which is an integer: 2

Complete cURL request

stock_name_2="Stock 2" && stock_id_2=$(curl -X POST "$endpoint/all/V1/inventory/stocks" \
 -H 'Content-Type: application/json' \
 -H "Authorization: Bearer $admin_token" \
 -d '{"stock":{"name":"'"$stock_name_2"'"}}') && echo $stock_id_2

◀️ 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