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.create_user()#

Create a new User in the system.

emhub.blueprints.api.register_user()#
emhub.blueprints.api.update_user()#

Update a given User in the system.

emhub.blueprints.api.delete_user()#

Delete a User from the system.

Templates#

Parameters for the following methods are expected from request.form or request.json.

emhub.blueprints.api.create_template()#

Create a new Template.

emhub.blueprints.api.get_templates()#

Get a list of all existing templates.

emhub.blueprints.api.update_template()#

Update an existing Template.

emhub.blueprints.api.delete_template()#

Delete a given Template.

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.create_resource()#

Create a new Resource.

emhub.blueprints.api.get_resources()#

Retrieve existing resources.

emhub.blueprints.api.update_resource()#

Update a given Resource.

emhub.blueprints.api.delete_resource()#

Delete a Resource.

Bookings#

Parameters for the following methods are expected from request.form or request.json.

emhub.blueprints.api.create_booking()#

Create a new Booking.

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’

emhub.blueprints.api.update_booking()#

Update an existing Booking.

emhub.blueprints.api.delete_booking()#

Delete an existing Booking.