Developing RESTful APIs and Microservices with Flask 1.0.2

In this chapter, we will start our journey toward RESTful Web APIs with Python 3.7 and four different web frameworks. Python is one of the most popular and versatile programming languages. There are thousands of Python packages, and these allow you to extend Python capabilities to any kind of domain you can imagine, such as web development, Internet of Things (IoT), artificial intelligence, machine learning, and scientific computing. We can work with many different web frameworks and packages to easily build simple and complex RESTful Web APIs with Python, and we can combine these frameworks with other Python packages.

We can leverage our existing knowledge of Python and all of its packages to code the different pieces of our RESTful Web APIs and their ecosystem. We can use the object-oriented features to create code that is easier to maintain, understand, and reuse. We can use all the packages that we are already comfortable with to interact with databases, web services, and different APIs. Python makes it easy for us to create RESTful Web APIs. In addition, lightweight frameworks, such as Flask, are ideal candidates for creating microservices that provide RESTful APIs. We don't need to learn another programming language; we can use the one we already know and love.

In this chapter, we will start working with Flask 1.0.2 and its Flask-RESTful extension, and we will create a RESTful Web API that performs CRUD (short for Create, Read, Update, and Delete) operations on a simple list. We will establish the baseline to develop microservices that provide a RESTful API with Flask. We will look at the following topics:

  • Design a RESTful API that performs CRUD operations in Flask with the Flask-RESTful extension
  • Understand the tasks performed by each HTTP method
  • Understand microservices
  • Work with lightweight virtual environments
  • Set up the virtual environment with Flask and its Flask-RESTful extension
  • Declare status codes for the responses with an enumerable
  • Create the model
  • Use a dictionary as a repository
  • Configure output fields
  • Work with resourceful routing on top of Flask pluggable views
  • Configure resource routing and endpoints
  • Make HTTP requests to the Flask API
  • Work with command-line tools to interact with the Flask API
  • Work with GUI tools to interact with the Flask API
  • Consume the API with other programming languages
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.136.165