When you create a new inventory location, it initially has no inventory data associated with it. You can use the createInventory
endpoint to set inventory values for a specific SKU at the location. For example, the following request specifies inventory data for the location created in the previous section:
POST /ccadmin/v1/inventories HTTP 1.1
Authorization: Bearer <access_token>
{
"locationId": "Cambridge_MA",
"id": "xsku5014",
"stockThreshold": 10,
"stockLevel": 75
}
The endpoint includes the inventory data in the response body:
{ "locationInventoryInfo": [ { "preorderThreshold": 0, "stockThreshold": 10, "availabilityStatus": 1000, "backorderThreshold": 0, "availabilityStatusMsg": "inStock", "backorderLevel": 0, "locationId": "Cambridge_MA", "preorderLevel": 0, "skuNumber": null, "availableToPromise": null, "translations": null, "availabilityDate": null, "inventoryId": null, "displayName": null, "stockLevel": 75 } ], "links": [ { "rel": "self", "href": "https://myserver.example.com:7002/ccadmin/v1/inventories" } ], "skuNumber": "xsku5014", "skuId": "xsku5014", "displayName": "Titanium Analog Watch" }
Notice that the response encapsulates the returned inventory data in a locationInventoryInfo
array object. This object type is used whenever inventory is returned for a non-default location, and enables returning inventory for multiple locations. (See Retrieve inventory data for locations for an example of returning inventory for multiple locations.)