Creating an extension-based REST interface
In the previous recipe, Creating a class-based REST interface, we saw how to create a REST interface using pluggable views. Here, we will use a Flask extension, Flask-Restless, developed completely from the point of view of building REST interfaces. It provides a simple generation of RESTful APIs for database models defined using SQLAlchemy. These generated APIs send and receive messages in the JSON format.
Getting ready
First, we need to install the Flask-Restless extension:
$ pip install Flask-Restless
We will build over our application from the SQL-based searching recipe of Chapter 4, Working with Views, to include a RESTful API interface.
Tip
It is advisable that you read Chapter 4, Working with Views ...
Get Flask Framework Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.