Python REST API

Some quick notes:

  • FLASK is a module for Python that sets up a mini web-server, including some routing
  • FLASK-Restx is a plugin for FLASK that gives you a bit more REST like functionality, and allows you to build an API
  • Restx is a fork of Restful, which apparently is no longer maintained. The team decided to fork it because the original maintainer didn’t release the py permissions or something, so the new team couldn’t create any new releases, so the latest version is now called Restx

Instead of regurgitating code samples I’ve found on the web, I’ll list some info that took me far to long to find

Namespaces and Blueprints

The examples on how to build a API and pretty basic and don’t go into the detail of scaling up and using a DRY principle.

Blueprints is a way to group similar functionality together. You can group all your /user endpoints in one blueprint for example. You can supply a ‘url_prefix’ to the command which allows you to sort of pick up and move groups of functionality of you API around to a different route if you like, sort of functions like an entry point. I.e one day you may want to change the name from /user to /people