πŸ”ŽStock takings

This page provides a description of the available API routes for managing stock takings.

Stock taking (represented by StockTaking class) is a method to adjust stock quantities for various stock items (Plu of type StockItem). These adjustments can be made multiple times until the stock taking is marked as closed by providing values for the ClosedBy and ClosedAt fields. Once a stock taking is closed, it becomes read-only and cannot be reopened. To close a stock taking, ActualQuantity must be provided for each item element (represented by StockTakingItem class).

After a stock taking is closed, the API server automatically generates a new stock transfer (represented by StockTransfer class) with the type correction. This stock transfer is used to execute the necessary stock quantity corrections for the items involved in the stock taking process.

API methods

Get stock takings

GET http://{server-address}/stocktakings

Returns all stocks that matches query parameters. Result is of type QueryResult<StockTaking>.

Query Parameters

Headers

{
    "items":
    [
        {
            "id": "64cfa2153a6484c761208b8c",
            "createdAt": "2023-08-06T13:37:25.728Z",
            "closedAt": null,
            "createdBy":
            {
                "name": "MajiteΔΎ",
                "userName": "999",
                "featureName": null
            },
            "closedBy": null,
            "currencyLabel": "EUR",
            "items":
            [
                {
                    "expectedQuantity":
                    {
                        "amount": 15.0,
                        "unit": "ks"
                    },
                    "actualQuantity":
                    {
                        "amount": 12.0,
                        "unit": "ks"
                    },
                    "plu":
                    {
                        "name": "Coca Cola 0,33l",
                        "code": 5,
                        "codes":
                        [],
                        "stockName": "S01",
                        "articleCategoryLabel": "DRI",
                        "vat":
                        {
                            "category": 1,
                            "rate": 20.0
                        },
                        "unitPurchasePrice":
                        {
                            "amount": 0.0,
                            "currencyLabel": "EUR"
                        },
                        "unitRetailPrice":
                        {
                            "amount": 3.491667,
                            "currencyLabel": "EUR"
                        }
                    }
                },
                {
                    "expectedQuantity":
                    {
                        "amount": 6.0,
                        "unit": "ks"
                    },
                    "actualQuantity":
                    {
                        "amount": 5.0,
                        "unit": "ks"
                    },
                    "plu":
                    {
                        "name": "Fanta 0.33l",
                        "code": 6,
                        "codes":
                        [],
                        "stockName": "S01",
                        "articleCategoryLabel": "DRI",
                        "vat":
                        {
                            "category": 1,
                            "rate": 20.0
                        },
                        "unitPurchasePrice":
                        {
                            "amount": 0.0,
                            "currencyLabel": "EUR"
                        },
                        "unitRetailPrice":
                        {
                            "amount": 3.491667,
                            "currencyLabel": "EUR"
                        }
                    }
                },
                {
                    "expectedQuantity":
                    {
                        "amount": 11.0,
                        "unit": "ks"
                    },
                    "actualQuantity": null,
                    "plu":
                    {
                        "name": "Sprite 0.33l",
                        "code": 7,
                        "codes":
                        [],
                        "stockName": "S01",
                        "articleCategoryLabel": "DRI",
                        "vat":
                        {
                            "category": 1,
                            "rate": 20.0
                        },
                        "unitPurchasePrice":
                        {
                            "amount": 0.0,
                            "currencyLabel": "EUR"
                        },
                        "unitRetailPrice":
                        {
                            "amount": 3.491667,
                            "currencyLabel": "EUR"
                        }
                    }
                }
            ],
            "_v": 1
        }
    ],
    "count": 1,
    "totalCount": 1
}

Get stock taking

GET http://{server-address}/stocktakings/{id}

Result is of type StockTaking.

Path Parameters

Headers

