Friday, 22 July 2016

Building beautiful RESTful APIs using Flask, Swagger UI and Flask-RESTPlus - Michał Karzyński

Building beautiful RESTful APIs using Flask, Swagger UI and Flask-RESTPlus - Michał Karzyński: "This article outlines steps needed to create a RESTful API using Flask and Flask-RESTPlus. These tools combine into a framework, which automates common tasks:


  • API input validation
  • formatting output (as JSON)
  • generating interactive documentation (with Swagger UI)
  • turning Python exceptions into machine-readable HTTP responses




Flask 

 Flask is a web micro-framework written in Python. Since it’s a micro-framework, Flask does very little by itself. In contrast to a framework like Django, which takes the “batteries included” approach, Flask does not come with an ORM, serializers, user management or built-in internationalization. All these features and many others are available as Flask extensions, which make up a rich, but loosely coupled ecosystem.

The challenge, then, for an aspiring Flask developer lies in picking the right extensions and combining them together to get just the right set of functions. In this article we will describe how to use the Flask-RESTPlus extension to create a Flask-based RESTful JSON API.



 Flask-RESTPlus 

 Flask-RESTPlus aims to make building REST APIs quick and easy. It provides just enough syntactic sugar to make your code readable and easy to maintain. The killer feature of RESTPlus is its ability to automatically generate an interactive documentation for your API using Swagger UI.




Swagger UI 

 Swagger UI is part of a suite of technologies for documenting RESTful web services. Swagger has evolved into the OpenAPI specification, currently curated by the Linux Foundation. Once you have an OpenAPI description of your web service, you can use a variety of tool to generate documentation or even boilerplate code in a variety of languages. Take a look at swagger.io for more information."



'via Blog this'

No comments:

Post a Comment