API / Users / Balance

Users/Balance endpoint enables you to get users' flexible working time balances. You can use this endpoint to only GET balance information. No other methods are supported.
https://<your_environment_url>/customer-api/1.0/users/balance/

GET

When you call /users/balance/ endpoint without any parameters you will get the balance for every user in Silverbucket's database. An example response could look like this:
{
    "next": null,
    "previous": null,
    "current": 1,
    "itemsPerPage": 500,
    "count": 1,
    "lastPage": 1,
    "data": [
        {
            "user_id": 5382,
            "balance": 8.0,
            "upcoming_balance_fixes": null
        }
    ],
    "excelUrl": "/customer-api/1.0/users/balance/?excel=true",
    "csvUrl": "/customer-api/1.0/users/balance/?csv=true"
}

Filtering the results

You can provide different filters to GET call to reduce the size of the result set or to GET for example some specific user's balance. You can find more information about the filters from the article Customer APIs Common Features.

upcoming_balance_fixes

Balances which are returned by the endpoint represent the current date's balance. User's balance can be altered by adding so called balance fix hours to some point of time. If these fixes are in the history, they are calculated normally to the balance, either increasing or decreasing the balance. If there is balance fixes in the future the sum of future fixes is added to upcoming_balance_fixes field.
How did we do with this article?