Chapter 7. AJAX and RESTful APIs
In this chapter, we will use Flask-Restless to create a RESTful API for the blogging app. A RESTful API is a way of accessing your blog programmatically, by providing highly structured data that represents your blog. Flask-Restless works very well with our SQLAlchemy models and also handles complex tasks such as serialization and result filtering. We will use our REST API to build an AJAX-powered commenting feature for our blog entries. By the end of this chapter, you will be able to create easily-configurable APIs for your SQLAlchemy models, and you'll make and respond to AJAX requests in your Flask app.
In this chapter we shall:
- Create a model to store comments on blog entries
- Install Flask-Restless
- Create a RESTful API for the comment model
- Build a frontend for communicating with our API using Ajax