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
0 answers

Flask Restplus mutlipart/form-data model

Is it possible with Flask Restplus to create a model for a multipart/form-data request so that I can use it to validate the input with @api.expect? I have this complex data structure for which I've created a api.namespace().model that has to be…
Jurgy
  • 2,128
  • 1
  • 20
  • 33
2
votes
2 answers

Flask-cors is not denying origins as configured

I'm trying to use flask-cors(3.0.8) with flask-restplus(0.13.0), allowing some origins and denying the others, but the cors doesn't deny any cross origin request. My architecture is disposed in a way that use 3 files to initialize my app: 1.…
2
votes
1 answer

Can I have a user-defined error message next to a restplus model?

I have written a Flask application that provides an API. I am using the RESTplus library. I use a model to format the data. If a request is successful, the values are inserted into the model and the model is returned. However, if the request is…
Molitoris
  • 935
  • 1
  • 9
  • 31
2
votes
0 answers

Correct way of passing object instance between modules

SOLVED: Turns out problem comes from gunicorn preloading and forking vs the apscheduler. See comment. Background I am writing a simple flask API that does periodic background query to a SQL database using apscheduler, then serves incoming rest…
Dennis Tai
  • 21
  • 3
2
votes
1 answer

Send multiple parameters to flask-restplus

When creating an API that takes one argument from the request, I use this code: class test(Resource): def get(self,id): return id api.add_resource(test, '/endpoint/') What would I do if I need it to take multiple…
Kresten
  • 810
  • 13
  • 36
2
votes
1 answer

Issue with using fields.Wildcard() in flask_restplus python3

I am trying to build a flask restplus model for the following structure. "data": { "file1": 79, "file2": 72 } file1 and file2 are file names and it changes every time I run the app. The best solution I could think of…
Shashank BR
  • 65
  • 1
  • 6
2
votes
0 answers

Is there a way of displaying a long field description in Flask-RESTPlus with shortened text in the text-box

I'm re-creating an old rest API built with Flask-restful and flask-restful-swagger. I have switched to Flask-RestPlus because it is still being maintained. Some of the input fields (generally Path variables - which I need to keep so I don't upset…
2
votes
0 answers

FlaskRestPlus how to have an optional parameter in the url

I'm new to Flask and Flask-RestPlus. I'm creating a web api where I want keep my POST urls different from the GET urls which are visible in Swagger. For example in Flask-Restplus @api.route('/my_api/') class SavingsModeAction(Resource): …
Rahul Chakrabarty
  • 2,149
  • 7
  • 39
  • 70
2
votes
0 answers

Implement generic decorators on all methods

Try to create custom decorator to all method on class(the class is flask-restplus resoucure) from flask_restplus import Resource, Api test_blueprint = Blueprint('test', __name__) test_api = Api(test_blueprint) test_namespace =…
Dan Cohen
  • 43
  • 5
2
votes
3 answers

How do you pass default values to payload in flask-restplus?

I am setting up an restplus API, and want some default fields to be passed if the query don't contain these values. How do i pass these using an api model, preferably without the use of requestParser? As it stands now, the payload doesn't get…
kklocker
  • 136
  • 1
  • 10
2
votes
2 answers

Flask route at / returns 404 when used with Flask-Restplus

I have a Flask app which has a Flask-RestPlus API as well as a "/" route. When I try to access "/" however, I get a 404. If I remove the Flask-RestPlus extension, the route works. How do I make both parts work together? from flask import Flask from…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
2
votes
1 answer

How can I add app-wrappers endpoint to Restplus API documentation?

I have a Flask REST API. I use healthcheck.EnvironmentDump to make it easy to dump the environment where my service is running. Is it possible to add the endpoint to the Swagger documentation generated by…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
2
votes
2 answers

When using flask-restplus, how do I marshal a json which is a simple list (with no attribute)?

I am developing an API using flask-restplus. One of my endpoint returns a list of object, e.g. [ { "id": "1342", "index": "meta", "score": 3.0630198 }, { "id": "1645", "index": "meta", "score": 3.0630198 }, { …
2
votes
1 answer

Ordering of parameters in Swagger-ui

I'm using Flask and Flask-restplus to build an API with a swagger UI. Routes seem to be displayed in alphabetical order, but as for parameters of these routes, they seem to be displayed in a completely random order that changes every time I re-build…
Fatalize
  • 3,513
  • 15
  • 25
2
votes
0 answers

Accessing MySQL database through flask-restplus in python with Swagger

I am using the flask and flask_restplus to build an rest api in python. The directory structure i followed is same in the link below under the heading Multiple APIs with reusable…
niharika Singhal
  • 61
  • 1
  • 1
  • 10