GithubHelp home page GithubHelp logo

connor11son / restx-swag Goto Github PK

View Code? Open in Web Editor NEW

This project forked from karmarv/restx-swag

0.0 0.0 0.0 629 KB

Swagger enabled Flask RESTX web services template project

License: MIT License

Shell 5.20% Python 93.54% Dockerfile 1.26%

restx-swag's Introduction

REST Webservices

A Flask RESTX API with Swagger, JWT and SQLAlchemy integration

Environment

  • Setup the requisite package on OS - Refer README.ENV.md
  • Setup docker services - Refer README.ENV.md
  • Clone the current codebase git clone https://github.com/karmarv/restx-swag.git && cd restx-swag
  • Install pre-requisite packages - pip install -r requirements.txt

Services

1. App Webservice - ./src/rest/

Check the secured API instance at http://127.0.0.1:5000/api/v1

  • Swagger Descriptor (http://localhost:5000/api/v1/swagger.json)
  • Secured data access workflow using JWT authentication
    • Register a user
      curl -X 'POST' 'http://127.0.0.1:5000/api/v1/auth/register' -H 'Content-Type: application/json' -d '{ "username": "admin", "password": "Admin@123"}'
      {"id":4,"password_hash":"[Hidden]","refresh_tokens":[],"username":"admin"}
      
    • Login to obtain access token
      curl -X 'POST' 'http://127.0.0.1:5000/api/v1/auth/login' -H 'Content-Type: application/json' -d '{ "username": "admin", "password": "Admin@123" }'
      {"access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjQsImV4cCI6MTcxNDk2NTM1NiwiaWF0IjoxNzE0OTI5MzU2fQ.XNJ2UHbDGsLp5QyR5-Wm61nlWXYNXov4Pfrfmph-Z9o","refresh_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjQsImV4cCI6MTcxNzUyMTM1NiwiaWF0IjoxNzE0OTI5MzU2fQ.xQ7UYjPPEDdLY-F5V_9kQoPcohYmDMk_VSEt-0A8uy8"}
      
    • Access protected resources using token
      curl -X 'GET' 'http://127.0.0.1:5000/api/v1/auth/protected' -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjQsImV4cCI6MTcxNDk2NTM1NiwiaWF0IjoxNzE0OTI5MzU2fQ.XNJ2UHbDGsLp5QyR5-Wm61nlWXYNXov4Pfrfmph-Z9o"
      {"level":"protected","uid":4}
      
  • Swagger UI based access
    • Documentation UI for webservices

      • Swagger UI
    • Authorization: Login and obtain the Bearer token to be filled in Authorize field on right top swagger documentation

      • Auth
    • Access the protected API from the test interface

      • Auth

2. Job/Analytics Webservice - ./src/job/

Check the unsecured backend Job services at http://127.0.0.1:5001/api/v1

  • Job management services [IN-PROGRESS]

    • List all jobs: curl -X 'GET' 'http://127.0.0.1:5001/api/v1/jobs/async' -H 'accept: application/json'
      [{"id": "job11", "job": {"name": "build an API", "type": "MBSP", "data": null}}, {"id": "job22", "job": {"name": "?????", "type": "Count", "data": "http://1.bp.blogspot.com/--M8WrSToFoo/VTVRut6u-2I/AAAAAAAAB8o/dVHTtpXitSs/s1600/URL.png"}}, {"id": "task3", "job": {"name": "profit!", "type": "Count", "data": null}}]
      
  • Swagger UI based access

    • Documentation UI for Job management services
      • Swagger UI

References

restx-swag's People

Contributors

karmarv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.