Questions tagged [flask-restplus]

Flask-RESTPlus is an extension for Flask that adds support for quickly building REST APIs documented with Swagger

Flask-RestPlus provide syntaxic suger, helpers and automatically generated Swagger documentation on top of Flask-Restful. It provides a bunch of decorators and helpers to quickly build documented and maintainable APIs with Flask.

Website: https://flask-restplus.readthedocs.io/

330 questions
3
votes
1 answer

Intercept the Validation error from Flask restplus namespace class

Currently the Namespace parser validates the request arguments and throws error like { "errors": { "file": "Missing required parameter in an uploaded file" }, "message": "Input payload validation failed" } From the flask-app i…
geekops
  • 505
  • 8
  • 21
3
votes
1 answer

How to change from API to domain name in Flask-restplus API?

I am trying to forward my flask api to mydomain.example with the end point being api.mydomain.example For example, my method ping would have a end point api.mydomain.example/v1/server/ping. However, what I get is xx.xxx.xxx.xx:5005/v1/server/ping as…
zeh
  • 1,197
  • 2
  • 14
  • 29
3
votes
2 answers

Second Blueprint registered in Flask Restplus does not show up in swagger

Given this Flask Restplus app: from flask import Blueprint, Flask from flask_restplus import Api, Resource base_api_blueprint = Blueprint('base_api', __name__) base_api = Api(base_api_blueprint) bff_api_blueprint = Blueprint('bff_api',…
Mike Hogan
  • 9,933
  • 9
  • 41
  • 71
3
votes
1 answer

How to design api implementation for web using flask restplus?

I am writing REST api in flask for the first time, so now I have something like this: import uuid import pytz from datetime import datetime from flask_restplus import Resource, Api, fields from ..models import publicip_schema from ..controller…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
3
votes
0 answers

swagger UI not reachable while running on Docker proxied through Nginx and hosted by gunicorn

I have a Flask (with Flask-restplus) app running locally on port 5000. When I launch the app locally and go below URL I can see the Swagger UI. http://localhost:5000/api/# But when I run it behind NGINX, gunicorn and go to …
Mateen-Hussain
  • 718
  • 1
  • 13
  • 29
3
votes
1 answer

How to limit what gets returned with fields.list in Flask-RestPlus

Every building has units and every unit is associated with an account. There can be many accounts associated with a unit. There can only be one account per unit with a status of "active". The API returns a list of all the units, and nested within…
Benjamin Kozuch
  • 150
  • 1
  • 8
3
votes
1 answer

Flask_restplus recursive json_mapping

Is it possible to provide recursive mapping for objects using same json_mapping? exapmle: person_json_mapping = api.model('Person', { 'name': fields.String(), 'date_of_birth': fields.Date(), 'parents':…
Decepol
  • 33
  • 4
3
votes
2 answers

Flask-Restplus / route

I'm trying to use Flask-Restplus to make an api and document it with swagger. This is what I have so far and it works fine except I do not know how to add a root route. from flask import Flask, Blueprint from flask_restplus import Api, Resource,…
theo_ni
  • 45
  • 2
  • 5
2
votes
0 answers

python flask-restx - how to avoid creating different models for post and get

I am trying to rest server with python flask-restx module. My table has two columns id and value. id column is a auto-increment primary key. so for post I don't need to pass id but for get I need show it in the response. Is there any way I can…
Gaurang Shah
  • 11,764
  • 9
  • 74
  • 137
2
votes
2 answers

flask-restplus /flask-restx automatically add 401 response to Swagger docs if authentication is on

As the title mentions, I would like to have a @api.response(401, 'Unauthenticated') response added to the documentation of all APIs which require authentication. flask-resplus/restx displays a lock icon, so the user should expect a 401 if not…
mibm
  • 1,328
  • 2
  • 13
  • 23
2
votes
0 answers

Adding specific string validations in Flask RestPlus

I am creating an API that allows a user to export details of specified products from the database. I need addition validation on the 'product' field other than the default validation that checks for datatype and length of string. I have defined the…
Vinay
  • 699
  • 4
  • 22
2
votes
1 answer

Working with flask restplus Namespace and blueprint

I am working with my first flask-RESTplus application and running into issues. Here is how my project is structured: proj/ - endpoints/ - __init__.py - example1.py - app.py This is what I have in my init.py: from flask import…
user2966197
  • 2,793
  • 10
  • 45
  • 77
2
votes
1 answer

flask restx enum model

How to create an Enum api model in flask restx with one string field without other properties so that the following description is generated in swagger.yml? definitions: Colors: type: string enum: [black, white, red, green,…
Nicolay
  • 71
  • 2
  • 5
2
votes
1 answer

How to handle authentication in different flask microservices

I'm pretty new to development. So, sorry in advance for potentially stupid question: I'm trying to implement a simple application with 2 micro services: User Api TODO Api I've started implementing auth part and came across something that I don't…
2
votes
0 answers

Swagger page has uncaught exceptions flask restplus

I have a flask restplus app which has an API page documented in a swagger interface. This page comes up happily and I can use it when it is run locally. I have it working inside a docker container with the ProxyFix from WerkZeug. However when I put…
David Boshton
  • 2,555
  • 5
  • 30
  • 51