Access inventory data
You can use the getInventory
endpoint to retrieve inventory information for a specific product or SKU.
The getInventory
endpoint takes a type
query
parameter to specify the item type. The value of this parameter must be
product
(for a product) or variant
(for a SKU).
The default is variant
, so if you omit the parameter, Oracle Commerce assumes that the item is a SKU.
For example:
GET /ccadmin/v1/inventories/xprod1004?type=product HTTP 1.1
Authorization: Bearer <access_token>
The response body includes inventory information for the product as a whole, plus information about each individual SKU:
{
"id": "xprod1004",
"stockStatus": "partialAvailability",
"totalStockLevel": 210,
"links": [
{
"rel": "self",
"href":"https://myserver.example.com:7002/ccadmin/v1/
inventories/xprod1004?type=product"
}
],
"childSKUs": [
{
"preorderThreshold": 0,
"stockThreshold": 0,
"availabilityStatus": 1000,
"backorderThreshold": 0,
"availabilityStatusMsg": "inStock",
"backorderLevel": 0,
"locationId": null,
"preorderLevel": 0,
"skuNumber": "xsku5014",
"availableToPromise": null,
"translations": null,
"skuId": "xsku5014",
"availabilityDate": null,
"inventoryId": null,
"displayName": "Titanium Analog Watch",
"stockLevel": 100
},
{
"preorderThreshold": 0,
"stockThreshold": 0,
"availabilityStatus": 1000,
"backorderThreshold": 0,
"availabilityStatusMsg": "inStock",
"backorderLevel": 0,
"locationId": null,
"preorderLevel": 0,
"skuNumber": "xsku5015",
"availableToPromise": null,
"translations": null,
"skuId": "xsku5015",
"availabilityDate": null,
"inventoryId": null,
"displayName": "Silver Plated Analog Watch",
"stockLevel": 100
},
{
"preorderThreshold": 0,
"stockThreshold": 20,
"availabilityStatus": 1001,
"backorderThreshold": 0,
"availabilityStatusMsg": "outOfStock",
"backorderLevel": 0,
"locationId": null,
"preorderLevel": 0,
"skuNumber": "xsku5016",
"availableToPromise": null,
"translations": null,
"skuId": "xsku5016",
"availabilityDate": null,
"inventoryId": null,
"displayName": "Brushed Steel Analog Watch",
"stockLevel": 10
}
],
"displayName": "Analog Watch"
}
If you specify a SKU, you can omit the type
parameter. For
example:
GET /ccadmin/v1/inventories/xsku5014 HTTP 1.1
Authorization: Bearer <access_token>
The response contains inventory information about the SKU only:
{
"preorderThreshold": 0,
"stockThreshold": 0,
"availabilityStatus": 1000,
"backorderThreshold": 0,
"availabilityStatusMsg": "inStock",
"backorderLevel": 0,
"locationId": null,
"links": [
{
"rel": "self",
"href": "https://myserver.example.com:7002/ccadmin/v1/inventories/xsku5014"
}
],
"preorderLevel": 0,
"skuNumber": "xsku5014",
"availableToPromise": null,
"translations": null,
"skuId": "xsku5014",
"availabilityDate": null,
"inventoryId": null,
"displayName": "Titanium Analog Watch",
"stockLevel": 100
}
Update inventory
You can use the updateInventory
endpoint to modify the inventory of a specific SKU. In the request body, specify new values for the properties you want to update. For example:
PUT /ccadmin/v1/inventories/xsku5014 HTTP 1.1
Authorization: Bearer <access_token>
{
"stockThreshold": 15,
"stockLevel": 200
}