Stock | Stocks

Data on stock levels are sent to ONE from an external system. Stock level is represented by the number of units of a given item in the selected warehouse.
⚠️
We recommend that you use one endpoint from start to finish to replenish your inventory. In case of changing the endpoint, you should remove the inventory and start using a different endpoint
⚠️
Information for ERP system integrators: - quantity stocks should be sent from the ERP system to the ONe platform only for products that have been marked in the ERP system with the appropriate checkbox - In the case of long request (especially in the case of request regarding sent stocks, prices, customer migrations), it is required to divide the request into smaller ones and queue them. More information will be provided by the implementation supervisor.

Table of contents:

Glossary

Name
Explanation
cartId
Cart ID. When presenting stock quantity, after entering cart ID, we will see stock levels ignoring cart reservations
skus
Product identifier (SKU - Stock Keeping Unit)
warehousesId
Warehouses identifiers which it is possible to filter products by a selected warehouse
id (stock identifier)
Stock identifier (unique id in warehouse). If a separate storage location number is not used, then use the same value as for skus. It is useful when there is more than 1 product in the warehouse with the same SKU, and the quantity change is to apply to the selected product at the selected storage location.
quantity / selectedWarehousesQuantity
Quantity of available product in stock in selected warehouse
largestQuantity
Quantity of products in stock (together with reserved products)
stocksToRemove
Stock's identifiers to remove from warehouse. Enter the id of the products to be removed from the selected warehouse

GET - returns product stock for given warehouses and products

In this endpoint, we have the option of receiving a list of specific products in specific warehouses. This can be multiple products for multiple warehouses. To do this, use GET /api/v1/stock/integrations/auth-required/stocks
The diagram below shows the dependence of communicating with the API:
Image without caption
Use the required following query parameters to get list of products:
  • skus (product identifiers)
  • warehouses (warehouses identifiers)
It is possible use the optional following query parameters:
  • cartId (ID of cart from which reseravtions should be ignored in returned stocks)
In the example we showed request on two products and a situation in which a reservation is made for a products . cartId has not been completed
Example request :
json
curl -X GET "https://api-preprod.one.unity.pl/api/v1/stock/integrations/auth-required/products/stocks?skus=SIGNY_51500600&skus=SIGNY_51502000&warehouses=WRO&withStocks=false" -H "accept: */*" --H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}"
In response we receive details of stock for selected products in selected warehouses. Please note that the quantity available (quantity) is less than the maximum quantity (largestQuantity) due to the fact that the products have been reserved.
Example response:
json
{ "SIGNY_51500600": { "overallQuantity": 164.1, "selectedWarehousesQuantity": 24, "warehouses": [ { "warehouseId": "WRO", "warehouseLabel": "Wrocław", "quantity": 18, "largestQuantity": 24, "stocks": [] } ] }, "SIGNY_51502000": { "overallQuantity": 332, "selectedWarehousesQuantity": 48, "warehouses": [ { "warehouseId": "WRO", "warehouseLabel": "Wrocław", "quantity": 42, "largestQuantity": 48, "stocks": [] } ] } }

GET - returns all product stocks

In this endpoint, we have the option of receiving a quanitity of product in specific warehouses. This can single product for multiple warehouses. To do this, use GET /api/v1/stock/integrations/auth-required/stocks-for-one-product
The diagram below shows the dependence of communicating with the API:
Image without caption
Use the required following query parameters to get list of products:
  • skus (product identifiers)
It is possible use the optional following query parameters to narrow down the products list
  • cartId (ID of cart from which reseravtions should be ignored in returned stocks)
  • warehouses (warehouses identifiers)
In the example we showed request on two products and a situation in which a reservation is made for a products . cartId has not been completed
Example request :
json
curl -X GET "https://api-preprod.one.unity.pl/api/v1/stock/integrations/auth-required/products/stocks-for-one-product?sku=SIGNY_51502000&warehouses=WRO&warehouses=W2LOC&warehouses=W1CEN&withStocks=false" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}"
In response we receive details of stock for selected product in selected warehouses .
⚠️
Please note that the quantity available (quantity) is less than the maximum quantity (largestQuantity) due to the fact that the products have been reserved.
Example response:
json
{ "overallQuantity": 302, "selectedWarehousesQuantity": 69, "warehouses": [ { "warehouseId": "W2LOC", "warehouseLabel": "Local warehouse - Etna", "quantity": 25, "largestQuantity": 25, "stocks": [] }, { "warehouseId": "W1CEN", "warehouseLabel": "One warehouse", "quantity": 2, "largestQuantity": 26, "stocks": [] }, { "warehouseId": "WRO", "warehouseLabel": "Wrocław", "quantity": 42, "largestQuantity": 48, "stocks": [] } ] }

PUT - update (replace) all stocks in warehouse

In this endpoint it is possible to update stocks in selected warehouse.
⚠️
Warning! This endpoint changes the stock quantities for all products in selected warehouse, so be sure to include all list of products from warehouse. If do not enter a product that had stocks before the change, it will be changed to the quantity 0
Use PUT /api/v1/stock/integrations/auth-required/warehouses/{warehouse}/stocks to update (replace) all stocks in warehouse
The diagram below shows the dependency of communicating with the API:
Image without caption
In request you need to put path parameter:
  • warehouse
In the example we have showed updating invoice email
Example request:
json
curl -X PUT "https://api-preprod.one.unity.pl/api/v1/stock/integrations/auth-required/warehouses/WRO/stocks" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}" -H "Content-Type: application/json" { "stocks": [ { "id": "SIGNY_51502000", "quantity": 12, "sku": "SIGNY_51502000" }, { "id": "SIGNY_51500600", "quantity": 12, "sku": "SIGNY_51500600" } ] }"

POST - incremental update (append) stocks in warehouse

In this endpoint, it is possible to change the inventory on a single product and it is possible to remove inventory from the selected product. In this case use POST /api/v1/stock/integrations/auth-required/warehouses/{warehouse}/stock/incrementa to create Client using the API.
The sequence diagram below shows the dependence of communicating with the API with external system:
Image without caption
To create or update you need in request to put path parameter:
  • warehouse
⚠️
The entered value changes the quantity in stock to this value. The value does not add this value to the inventory It is possible to remove only the entire stock on the selected product
Example request:
json
curl -X POST "https://api-preprod.one.unity.pl/api/v1/stock/integrations/auth-required/warehouses/WRO/stocks/incremental" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}" -H "Content-Type: application/json" -d "{ "stocks": [ { "id": "SIGNY_51502000", "quantity": 18, "sku": "SIGNY_51502000" } ], "stocksToRemove": [ "SIGNY_51500600" ] }"