Inventory¶
An Inventory record holds the stock of one Product at one location and sales
channel: what is available, reserved for open orders, on the way and on backorder, and a safety stock level.
Set isInfinite for goods that never run out, such as downloads. Quantities are
QuantitativeValues, so they carry a unit.
Modeled on schema.org/inventoryLevel · JSON Schema · ABAC object type Inventory
Example¶
Create one with POST /inventories:
{
"product": {
"at_id": "https://apis.objectsgrid.com/products/2b5f8f0e-1d0c-4d61-9a7e-5a1f0c3e9d21"
},
"location": "warehouse-berlin",
"channel": "online",
"availableQuantity": {
"value": 140,
"unitCode": "C62"
},
"reservedQuantity": {
"value": 12,
"unitCode": "C62"
}
}
Fields¶
Required: product.
| Field | Type | Required | Description |
|---|---|---|---|
id |
string | The object's id. Assigned by ObjectsGrid when the object is created. | |
identifier |
string | The object's id, as Schema.org identifier. Assigned by ObjectsGrid. |
|
at_type |
Inventory |
JSON-LD @type, the object's type name. |
|
at_id |
URL | The object's ObjectsGrid URL, https://apis.objectsgrid.com/<path>/<id>, its JSON-LD @id: what References to it hold. Assigned by ObjectsGrid. |
|
url |
URL | The object's own URL, https://apis.objectsgrid.com/<path>/<id>. Assigned by ObjectsGrid. |
|
product |
Reference to Product or ProductGroup or ProductModel | Yes | URL of the Product this Inventory record is for |
location |
string | Physical or logical inventory location. Optional for clients without a physical warehouse. Examples: 'global', 'default', 'virtual', 'supplier:acme', 'channel:online'. | |
channel |
string | Sales channel code (e.g. 'online', 'pos', 'b2b', 'marketplace:amazon'). | |
availableQuantity |
QuantitativeValue | On-hand, salable quantity (schema.org QuantitativeValue). Ignored if isInfinite = true. | |
reservedQuantity |
QuantitativeValue | Quantity reserved for open orders, not yet shipped. | |
safetyStock |
QuantitativeValue | Minimum buffer stock level before triggering alerts/replenishment. | |
inboundQuantity |
QuantitativeValue | Quantity on the way (inbound POs, transfers, etc.). | |
backorderQuantity |
QuantitativeValue | Quantity promised but not yet available (backorders). | |
isInfinite |
boolean | If true, inventory is considered unlimited / non-depleting (e.g. digital goods, made-to-order). | |
status |
one of AVAILABLE, LOW_STOCK, OUT_OF_STOCK, DISCONTINUED, INFINITE |
High-level stock status derived from quantities and isInfinite. | |
tags |
list of Tag | Tags your ABAC policy decides on. Created empty when not sent, kept by a PUT that leaves them out, cleared by null or []. |
|
meta |
ObjectMeta | Read-only metadata: version, type, creation and last update. |
REST API¶
Base URL https://apis.objectsgrid.com. Every request sends the X-ObjectsGrid-AccessPoint and Authorization: Bearer <access token> headers; see the REST API guide.
| Operation | Request |
|---|---|
| Create | POST /inventories |
| List and search | GET /inventories |
| Create up to 100 at once | POST /inventories/batch |
| Retrieve | GET /inventories/{id} |
| Replace | PUT /inventories/{id} |
| Update some fields | PATCH /inventories/{id} |
| Delete | DELETE /inventories/{id} |
Inventory objects have no JSON-LD document: asked for one (Accept: application/ld+json), GET answers 406.
The OpenAPI contract, with every parameter and response: Inventories (JSON).
GraphQL¶
Endpoint POST https://apis.objectsgrid.com/graphql; see the GraphQL guide.
| Operation | Field |
|---|---|
| Query | inventory(id: ID!, version: String): Inventory |
| Query | inventories(where: InventoryWhereInput, orderBy: [InventoryOrderByInput!], first: Int, after: String): InventoryConnection! |
| Query | inventoriesGroupBy(by: [InventoryGroupByField!]!, where: InventoryWhereInput, having: InventoryHavingInput, orderBy: [InventoryGroupByOrderByInput!], first: Int, after: String): InventoryGroupByConnection! |
| Mutation | createInventory(input: CreateInventoryInput!): Inventory! |
| Mutation | updateInventory(input: UpdateInventoryInput!, expectedVersion: String): Inventory! |
| Mutation | deleteInventory(id: ID!, expectedVersion: String): Boolean! |
Webhook events¶
Subscribe to these events in your webhook configuration to be called when an Inventory changes:
InventoryCreated, InventoryUpdated, InventoryPatched, InventoryDeleted.