Stocks

To optimise the order routing and to have an overview, how many pieces of an article there are in a facility or the whole network, we have an entity called stock. This part of our tutorial series show

More Stock-API information can be found here: REST API documentation - Stock

Create stock

To create stock, use the stocks endpoint and POST the amount of stock for each article for each facility:

POST https://{YOUT_TENANT_NAME}.api.fulfillmenttools.com/api/stocks
{
    "facilityRef": "d286e108-698b-4f6c-97b7-21f090f17e46",
    "tenantArticleId": "BLAZER-G-6354",
    "value": 100,
    "properties": {
        "batch": "0-1-2-3",
        "expiry": "2023-08-17T09:39:28.966Z"
    }
}

After creating the stock, we receive a 201 CREATED response:

{
    "created": "2024-02-02T10:27:55.154Z",
    "facilityRef": "d286e108-698b-4f6c-97b7-21f090f17e46",
    "id": "33fb7ef6-47b5-4fd7-ac07-584293d84af3",
    "lastModified": "2024-02-02T10:27:55.154Z",
    "tenantArticleId": "BLAZER-G-6354",
    "value": 100,
    "scannableCodes": [],
    "scores": [
        {
            "type": "RATING",
            "name": "RECEIPT_DATE",
            "value": 3255
        }
    ],
    "reserved": 0,
    "facilityWideReserved": 0,
    "available": 100,
    "traits": [
        "PICKABLE",
        "ACCESSIBLE"
    ],
    "properties": {
        "batch": "0-1-2-3",
        "expiry": "2023-08-17T09:39:28.966Z"
    },
    "serializedProperties": "{}",
    "receiptDate": "2024-02-02T10:27:55.136Z",
    "version": 1
}

Besides some other properties, you might have noticed reserved and facilityWideReserved. When there is a PickJob inside the facility which needs this stock or this article in the facility, the stock will be reserved until it is picked. When the item is picked, the reservation will be removed and the amount of stock will be decreased.

Bulk stock update

When updating stock, it is recommended to use the bulk PUT /api/stocks endpoint to regularly push stock level updates by SKU (tenantArticleId) and facility while minimizing the number of calls.

In the following example, all stocks of tenantArticleId 4711 are updated.

The stock version and ID must be sent for an update. Otherwise, a new stock is created.

Search stock for obtaining the ID and version

First, stocks needs to be searched to obtain the IDs and versions of all stocks that exist for the respective tenantArticleId.

POST https://{YOUR_TENANT_NAME}.api.fulfillmenttools.com/api/stocks/search
{
  "query": {
    "tenantArticleId": {
      "eq": "4711"
    }
  }
}

When stock should be updated per facility, the facilityRef must be included in the search query.

It might be necessary to iterate over multiple pages to get all stocks with the corresponding tenantArticleId.

Update stock

Use the PUT /api/stocks endpoint to update stock.

  • The endpoint can be used for creating and for updating stocks (consider different input models).

  • Please be aware that an ID and version are necessary for updating stock as there can exist multiple stocks for the same SKU and facility.

PUT https://{YOUR_TENANT_NAME}.api.fulfillmenttools.com/api/stocks
{
  "stocks": [
    {
      "id": "4f6c-97b7-21f090f17e46d286e108-698b",
      "locationRef": "SL-01",
      "properties": {
        "expiry": "2027-01-01T00:00:00.000Z"
      },
      "value": 200,
      "version": 6
    },
    {
      "id": "4f6c-97b7-21f090f17e46d286e108-698b",
      "value": 100,
      "version": 6,
    },
    {
      "id": "4f6c-97b7-21f090f17e46d286e108-698b",
      "value": 300,
      "version": 6,
    }
  ]
}

More Stock-API information can be found here: REST API documentation - Stock

Deleting stock by product / location / id in batch

To delete stocks by product, location or idm use the actions-endpoint of our API:

POST https://{YOUT_TENANT_NAME}.api.fulfillmenttools.com/api/stocks/action
  • For deleting all stocks for a product in a facility, use the DELETE_BY_PRODUCTS action

  • For deleting all stocks on a storage location in a facility, use the DELETE_BY_LOCATIONS action

  • For deleting multiple stocks in a facility in one call, use the DELETE_BY_IDS action

Move stock to location

To move stock to a location, use the action MOVE_TO_LOCATION.

POST https://{YOUT_TENANT_NAME}.api.fulfillmenttools.com/api/stocks/action

Note: In the options of the action the deleteFromStockIfZero is available. If this is set to true, the stock on the start location is deleted when value reaches 0, after move action was completed (even when the KEEP_ON_ZERO trait is active on the respective location).

Create safety stock

The PUT safetyStock endpoint lets us create the safety stock in a bulk operation:

PUT https://{YOUR_TENANT_NAME}.api.fulfillmenttools.com/api/safetystocks
{
    "operations": [
        {
            "tenantArticleId": "SNEAK-W-4891",
            "facilityRef": "d286e108-698b-4f6c-97b7-21f090f17e46",
            "value": 10
        }
    ]
}

The 207 MULTI-STATUS status code indicates success, the payload shows the status for each entity:

[
    {
        "tenantArticleId": "SNEAK-W-4891",
        "value": 10,
        "status": "CREATED",
        "facilityRef": "d286e108-698b-4f6c-97b7-21f090f17e46"
    }
]

Last updated