Skip to content

Step 11. Assign the product to another source [Web API Tutorial]

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

Replace the value of sku property to adapt this to your needs.

Endpoint
POST http://<host>/rest/all/V1/inventory/source-items

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

Payload

{
  "sourceItems": [
    {
      "sku": "Simple Running Backpack",
      "source_code": "txspeqs",
      "quantity": 250,
      "status": 1
    }
  ]
}

Response
Magento returns an empty array.
[]

Complete cURL request sample

source_code_1="default" && curl -X POST "$endpoint/all/V1/inventory/source-items" \
 -H "Content-Type: application/json" \
 -H "Authorization: Bearer $admin_token" \
 -d '{"sourceItems":[{"sku":"'"$simple_product_SKU"'","source_code":"'"$source_code_2"'","quantity":250,"status":1}]}'

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