opengeospatial / OGCAPI-EDR-Sprint2

This Github repository is for the second OGC API - EDR code sprint focusing on the OGC API - Environmental Data Retrieval candidate standard.
1 stars 6 forks source link

NWS Implementation - Response changes to JSON only when using outputFormat, not when sending content-type headers #7

Closed ShaneMill1 closed 3 years ago

ShaneMill1 commented 4 years ago

@ghobona reported to me that the landing page of the API only returns in HTML. When sending a header for content-type being application/json, the response for the landing page still only returns HTML.

This is not intended so I will look into modifying the implementation in a test environment first before redeploying to the public facing page

ShaneMill1 commented 3 years ago

Found the issue, need to add logic for both content-type and outputFormat:

def root(self, headers, args):
        """
        Provide API

        :param headers: dict of HTTP headers
        :param args: dict of HTTP request parameters

        :returns: tuple of headers, status code, content
        """
        if args.get('outputFormat'):
           content_type=args.get('outputFormat')
        else:
           content_type=headers['Content-Type']
ShaneMill1 commented 3 years ago

In addition, need to change "outputFormat" to "f"

ShaneMill1 commented 3 years ago

Above noted changes have been made in a testing environment. Will push to public facing page after hours.

Finally, changes were made to make the JSON output for the landing page more complete to contain a title, description, and links list.

ShaneMill1 commented 3 years ago

these changes have been pushed to the public facing page