November 2014
Intermediate to advanced
258 pages
5h 15m
English
In this recipe, we will convert the API structure created in the previous recipe, Creating a SQLAlchemy-independent REST API, into a full-fledged RESTful API interface.
We will take the API skeleton from the previous recipe as the base to create a complete functional SQLAlchemy-independent RESTful API. Although we will use SQLAlchemy as the ORM for demonstration, this recipe can be written in a similar fashion for any ORM or underlying database.
The following lines of code are the complete RESTful API for the Product model. These code snippets will go into the views.py file:
from flask.ext.restful import reqparse parser = reqparse.RequestParser() parser.add_argument('name', type=str) parser.add_argument('price', ...Read now
Unlock full access