Generic REST API definition module

This module defines the generic REST API for annotation services as defined by the CANARIE API specification. See : https://collaboration.canarie.ca/elgg/file/download/849

VestaRestPackage.generic_rest_api.close_connection(dummy_exception)[source]

Disconnect database.

Parameters:dummy_exception – Exception handled elsewhere, nothing to do with it
VestaRestPackage.generic_rest_api.configure_home_route()[source]

Configure the route /<service_route>

Cannot be done with the decorator because we must know the exact routes name and not match any keyword since it will conflict with other route like /info, /doc, etc.

VestaRestPackage.generic_rest_api.extern_html_error_handler(status_code_str)[source]

Handle errors that occur externally provided that Apache is configured so that it uses this route for handling errors.

For this add this line for each handled html errors in the Apache configuration:

ErrorDocument 400 <Rest root>/400
VestaRestPackage.generic_rest_api.global_info()[source]

Return an overview of the services hosted by this REST instance

VestaRestPackage.generic_rest_api.handle_exceptions(exception_instance)[source]

Generate error response for raised exceptions.

Parameters:exception_instance – Exception instance.
VestaRestPackage.generic_rest_api.info(service_route='.')[source]

Required by CANARIE A service can define it’s service_route as ‘.’, in which case, the URL doesn’t have to contain a route token

VestaRestPackage.generic_rest_api.simple_requests_handler(api_request='home', service_route='.')[source]

Handle simple requests required by CANARIE A service can define it’s service_route as ‘.’, in which case, the URL doesn’t have to contain a route token

VestaRestPackage.generic_rest_api.stats(service_route='.')[source]

Required by CANARIE. A service can define it’s service_route as ‘.’, in which case, the URL doesn’t have to contain a route token