Skip to content

Step 4. Assign Source to Stock [Web API Tutorial]

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

To assign a source to a stock, you must specify a source_code, stock_id, and priority. The priority value indicates where the stock ranks in the list of stocks that can be used for fulfilling orders.

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

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

Payload

{
   "links" : [
      {
         "source_code" : "txspeqs",
         "stock_id" : "2",
         "priority" : 1
      }
   ]
}

Response
Magento returns empty array.
[]

Complete cURL request

curl -X POST "$endpoint/all/V1/inventory/stock-source-links" \
 -H 'Content-Type: application/json' \
 -H "Authorization: Bearer $admin_token" \
 -d '{"links":[{"stock_id": "'"$stock_id_2"'","source_code":"'"$source_code_2"'","priority":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