diff --git a/pygeoapi/api.py b/pygeoapi/api.py index d3fbfee..d36f2d9 100644 --- a/pygeoapi/api.py +++ b/pygeoapi/api.py @@ -2526,11 +2526,31 @@ class API: p2['links'] = p2.get('links', []) jobs_url = '{}/jobs'.format(self.config['server']['url']) + process_url = '{}/processes/{}'.format( + self.config['server']['url'], key) # TODO translation support + link = { + 'type': FORMAT_TYPES[F_JSON], + 'rel': request.get_linkrel(F_JSON), + 'href': '{}?f={}'.format(process_url, F_JSON), + 'title': 'Process description as JSON', + 'hreflang': self.default_locale + } + p2['links'].append(link) + link = { 'type': FORMAT_TYPES[F_HTML], - 'rel': 'collection', + 'rel': request.get_linkrel(F_HTML), + 'href': '{}?f={}'.format(process_url, F_HTML), + 'title': 'Process description as HTML', + 'hreflang': self.default_locale + } + p2['links'].append(link) + + link = { + 'type': FORMAT_TYPES[F_HTML], + 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/job-list', 'href': '{}?f={}'.format(jobs_url, F_HTML), 'title': 'jobs for this process as HTML', 'hreflang': self.default_locale @@ -2539,13 +2559,22 @@ class API: link = { 'type': FORMAT_TYPES[F_JSON], - 'rel': 'collection', + 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/job-list', 'href': '{}?f={}'.format(jobs_url, F_JSON), 'title': 'jobs for this process as JSON', 'hreflang': self.default_locale } p2['links'].append(link) + link = { + 'type': FORMAT_TYPES[F_JSON], + 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/execute', + 'href': '{}/execution?f={}'.format(process_url, F_JSON), + 'title': 'Execution for this process as JSON', + 'hreflang': self.default_locale + } + p2['links'].append(link) + processes.append(p2) if process is not None: diff --git a/pygeoapi/process/hello_world.py b/pygeoapi/process/hello_world.py index 9f66a5b..0e7ce78 100644 --- a/pygeoapi/process/hello_world.py +++ b/pygeoapi/process/hello_world.py @@ -53,7 +53,7 @@ PROCESS_METADATA = { 'keywords': ['hello world', 'example', 'echo'], 'links': [{ 'type': 'text/html', - 'rel': 'canonical', + 'rel': 'about', 'title': 'information', 'href': 'https://example.org/process', 'hreflang': 'en-US' diff --git a/tests/test_api.py b/tests/test_api.py index 70458fd..f5ec2a2 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1116,7 +1116,7 @@ def test_describe_processes(config, api_): assert process['version'] == '0.2.0' assert process['title'] == 'Hello World' assert len(process['keywords']) == 3 - assert len(process['links']) == 3 + assert len(process['links']) == 6 assert len(process['inputs']) == 2 assert len(process['outputs']) == 1 assert len(process['outputTransmission']) == 1