Micro Services Classroom Series – 14/Dec/2021

API Rate-Limiting Contd

  • We want to ease the rate limit for our developers and testers of API
  • We would like to set up an IP whitelist that can allow certain IP addresses to use the API without any rate limit
  • Refer Here

Open API Specification

  • Refer Here for the Open API Specification
  • Api documentation is a technical instruction about how to effective use an api, Its a concise reference manual containing all the information required to work with API like URI, request parameters, return tyoes etc
  • Swagger allows you to describe the structure of your API’s so that machines can read them.
  • By reading the API structure, swagger can automatically build interactive API documentation.
  • Swagger does this taks by asking your API to return a YAML or JSON that contains detailed description of entire API according to open API Specification
  • Lets try to generate the Open API Specification and Swagger interactive documentation for our api’s developed in Flask
  • In Flask we have an extension which is Flask-apispec
  • Lets install Flask-apispec pip install flask-apispec
  • Refer Here for the changes to add swagger ui and flask api spec implementation.
  • Now access the application http://localhost:5000/swagger Preview
  • Now access the application url http://localhost:5000/swagger-ui Preview
  • We would get interactive documentation.
  • Next steps:
    • Lets make our swagger documentation correct and easier to understand.
    • Lets start building api’s with django-restful
    • These changes have broken our code, we will fix them in our next session.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin