Importing Inventories
Create and update InventoryEntries in your Project.
The Inventory data to import is represented by InventoryImport and included in an InventoryImportRequest, which is imported using Import Inventory.
Representations
InventoryImportRequest
The request body to import Inventories. Contains data for InventoryEntries to be created or updated in a commercetools Project.
type | "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. If an InventoryEntry with this 2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
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 |
application/jsonapplication/jsoncurl 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"}]}