Commit aaad5e8f authored by militarpancho's avatar militarpancho

Add 'help' as a parameter to the API, with two options: "true" and "false". It is false by default.

Modify all the /api blueprint to export the list of available params
parent 312e7f7f
......@@ -39,6 +39,14 @@ API_PARAMS = {
"required": True,
"options": ["filtered", "nested", "full"],
"default": "full"
},
"help": {
"@id": "help",
"description": "Show additional help to know more about the possible parameters",
"aliases": ["help", "h"],
"required": True,
"options": ["True", "False"],
"default": "False"
}
}
......
......@@ -20,7 +20,7 @@ Blueprints for Senpy
from flask import (Blueprint, request, current_app, render_template, url_for,
jsonify)
from .models import Error, Response, Plugins, read_schema
from .api import WEB_PARAMS, API_PARAMS, parse_params
from .api import WEB_PARAMS, API_PARAMS, CLI_PARAMS, NIF_PARAMS, parse_params
from .version import __version__
from functools import wraps
......@@ -144,3 +144,21 @@ def plugin(plugin=None):
else:
return Error(message="Plugin not found", status=404)
return response
@api_blueprint.route('/params/', methods=['POST', 'GET'])
@basic_api
def params():
phelp = request.params.get('help')
if eval(phelp):
dic = {'WEB_PARAMS': WEB_PARAMS,
'CLI_PARAMS': CLI_PARAMS,
'NIF_PARAMS': NIF_PARAMS,
'API_PARAMS': API_PARAMS
}
response = Response(dic)
return response
else:
response = Response(request.params)
return response
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment