Api class

There is not much to say about Api except that it has an optional prefix and decorators. Use:

api.add_resource(YourResource)

To add a resource to the API. You can only add a single resource with a given name.

class flask_potion.Api(app=None, decorators=None, prefix=None, title=None, description=None, default_manager=None)

This is the Potion extension.

You need to register Api with a Flask application either upon initializing Api or later using init_app().

Parameters:
  • app – a Flask instance
  • decorators (list) – an optional list of decorator functions
  • prefix – an optional API prefix. Must start with “/”
  • title (str) – an optional title for the schema
  • description (str) – an optional description for the schema
  • default_manager (Manager) – an optional manager to use as default. If SQLAlchemy is installed, will use contrib.alchemy.SQLAlchemyManager
add_resource(resource)

Add a Resource class to the API and generate endpoints for all its routes.

Parameters:resource (Resource) – resource
Returns: