Location stock history

There are 2 different endpoints about stock history:

  • Stock history: only contains changes of the stock levels of a product. This gives you every product coming in or going out of your warehouse. Mentioned stock levels are on a product-warehouse basis.
  • Location stock history (this page): gives stock changes on a per location basis. Which means that it also tracks stock movements inside the same warehouse. Mentioned stock levels are on a product-location basis.

Get full location stock history

GET https://example.picqer.com/api/v1/location-stock-history
HTTP/1.1 200 OK [ { "idproduct_location_stock_history": 34, "idproduct": 2615, "idlocation": 438, "contra_idlocation": null, "old_stock": 0, "stock_change": 7, "new_stock": 7, "change_type": "mutation", "changed_at": "2022-09-19 16:37:42" }, { "idproduct_location_stock_history": 33, "idproduct": 2615, "idlocation": 7, "contra_idlocation": 438, "old_stock": 0, "stock_change": 1, "new_stock": 1, "change_type": "movement", "changed_at": "2022-09-19 16:36:45" } ]
This endpoint uses pagination.

Filters

You can filter the history with the following parameters. Add these filters as querystring parameters to the URL.

Attribute Description Example
sincedate Get the history that is added after this date and time. 2022-01-01 12:00:00
untildate Get the history that is added before this date and time. 2024-01-01 00:00:00
idproduct Get the history for this product. 1106133
idlocation Get the history in this location. 9823

Get single history item

GET https://example.picqer.com/api/v1/location-stock-history/{idproduct_location_stock_history}
HTTP/1.1 200 OK { "idproduct_location_stock_history": 34, "idproduct": 2615, "idlocation": 438, "contra_idlocation": null, "old_stock": 0, "stock_change": 7, "new_stock": 7, "change_type": "mutation", "changed_at": "2022-09-19 16:37:42" }

Stock changes

Stock changes can be found as change_type "mutation". These are the same as can be found in the stock history endpoint. If you want to know the reason or the user, use that endpoint.

Stock movements

When stock is moved between locations, this endpoint will show 2 entries. One entry for each location, with a positive and a negative amount. The change_type is "movement".

The attribute contra_idlocation gives you the other side of the movement. A movement from location 12 to 77 will give you 2 entries: [idlocation: 12, contra_idlocation: 77] and [idlocation: 77, contra_idlocation: 12].

Changing history

Of course it is not possible to change history. Therefor you cannot POST, PUT or DELETE history items.

But you can change the stock. See the products endpoint for information about changing current stock levels.