Skip to content
Snippets Groups Projects
Commit 441933e6 authored by Cornelia Michlits's avatar Cornelia Michlits
Browse files

104 - ontology change endpoint types as suggested

parent 38016203
No related branches found
No related tags found
3 merge requests!81New stable release,!43Merge dev to master,!37Resolve "Backend: Ontologies"
...@@ -48,26 +48,22 @@ def suggest(): ...@@ -48,26 +48,22 @@ def suggest():
res = {"success": False, "message": str(e)} res = {"success": False, "message": str(e)}
return jsonify(res), 500 return jsonify(res), 500
@app.route('/api/units/validate', methods=["POST"], endpoint='validate') @app.route('/api/units/validate/<unit>', methods=["GET"], endpoint='validate')
@swag_from('validate.yml') @swag_from('validate.yml')
def valitate(): def valitate(unit):
input_json = request.get_json()
try: try:
unit = str(input_json['ustring']) res = validator(unit)
res = validator(stringmapper(unit))
return str(res), 200 return str(res), 200
except Exception as e: except Exception as e:
print(e) print(e)
res = {"success": False, "message": str(e)} res = {"success": False, "message": str(e)}
return jsonify(res) return jsonify(res)
@app.route('/api/units/uri', methods=["GET"], endpoint='uri') @app.route('/api/units/uri/<uname>', methods=["GET"], endpoint='uri')
@swag_from('geturi.yml') @swag_from('geturi.yml')
def geturi(): def geturi(uname):
input_json = request.get_json()
try: try:
name = str(input_json['uname']) res = get_uri(uname)
res = get_uri(name)
return jsonify(res), 200 return jsonify(res), 200
except Exception as e: except Exception as e:
print(e) print(e)
......
...@@ -5,16 +5,11 @@ consumes: ...@@ -5,16 +5,11 @@ consumes:
produces: produces:
- "application/json" - "application/json"
parameters: parameters:
- in: "body" - in: "path"
name: "body" type: "string"
name: "uname"
description: "to-do description" description: "to-do description"
required: true required: true
schema:
type: "object"
properties:
uname:
type: "string"
example : "metre"
responses: responses:
200: 200:
description: "OK" description: "OK"
......
...@@ -5,16 +5,11 @@ consumes: ...@@ -5,16 +5,11 @@ consumes:
produces: produces:
- "application/json" - "application/json"
parameters: parameters:
- in: "body" - in: "path"
name: "body" type: "string"
name: "unit"
description: "to-do description" description: "to-do description"
required: true required: true
schema:
type: "object"
properties:
ustring:
type: "string"
example : "metre"
responses: responses:
200: 200:
description: "OK" description: "OK"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment