pygeoapi icon indicating copy to clipboard operation
pygeoapi copied to clipboard

`next` and `previous` response doesn't match OGCAPI specs

Open KoalaGeo opened this issue 2 years ago • 1 comments

Description Raising issue from https://github.com/geopython/pygeoapi/pull/964#issuecomment-1253718995

As part of the HTML response pygeoapi includes next and prev fields with the IDs of the adjacent records. For the first record in the table, the prev is set to the same record ID (i.e. the first record), and for the last record in the table next is set to the last record. See the code here:

https://github.com/geopython/pygeoapi/blob/e2e12e9bd4395b453cc382084cd7c33172662b3a/pygeoapi/provider/postgresql.py#L415-L416

This could cause problems with looping as consumers of the data will never know when they have exhausted the table. The OGC API specs suggest that the next field should only be present if another record exists.

Also links point to HTML, but should default to JSON

Expected behavior The response should be changed so that prev/next only exist if they are valid. The server URL would need to be added by the API as the provider doesn't know about those. It doesn't seem like they are used in the JSON response, e.g.

https://ogcapi.bgs.ac.uk/collections/historicalearthquakes/items/8?f=json

KoalaGeo avatar Sep 26 '22 08:09 KoalaGeo

As per RFC4, this Issue has been inactive for 90 days. In order to manage maintenance burden, it will be automatically closed in 7 days.

github-actions[bot] avatar Mar 10 '24 21:03 github-actions[bot]

As per RFC4, this Issue has been closed due to there being no activity for more than 90 days.

github-actions[bot] avatar Mar 31 '24 03:03 github-actions[bot]