REST API#
This module contains functions from the EMhub’s REST API.
The REST API allows to operate with the underlying database entities. There are functions to create, update, delete and retrieve existing elements.
This functions will be the channel between the DataClient
in the client code
and the server DataManager
.
Authentication#
- emhub.blueprints.api.login()#
Login a given user in the server.
Arguments are expected coming in
request.json
.- Parameters:
username – Username to login.
password – password to login.
- emhub.blueprints.api.logout()#
Logout previously logged user.
Users#
Parameters for the following methods are expected from request.form
or request.json
.
- emhub.blueprints.api.register_user()#
Templates#
Parameters for the following methods are expected from request.form
or request.json
.
- emhub.blueprints.api.get_templates()#
Get a list of all existing templates.
Applications#
Parameters for the following methods are expected from request.form
or request.json
.
- emhub.blueprints.api.create_application()#
Create an
Application
.
- emhub.blueprints.api.get_applications()#
Get all applications.
- emhub.blueprints.api.update_application()#
Update an existing
Application
.
- emhub.blueprints.api.delete_application()#
Delete an
Application
.
Resources#
Parameters for the following methods are expected from request.form
or request.json
.
- emhub.blueprints.api.get_resources()#
Retrieve existing resources.
Bookings#
Parameters for the following methods are expected from request.form
or request.json
.
- emhub.blueprints.api.get_bookings()#
Retrieve existing bookings.
- emhub.blueprints.api.get_bookings_range()#
Retrieve booking within a given time range.
- Parameters:
start (str) – Starting date (format “YYYY-MM-DD”).
end (str) – Ending date (format “YYYY-MM-DD”).
func – Function used to process the booking, by default ‘to_event’