Create or import initial product availability data for the locations and location groups.
If possible, use the headless Commerce API as described in Inventory Impex in B2C Commerce API Reference.
To create an inventory data file, format the data as a series of JSON entries representing locations and individual inventory records.
Considerations for inventory import data include:
- Separate the top-level entries with line feeds, not commas. Each entry must be on a single line.
- The mode is assumed to be UPDATE.
- Each inventory record entry requires a unique recordId. Best practice is to use a UUID. The record Id protects against importing duplicate data.
- Each inventory record entry requires an effectiveDate.
- Each futures entry requires a nonzero quantity and a future expectedDate.
- The system only creates or updates entries that are included in the data. It doesn’t delete entries that aren’t included. However, if an included entry has an empty value, that value is deleted.
- If you make any changes to your location graph, don’t import inventory data while the changes are in progress. If you have scheduled imports, pause them until the changes are complete.
- To avoid overselling during the initial implementation period, we recommend defining safety stock levels.
- Inventory data file restrictions differ according to the API used for upload:
- Headless Commerce API
- File Size Limit: 100 MB
- Allowed File Formats: JSON, GZIP
- Core Connect API (Apex or REST)
- File Size Limit: 10 MB
- Allowed File Format: JSON
- Headless Commerce API
The following example illustrates the data format. For readability, the example shows the first few entries on multiple lines. In the import file, each inventory record entry must be on a single line.
{
// unique identifier for the inventory record
"recordId":"0a87539d-f3dd-47bc-91c7-9c752e39dbe0",
"onHand":10,
"sku":"12389156",
"effectiveDate":"2020-12-08T14:05:22.790896-07:00",
"futures":[ // list of future restocks
{
"quantity":1,
"expectedDate":"2021-04-18T14:05:22.781-07:00"
},
{
"quantity":5,
"expectedDate":"2021-05-18T14:05:22.781-07:00"
}
],
"safetyStockCount":0,
"locationId":"Warehouse-A"
}
{
"recordId":"0a87539d-f3dd-47bc-91c7-9c752e312345",
"onHand":10,
"sku":"9485728",
"effectiveDate":"2020-12-08T14:05:22.790896-07:00",
"futures":[
{
"quantity":10,
"expectedDate":"2021-04-18T14:05:22.781-07:00"
}
],
"safetyStockCount":0,
"locationId":"Warehouse-A"
}
{"recordId":"0a87539d-f3dd-47bc-91c7-9c752e39dbe0","onHand":10,"sku":"sku1","effectiveDate":"2020-04-08T14:05:22.790896-07:00","futures":[{"quantity":1,"expectedDate":"2020-04-18T14:05:22.781-07:00"}],"safetyStockCount":0,"locationId":"Warehouse-B"}
{"recordId":"3127e2ad-748b-459a-917c-78bef741602c","onHand":10,"sku":"sku1","effectiveDate":"2020-04-08T14:05:22.790896-07:00","futures":[{"quantity":1,"expectedDate":"2020-04-18T14:05:22.781-07:00"}],"safetyStockCount":0,"locationId":"Warehouse-B"}
{"recordId":"b709e7a8-7d4f-4458-be0c-a88f1e594f1d","onHand":10,"sku":"sku2","effectiveDate":"2020-04-08T14:05:22.790896-07:00","futures":[{"quantity":1,"expectedDate":"2020-04-18T14:05:22.781-07:00"}],"safetyStockCount":0,"locationId":"Warehouse-B"}
To upload the file to Omnichannel Inventory, first request an upload URI by making a POST call to this endpoint. Specify the fileName in the request payload.
/organizations/TenantGroupId/availability-records/imports/
For information about other request parameters, such as link time to live and file encoding format, see the B2C Commerce API Reference.
The response includes these values:
- importId—A UUID representing the data import.
- importStatusLink—A unique endpoint you can use to retrieve the status of the data upload.
- uploadLink—The unique endpoint you use to upload the data file.
- uploadMethod—Always POST.
- uploadLinkExpirationUTC—The time when the upload link expires. If you don’t upload the data by that time, you must request a new import.
To start the upload, make a POST call to the uploadLink URI and include the import file as the payload.
To retrieve the status of the upload, make a GET call to the importStatusLink URI.
After creating or importing the initial inventory data, set up ongoing inventory data imports with your external inventory management system using the Omnichannel Inventory APIs.