update API

This commit is contained in:
Tom Kralidis
2018-03-28 17:02:45 -04:00
parent 3f09b5ae67
commit c6aba78716
3 changed files with 30 additions and 5 deletions
+5 -4
View File
@@ -84,9 +84,10 @@ def api_conformance():
@APP.route('/collections')
def describe_collections():
@APP.route('/collections/<name>')
def describe_collections(name=None):
headers, status_code, content = views.describe_collections(
request.headers, request.args)
request.headers, request.args, name)
response = make_response(content, status_code)
if headers:
@@ -95,8 +96,8 @@ def describe_collections():
return response
@APP.route('/collections/<feature_collection>/')
@APP.route('/collections/<feature_collection>/<feature>')
@APP.route('/collections/<feature_collection>/items')
@APP.route('/collections/<feature_collection>/items/<feature>')
def dataset(feature_collection, feature=None):
if feature is None:
headers, status_code, content = views.get_features(
+21
View File
@@ -149,8 +149,29 @@ def get_oas_30(cfg):
tag['externalDocs']['description'] = link['type']
tag['externalDocs']['url'] = link['url']
break
oas['tags'].append(tag)
paths['/collections/{}'.format(k)] = {
'get': {
'summary': 'Get feature collection metadata'.format(v['title']), # noqa
'description': v['description'],
'tags': [k],
'responses': {
200: {
'description': 'successful operation'
},
400: {
'description': 'Invalid ID supplied'
},
404: {
'description': 'not found'
}
}
}
}
paths['/collections/{}/items'.format(k)] = {
'get': {
'summary': 'Get {} features'.format(v['title']),
'description': v['description'],
+4 -1
View File
@@ -150,7 +150,7 @@ def api_conformance(headers, args):
return headers_, 200, json.dumps(conformance)
def describe_collections(headers, args):
def describe_collections(headers, args, name=None):
"""
Provide feature collection metadata
@@ -194,6 +194,9 @@ def describe_collections(headers, args):
lnk = {'rel': link['type'], 'href': link['url']}
collection['links'].append(lnk)
if name is not None and k == name:
return headers_, 200, json.dumps(collection)
fcm['collections'].append(collection)
if format_ == 'html': # render