# Bareos REST API using fastAPI and python-bareos
Experimental and subject to enhancements and changes.
This is an experimental backend for development purposes.
It provides a REST API using fastapi and python-bareos to connect to
a Bareos director.
* https://fastapi.tiangolo.com/
* https://www.openapis.org/
## Guide
### Installation
We recommend to create a dedicated Python environment for the installation in an own directory:
```
python3 -m venv env
# Activate the virtual environment inside the directory
source env/bin/activate
# Install dependencies into the virtual environment
pip install bareos-restapi
```
Note: The optional module _sslpsk_ can be installed manually, if you want encrypted communication between the API and the Bareos director.
### Configuration
The module directory contains a sample ini-file. Change into this directory (something like */lib/python3.x/site-packages/bareosRestapiModels* on most operating systems) and copy _api.ini.sample_ to _api.ini_ and adapt it to your director. Make sure to generate an own secret-key for the _JWT_ section.
Your director configuration in _api.ini_ should look like:
```
[Director]
Name=bareos-dir
Address=127.0.0.1
Port=9101
```
Note: you will need a *named console* (user/password) to acces the Bareos director using this API. Read more about Consoles here:
https://docs.bareos.org/Configuration/Director.html#console-resource
### Start the backend server
From inside the module directory run:
```
uvicorn bareos-restapi:app --reload
```
* Serve the Swagger UI to explore the REST API: http://127.0.0.1:8000/docs
* Alternatively you can use the redoc format: http://127.0.0.1:8000/redoc
### Browse
The Swagger UI contains documentation and online-tests. Use "authorize" to connect to your Bareos director using a named console. Read here to learn how to configure
a named console: https://docs.bareos.org/Configuration/Director.html#console-resource
The Swagger documentation also contains CURL statements for all available endpoints.
## Future work
The API will be extended by some methods provided by the Bareos console, that are not yet implemented. It is also planned to add delete / update options for configuration in the director and REST API. If you are interested in support and / or funding enhancements, please visit https://www.bareos.com
TODO:
- define and document response model
- add possibility to connect to a choice of directors
- add start-script with ini-file name as parameter
Raw data
{
"_id": null,
"home_page": "https://github.com/bareos/bareos/",
"name": "bareos-restapi",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "bareos, REST API",
"author": "Bareos Team",
"author_email": "packager@bareos.com",
"download_url": "https://files.pythonhosted.org/packages/c2/77/a8eddb99c25fa1f93b6dffb6233ff8b5cce4e59f504cbc13e222fd3cc3e3/bareos_restapi-24.0.4.tar.gz",
"platform": null,
"description": "# Bareos REST API using fastAPI and python-bareos\n\nExperimental and subject to enhancements and changes.\n\nThis is an experimental backend for development purposes.\n\nIt provides a REST API using fastapi and python-bareos to connect to\na Bareos director.\n\n* https://fastapi.tiangolo.com/\n* https://www.openapis.org/\n\n## Guide\n\n### Installation\n\nWe recommend to create a dedicated Python environment for the installation in an own directory:\n\n```\npython3 -m venv env\n# Activate the virtual environment inside the directory\nsource env/bin/activate\n# Install dependencies into the virtual environment\npip install bareos-restapi\n```\n\nNote: The optional module _sslpsk_ can be installed manually, if you want encrypted communication between the API and the Bareos director.\n\n### Configuration\n\nThe module directory contains a sample ini-file. Change into this directory (something like */lib/python3.x/site-packages/bareosRestapiModels* on most operating systems) and copy _api.ini.sample_ to _api.ini_ and adapt it to your director. Make sure to generate an own secret-key for the _JWT_ section.\n\nYour director configuration in _api.ini_ should look like:\n```\n[Director]\nName=bareos-dir\nAddress=127.0.0.1\nPort=9101\n```\n\nNote: you will need a *named console* (user/password) to acces the Bareos director using this API. Read more about Consoles here:\nhttps://docs.bareos.org/Configuration/Director.html#console-resource\n\n\n### Start the backend server\n\nFrom inside the module directory run:\n\n```\nuvicorn bareos-restapi:app --reload\n```\n\n* Serve the Swagger UI to explore the REST API: http://127.0.0.1:8000/docs\n* Alternatively you can use the redoc format: http://127.0.0.1:8000/redoc\n\n\n### Browse\nThe Swagger UI contains documentation and online-tests. Use \"authorize\" to connect to your Bareos director using a named console. Read here to learn how to configure\na named console: https://docs.bareos.org/Configuration/Director.html#console-resource\n\nThe Swagger documentation also contains CURL statements for all available endpoints.\n\n## Future work\n\nThe API will be extended by some methods provided by the Bareos console, that are not yet implemented. It is also planned to add delete / update options for configuration in the director and REST API. If you are interested in support and / or funding enhancements, please visit https://www.bareos.com\n\nTODO: \n- define and document response model\n- add possibility to connect to a choice of directors\n- add start-script with ini-file name as parameter\n",
"bugtrack_url": null,
"license": "AGPLv3",
"summary": "REST API for Bareos console access.",
"version": "24.0.4",
"project_urls": {
"Homepage": "https://github.com/bareos/bareos/"
},
"split_keywords": [
"bareos",
" rest api"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "901b7b4d8ac28b0da1fc00dba9c6d0bc5f13b519d82cf7fffd6dcdcf17d51622",
"md5": "2903b9273fa9623826b03262456529ad",
"sha256": "db50340cb9cff9da9d3148e89399086d4d4dc35190541431251e1ebce8f21151"
},
"downloads": -1,
"filename": "bareos_restapi-24.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2903b9273fa9623826b03262456529ad",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 41552,
"upload_time": "2025-07-10T07:43:36",
"upload_time_iso_8601": "2025-07-10T07:43:36.680208Z",
"url": "https://files.pythonhosted.org/packages/90/1b/7b4d8ac28b0da1fc00dba9c6d0bc5f13b519d82cf7fffd6dcdcf17d51622/bareos_restapi-24.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c277a8eddb99c25fa1f93b6dffb6233ff8b5cce4e59f504cbc13e222fd3cc3e3",
"md5": "1a588a9f3887583f9d23ef5c9efce497",
"sha256": "ac06fe655d7a6f2b0dd8bcdf3e37b26b397e57eb4bc0a29cccabce348728c616"
},
"downloads": -1,
"filename": "bareos_restapi-24.0.4.tar.gz",
"has_sig": false,
"md5_digest": "1a588a9f3887583f9d23ef5c9efce497",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 42121,
"upload_time": "2025-07-10T07:43:39",
"upload_time_iso_8601": "2025-07-10T07:43:39.109363Z",
"url": "https://files.pythonhosted.org/packages/c2/77/a8eddb99c25fa1f93b6dffb6233ff8b5cce4e59f504cbc13e222fd3cc3e3/bareos_restapi-24.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-10 07:43:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bareos",
"github_project": "bareos",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "bareos-restapi"
}