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
2
votes
2 answers

Flask Restplus check for required headers

I want to check if the request has provided the required headers using Flask-RestPlus. I tried using the https://flask-restful.readthedocs.io/en/0.3.5/reqparse.html which I used before to check the body for required parameters and it works but I…
Reub
  • 121
  • 2
  • 13
2
votes
1 answer

Model definition of array data in python flask-restplus swagger

I am using flask_restplus swagger in flask for api documentation. I want to create a model definition for an api that post data to the database. My problem is that, data is in array form. I am sending data in following format with post request. { …
Lama Madan
  • 617
  • 1
  • 10
  • 22
2
votes
1 answer

how to add namespace.expect for parameters passed in url as argument

I have written below Resource Class: @clinic_api_ns.route("/patient/profile") class PatientProfile(Resource): def get(self): patient = request.args.get(patient) relative = request.args.get(relative) relationType =…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
2
votes
1 answer

Decorating GET method with api.expect() Flask-RESTPlus

I have an endpoint that I decorated with api.expect(), but I am getting this error. { "message": "Input payload validation failed", "errors": { "": "None is not of type u'object'" } } This is what my code looks like for…
ellaRT
  • 1,346
  • 2
  • 16
  • 39
2
votes
1 answer

How can I implement a rest that has both an upload and a a payload in flask-restplus

I've got the following code for flask-restplus. The POST request generates a Swagger UI that allows to upload a file. Then I want the PUT request to also allow for a file to upload from Swagger UI and also provide a payload body. For this code the…
RaamEE
  • 3,017
  • 4
  • 33
  • 53
2
votes
0 answers

Authorization header passed from swagger doesnt get properly parsed missing Bearer

I have a blueprint defined in flask init.py from flask_restplus import Resource, Api from . import api_blueprint as _bp api = Api(_bp, prefix="/api") user_namespace = api.namespace("user", description="APi for User management") Then I am using…
Chang Zhao
  • 631
  • 2
  • 8
  • 24
2
votes
1 answer

flask-restplus nested namespace with blueprint and namespace

I made api server with flask-restplus. While working with it, I noticed that it maybe have to versioning for scaling up. So refer the docs, I found Namespace and Blueprint is usuable. First, file structure like this. /app - /main -…
Hide
  • 3,199
  • 7
  • 41
  • 83
2
votes
2 answers

How to edit Flask-plus default swagger-UI text

I am developing a simple rest api that only has two Get methods so far. It's working fine etc, and looks pretty great when I navigate to the url thanks to the built in swagger documentation. However I do not actually see a yaml or json file…
user10364045
2
votes
2 answers

flask-restplus - model inheritance and json fields order

I have defined 2 models in my flask-restplus app. some_model = ns.model('SomeModel', { 'a': fields.String, 'b': fields.String, 'c': fields.String }) some_model_expanded = ns.inherit('SomeModelExpanded', some_model, { 'd':…
user1285245
  • 423
  • 3
  • 9
2
votes
1 answer

Flask Restplus return columns join query

I have two models that relate to each other. I want to make an inner join between the two models and return it in a specific path. The problem is that the disc only accepts the columns of a single model. Sorry for the bad writing. I want all Fields…
2
votes
1 answer

Pylint error "R0201: POST Method could be a function (no-self-use)"

Consider: @api.route('/my-resource/', endpoint='my-resource') @api.doc(params={'id': 'An ID'}) class MyResource(Resource): @api.doc(responses={403: 'Not Authorized'}) def post(self, id): api.abort(403) Pylint complains: R0201:…
gautam
  • 384
  • 5
  • 11
2
votes
0 answers

Foreign key isn't working properly in Flask SQLAlchemy

Trying to do a GET request to return all cows with their vaccinations but vaccinations always return null. I've set the db models for both vaccines and cows to be linked. I'm not sure whats wrong. Git repo is here to reproduce the problem:…
fardown
  • 713
  • 2
  • 12
  • 23
2
votes
1 answer

Swagger Nginx flask-restplus

I'm trying to get the Swagger UI from Flask-RESTplus working on a server using Nginx as a proxy. Swagger served on /api and works locally using http://localhost:5000/api . I'm trying to setup the Nginx as a proxy so I can go to http://ServerIP/api…
brau
  • 93
  • 1
  • 8
2
votes
1 answer

Flask restplus model

I'm looking for way to represent as a restplus Api.model as a dictionary, the api that I have receives on a post call data such as {"name": "the_name", "data": {"data_specific_key", "value", "key2": "value2" .... } } // The data is dynamic, no way…
silviud
  • 1,015
  • 1
  • 12
  • 21
2
votes
1 answer

How to document HTTP POST/PUT data-binary upload in flask restplus swagger?

How to document HTTP POST/PUT data-binary upload in flask restplus swagger? flask plus swagger I can simply use cURL command below to hit the service, but i not sure how to document it in swagger. Thanks url -v -X PUT -H 'Accept: application/json'…
Postalzc -
  • 21
  • 2