Skip to content

Step 10. Unassign the product from the default source [Web API Tutorial]

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

At the moment of writing this tutorial any product that is created is automatically assigned to the Default Source. It is normal and expected behaviour but this is not what we want.

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

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

Payload

{
	"sourceItems": [{
		"sku": "Simple Running Backpack",
		"source_code": "default"
	}]
}

Response
Magento returns an empty array.
[]

Complete cURL request sample

source_code_1="default" && curl -X POST "$endpoint/all/V1/inventory/source-items-delete" \
 -H "Content-Type: application/json" \
 -H "Authorization: Bearer $admin_token" \
 -d '{"sourceItems":[{"sku":"'"$simple_product_SKU"'","source_code":"'"$source_code_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