Importing Inventories
This endpoint can be used to import inventory data to create and update InventoryEntry in a Project.
The Inventory data to import is represented by InventoryImport and loaded in InventoryImportRequest, which is posted to import Inventory.
To monitor an import status, use Get ImportSummary, Get ImportOperation, and Query ImportOperations.
Representations
InventoryImportRequest
The request body to import Inventories. Contains data for InventoryEntries to be created or updated in a commercetools Project.
typeString | "inventory"The inventory import resource type. |
resourcesArray of InventoryImport | The inventory import resources of this request. MaxItems:20 |
{"type" : "inventory","resources" : [ {"key" : "inventory-import-key","sku" : "product-variant-sku","quantityOnStock" : 15,"restockableInDays" : 2,"expectedDelivery" : "2022-06-30T14:00:00.000Z","supplyChannel" : {"typeId" : "channel","key" : "channel-key"},"custom" : {"type" : {"typeId" : "type","key" : "custom-field-key"},"fields" : {"theNameofTheInventoryCustomField" : {"type" : "LocalizedString","value" : {"en" : "English text","de" : "German text"}}}}} ]}
InventoryImport
The data representation for an Inventory to be imported that is persisted as a Inventory in the Project.
keyString | User-defined unique identifier. |
skuString | Maps to |
quantityOnStockInt | Maps to |
restockableInDaysInt | Maps to |
expectedDelivery | Maps to |
supplyChannel | Maps to |
custom | Maps to |
Import Inventory
Creates a request for creating new Inventories or updating existing ones.
manage_products:{projectKey}regionString | The Region in which the Project is hosted. |
projectKeyString | The Project key. |
importContainerKeyString | The ImportContainer used to create the new resource |
curl -X POST https://import.{region}.commercetools.com/{projectKey}/inventories/import-containers/{importContainerKey} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}' \--header 'Content-Type: application/json' \--data-binary @- << DATA{"type" : "inventory","resources" : [ {"key" : "inventory-import-key","sku" : "product-variant-sku","quantityOnStock" : 15,"restockableInDays" : 2,"expectedDelivery" : "2022-06-30T14:00:00.000Z","supplyChannel" : {"typeId" : "channel","key" : "channel-key"},"custom" : {"type" : {"typeId" : "type","key" : "custom-field-key"},"fields" : {"theNameofTheInventoryCustomField" : {"type" : "LocalizedString","value" : {"en" : "English text","de" : "German text"}}}}} ]}DATA
{"operationStatus" : [ {"state" : "processing","operationId" : "252c6ed3-c668-4610-afe9-87b9255e62e0"} ]}