1.3. backendapp.api.baseresource

An API consists of resources that inherit from BaseResource.

class backendapp.api.baseresource.BaseResource(Schema, service)[source]

Contains class variables common to all resources.

__init__(Schema, service)[source]

Constructor for the BaseResource class.

Parameters
  • Schema – Marshamallow schema for the model associated with the service.

  • service – for creating and retrieving model instances.

class backendapp.api.baseresource.MultipleResource(Schema, service)[source]

A Resource that appends to or returns a list of model instances.

This is used to post one capture or return a list of tags.

__init__(Schema, service)[source]

Constructor for the BaseResource class.

Parameters
  • Schema – Marshamallow schema for the model associated with the service.

  • service – for creating and retrieving model instances.

get_filtered(reqfilterlist=[], optfilterlist=[])[source]

Get a list of resources filtered by requiredlist and optionally by optlist. Returns:

post()[source]

Instantiate a model instance and return it.

class backendapp.api.baseresource.SingleResource(Schema, service)[source]

A Resource that returns or deletes one model instance.

It is used to retrieve one capture as JSON or delete one tag.

__init__(Schema, service)[source]

Constructor for the BaseResource class.

Parameters
  • Schema – Marshamallow schema for the model associated with the service.

  • service – for creating and retrieving model instances.

delete(id)[source]

Delete a model instance.

Parameters

id – model instance ID to delete.

get(id)[source]

Return a resource schema for the model instance

Parameters

id – model instance ID.