chg: [api] include description of the API endpoints
parent
d41d66f906
commit
b4ee28b11c
|
@ -6,7 +6,7 @@ import uuid
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.url_map.strict_slashes = False
|
app.url_map.strict_slashes = False
|
||||||
api = Api(app, version=version, title='CyCAT.org API', description='CyCAT - The Cybersecurity Resource Catalogue public API services.', doc='/', ordered=True)
|
api = Api(app, version=version, title='CyCAT.org API', description='CyCAT - The Cybersecurity Resource Catalogue public API services.', doc='/', license='CC-BY', contact='info@cycat.org', ordered=True)
|
||||||
import uuid
|
import uuid
|
||||||
import inspect
|
import inspect
|
||||||
import redis
|
import redis
|
||||||
|
@ -52,6 +52,7 @@ class favicon(Resource):
|
||||||
return send_from_directory(os.path.join(app.root_path, 'static'),'favicon.ico',mimetype='image/vnd.microsoft.icon')
|
return send_from_directory(os.path.join(app.root_path, 'static'),'favicon.ico',mimetype='image/vnd.microsoft.icon')
|
||||||
|
|
||||||
@api.route('/list/publisher/<int:start>/<int:end>')
|
@api.route('/list/publisher/<int:start>/<int:end>')
|
||||||
|
@api.doc(description="List publishers registered in CyCAT by pagination (start,end).")
|
||||||
class list_publisher(Resource):
|
class list_publisher(Resource):
|
||||||
def get(self, start, end):
|
def get(self, start, end):
|
||||||
uuids = r.zrange('t:1', start, end)
|
uuids = r.zrange('t:1', start, end)
|
||||||
|
@ -62,6 +63,7 @@ class list_publisher(Resource):
|
||||||
return publishers
|
return publishers
|
||||||
|
|
||||||
@api.route('/list/project/<int:start>/<int:end>')
|
@api.route('/list/project/<int:start>/<int:end>')
|
||||||
|
@api.doc(description="List projects registered in CyCAT by pagination (start,end).")
|
||||||
class list_project(Resource):
|
class list_project(Resource):
|
||||||
def get(self, start, end):
|
def get(self, start, end):
|
||||||
uuids = r.zrange('t:2', start, end)
|
uuids = r.zrange('t:2', start, end)
|
||||||
|
@ -73,6 +75,7 @@ class list_project(Resource):
|
||||||
|
|
||||||
|
|
||||||
@api.route('/lookup/<string:uuid>')
|
@api.route('/lookup/<string:uuid>')
|
||||||
|
@api.doc(description="Lookup UUID registered in CyCAT.")
|
||||||
class lookup(Resource):
|
class lookup(Resource):
|
||||||
def get(self, uuid):
|
def get(self, uuid):
|
||||||
if _validate_uuid(value=uuid):
|
if _validate_uuid(value=uuid):
|
||||||
|
@ -88,6 +91,7 @@ class lookup(Resource):
|
||||||
return {'message': 'UUID is incorrect'}, 400
|
return {'message': 'UUID is incorrect'}, 400
|
||||||
|
|
||||||
@api.route('/parent/<string:uuid>')
|
@api.route('/parent/<string:uuid>')
|
||||||
|
@api.doc(description="Get parent UUID(s) from a specified project or item UUID.")
|
||||||
class parent(Resource):
|
class parent(Resource):
|
||||||
def get(self, uuid):
|
def get(self, uuid):
|
||||||
if _validate_uuid(value=uuid):
|
if _validate_uuid(value=uuid):
|
||||||
|
@ -99,6 +103,7 @@ class parent(Resource):
|
||||||
return {'message': 'UUID is incorrect'}, 400
|
return {'message': 'UUID is incorrect'}, 400
|
||||||
|
|
||||||
@api.route('/child/<string:uuid>')
|
@api.route('/child/<string:uuid>')
|
||||||
|
@api.doc(description="Get child UUID(s) from a specified project or publisher UUID.")
|
||||||
class child(Resource):
|
class child(Resource):
|
||||||
def get(self, uuid):
|
def get(self, uuid):
|
||||||
if _validate_uuid(value=uuid):
|
if _validate_uuid(value=uuid):
|
||||||
|
@ -110,6 +115,7 @@ class child(Resource):
|
||||||
return {'message': 'UUID is incorrect'}, 400
|
return {'message': 'UUID is incorrect'}, 400
|
||||||
|
|
||||||
@api.route('/relationships/<string:uuid>')
|
@api.route('/relationships/<string:uuid>')
|
||||||
|
@api.doc(description="Get relationship(s) UUID from a specified UUID.")
|
||||||
class relationships(Resource):
|
class relationships(Resource):
|
||||||
def get(self, uuid):
|
def get(self, uuid):
|
||||||
if _validate_uuid(value=uuid):
|
if _validate_uuid(value=uuid):
|
||||||
|
@ -121,6 +127,7 @@ class relationships(Resource):
|
||||||
return {'message': 'UUID is incorrect'}, 400
|
return {'message': 'UUID is incorrect'}, 400
|
||||||
|
|
||||||
@api.route('/relationships/expanded/<string:uuid>')
|
@api.route('/relationships/expanded/<string:uuid>')
|
||||||
|
@api.doc(description="Get relationship(s) UUID from a specified UUID including the relationships meta information.")
|
||||||
class relationshipsexpanded(Resource):
|
class relationshipsexpanded(Resource):
|
||||||
def get(self, uuid):
|
def get(self, uuid):
|
||||||
if _validate_uuid(value=uuid):
|
if _validate_uuid(value=uuid):
|
||||||
|
|
Loading…
Reference in New Issue