{
    "id": "64cfa2153a6484c761208b8c",
    "createdAt": "2023-08-06T13:37:25.728Z",
    "closedAt": null,
    "createdBy":
    {
        "name": "MajiteΔΎ",
        "userName": "999",
        "featureName": null
    },
    "closedBy": null,
    "currencyLabel": "EUR",
    "items":
    [
        {
            "expectedQuantity":
            {
                "amount": 15.0,
                "unit": "ks"
            },
            "actualQuantity":
            {
                "amount": 12.0,
                "unit": "ks"
            },
            "plu":
            {
                "name": "Coca Cola 0,33l",
                "code": 5,
                "codes":
                [],
                "stockName": "S01",
                "articleCategoryLabel": "DRI",
                "vat":
                {
                    "category": 1,
                    "rate": 20.0
                },
                "unitPurchasePrice":
                {
                    "amount": 0.0,
                    "currencyLabel": "EUR"
                },
                "unitRetailPrice":
                {
                    "amount": 3.491667,
                    "currencyLabel": "EUR"
                }
            }
        },
        {
            "expectedQuantity":
            {
                "amount": 6.0,
                "unit": "ks"
            },
            "actualQuantity":
            {
                "amount": 5.0,
                "unit": "ks"
            },
            "plu":
            {
                "name": "Fanta 0.33l",
                "code": 6,
                "codes":
                [],
                "stockName": "S01",
                "articleCategoryLabel": "DRI",
                "vat":
                {
                    "category": 1,
                    "rate": 20.0
                },
                "unitPurchasePrice":
                {
                    "amount": 0.0,
                    "currencyLabel": "EUR"
                },
                "unitRetailPrice":
                {
                    "amount": 3.491667,
                    "currencyLabel": "EUR"
                }
            }
        },
        {
            "expectedQuantity":
            {
                "amount": 11.0,
                "unit": "ks"
            },
            "actualQuantity": null,
            "plu":
            {
                "name": "Sprite 0.33l",
                "code": 7,
                "codes":
                [],
                "stockName": "S01",
                "articleCategoryLabel": "DRI",
                "vat":
                {
                    "category": 1,
                    "rate": 20.0
                },
                "unitPurchasePrice":
                {
                    "amount": 0.0,
                    "currencyLabel": "EUR"
                },
                "unitRetailPrice":
                {
                    "amount": 3.491667,
                    "currencyLabel": "EUR"
                }
            }
        }
    ],
    "_v": 1
}

Create stock taking

POST http://{server-address}/stocktakings

Creates new stock taking. Result is of type StockTaking.

Required rights

Authorized user must have StockTakingCreate right assigned. If stock taking is marked as closed, StockTakingClose right is required as well.

Headers

Request Body

{
    "id": "64cfa2153a6484c761208b8c",
    "createdAt": "2023-08-06T13:37:25.728Z",
    "closedAt": null,
    "createdBy":
    {
        "name": "MajiteΔΎ",
        "userName": "999",
        "featureName": null
    },
    "closedBy": null,
    "currencyLabel": "EUR",
    "items":
    [
        {
            "expectedQuantity":
            {
                "amount": 15.0,
                "unit": "ks"
            },
            "actualQuantity":
            {
                "amount": 12.0,
                "unit": "ks"
            },
            "plu":
            {
                "name": "Coca Cola 0,33l",
                "code": 5,
                "codes":
                [],
                "stockName": "S01",
                "articleCategoryLabel": "DRI",
                "vat":
                {
                    "category": 1,
                    "rate": 20.0
                },
                "unitPurchasePrice":
                {
                    "amount": 0.0,
                    "currencyLabel": "EUR"
                },
                "unitRetailPrice":
                {
                    "amount": 3.491667,
                    "currencyLabel": "EUR"
                }
            }
        },
        {
            "expectedQuantity":
            {
                "amount": 6.0,
                "unit": "ks"
            },
            "actualQuantity":
            {
                "amount": 5.0,
                "unit": "ks"
            },
            "plu":
            {
                "name": "Fanta 0.33l",
                "code": 6,
                "codes":
                [],
                "stockName": "S01",
                "articleCategoryLabel": "DRI",
                "vat":
                {
                    "category": 1,
                    "rate": 20.0
                },
                "unitPurchasePrice":
                {
                    "amount": 0.0,
                    "currencyLabel": "EUR"
                },
                "unitRetailPrice":
                {
                    "amount": 3.491667,
                    "currencyLabel": "EUR"
                }
            }
        },
        {
            "expectedQuantity":
            {
                "amount": 11.0,
                "unit": "ks"
            },
            "actualQuantity": null,
            "plu":
            {
                "name": "Sprite 0.33l",
                "code": 7,
                "codes":
                [],
                "stockName": "S01",
                "articleCategoryLabel": "DRI",
                "vat":
                {
                    "category": 1,
                    "rate": 20.0
                },
                "unitPurchasePrice":
                {
                    "amount": 0.0,
                    "currencyLabel": "EUR"
                },
                "unitRetailPrice":
                {
                    "amount": 3.491667,
                    "currencyLabel": "EUR"
                }
            }
        }
    ],
    "_v": 1
}

Create or update stock taking

PUT http://{server-address}/stocktakings/{id}

Updates existing or creates new stock taking. Result is of type StockTaking.

Required rights

Authorized user must have assigned StockTakingCreate or StockTakingUpdate right. If stock taking is marked as closed, StockTakingClose right is required as well.

Only stock takings not marked as closed can be updated.

Path Parameters

Headers

Request Body

{
    "id": "64cfa2153a6484c761208b8c",
    "createdAt": "2023-08-06T13:37:25.728Z",
    "closedAt": null,
    "createdBy":
    {
        "name": "MajiteΔΎ",
        "userName": "999",
        "featureName": null
    },
    "closedBy": null,
    "currencyLabel": "EUR",
    "items":
    [
        {
            "expectedQuantity":
            {
                "amount": 15.0,
                "unit": "ks"
            },
            "actualQuantity":
            {
                "amount": 12.0,
                "unit": "ks"
            },
            "plu":
            {
                "name": "Coca Cola 0,33l",
                "code": 5,
                "codes":
                [],
                "stockName": "S01",
                "articleCategoryLabel": "DRI",
                "vat":
                {
                    "category": 1,
                    "rate": 20.0
                },
                "unitPurchasePrice":
                {
                    "amount": 0.0,
                    "currencyLabel": "EUR"
                },
                "unitRetailPrice":
                {
                    "amount": 3.491667,
                    "currencyLabel": "EUR"
                }
            }
        },
        {
            "expectedQuantity":
            {
                "amount": 6.0,
                "unit": "ks"
            },
            "actualQuantity":
            {
                "amount": 5.0,
                "unit": "ks"
            },
            "plu":
            {
                "name": "Fanta 0.33l",
                "code": 6,
                "codes":
                [],
                "stockName": "S01",
                "articleCategoryLabel": "DRI",
                "vat":
                {
                    "category": 1,
                    "rate": 20.0
                },
                "unitPurchasePrice":
                {
                    "amount": 0.0,
                    "currencyLabel": "EUR"
                },
                "unitRetailPrice":
                {
                    "amount": 3.491667,
                    "currencyLabel": "EUR"
                }
            }
        },
        {
            "expectedQuantity":
            {
                "amount": 11.0,
                "unit": "ks"
            },
            "actualQuantity": null,
            "plu":
            {
                "name": "Sprite 0.33l",
                "code": 7,
                "codes":
                [],
                "stockName": "S01",
                "articleCategoryLabel": "DRI",
                "vat":
                {
                    "category": 1,
                    "rate": 20.0
                },
                "unitPurchasePrice":
                {
                    "amount": 0.0,
                    "currencyLabel": "EUR"
                },
                "unitRetailPrice":
                {
                    "amount": 3.491667,
                    "currencyLabel": "EUR"
                }
            }
        }
    ],
    "_v": 1
}

Delete stock taking

DELETE http://{server-address}/stocktakings/{id}

Required rights

Authorized user must have StockTakingDelete right assigned.

Only stock takings not marked as closed can be deleted.

Path Parameters

Headers

{
    "id": "64cfa2153a6484c761208b8c",
    "createdAt": "2023-08-06T13:37:25.728Z",
    "closedAt": null,
    "createdBy":
    {
        "name": "MajiteΔΎ",
        "userName": "999",
        "featureName": null
    },
    "closedBy": null,
    "currencyLabel": "EUR",
    "items":
    [
        {
            "expectedQuantity":
            {
                "amount": 15.0,
                "unit": "ks"
            },
            "actualQuantity":
            {
                "amount": 12.0,
                "unit": "ks"
            },
            "plu":
            {
                "name": "Coca Cola 0,33l",
                "code": 5,
                "codes":
                [],
                "stockName": "S01",
                "articleCategoryLabel": "DRI",
                "vat":
                {
                    "category": 1,
                    "rate": 20.0
                },
                "unitPurchasePrice":
                {
                    "amount": 0.0,
                    "currencyLabel": "EUR"
                },
                "unitRetailPrice":
                {
                    "amount": 3.491667,
                    "currencyLabel": "EUR"
                }
            }
        },
        {
            "expectedQuantity":
            {
                "amount": 6.0,
                "unit": "ks"
            },
            "actualQuantity":
            {
                "amount": 5.0,
                "unit": "ks"
            },
            "plu":
            {
                "name": "Fanta 0.33l",
                "code": 6,
                "codes":
                [],
                "stockName": "S01",
                "articleCategoryLabel": "DRI",
                "vat":
                {
                    "category": 1,
                    "rate": 20.0
                },
                "unitPurchasePrice":
                {
                    "amount": 0.0,
                    "currencyLabel": "EUR"
                },
                "unitRetailPrice":
                {
                    "amount": 3.491667,
                    "currencyLabel": "EUR"
                }
            }
        },
        {
            "expectedQuantity":
            {
                "amount": 11.0,
                "unit": "ks"
            },
            "actualQuantity": null,
            "plu":
            {
                "name": "Sprite 0.33l",
                "code": 7,
                "codes":
                [],
                "stockName": "S01",
                "articleCategoryLabel": "DRI",
                "vat":
                {
                    "category": 1,
                    "rate": 20.0
                },
                "unitPurchasePrice":
                {
                    "amount": 0.0,
                    "currencyLabel": "EUR"
                },
                "unitRetailPrice":
                {
                    "amount": 3.491667,
                    "currencyLabel": "EUR"
                }
            }
        }
    ],
    "_v": 1
}

Last updated