pycsw icon indicating copy to clipboard operation
pycsw copied to clipboard

Overloading POST request on OGC API Records /items endpoint

Open kalxas opened this issue 3 years ago • 2 comments

Description

Currently we support sending POST requests to /collections/{collectionId}/items with a CQL JSON payload to filter results. With the addition of OGC API Features Part 4 - Transaction support on #781 the POST /collections/{collectionId}/items is now overloaded with create.

The discussion about this is taking place in OGC API Features SWG with no clear resolution yet: https://github.com/opengeospatial/ogcapi-features/issues/449 https://github.com/opengeospatial/ogcapi-features/issues/771

Options are:

  • Use Content-Type of the POST request to determine if the payload is application/cql2+json, application/json, application/geo+json or application/xml
  • Use a POST /collections/{collectionId}/search to send CQL JSON requests
  • Wait for the new HTTP verb QUERY /collections/{collectionId}/items to be adopted.

Environment

  • operating system: GNU/Linux
  • Python version: 3.9
  • pycsw version: master
  • source/distribution
    • [x] git clone
    • [ ] DebianGIS/UbuntuGIS
    • [ ] PyPI
    • [ ] zip/tar.gz
    • [ ] other (please specify):
  • web server
    • [ ] Apache/mod_wsgi
    • [ ] CGI
    • [x] other (please specify): nginx

Steps to Reproduce

from owslib.ogcapi.records import Records
base_domain = "demo.eoepca.org"
system_catalogue_endpoint = f'https://resource-catalogue/.{base_domain}'
w = Records(system_catalogue_endpoint)
my_catalogue_cql_json_query = w.collection_items('metadata:main', limit=1, cql={'op': '=', 'args': [{ 'property': 'title' }, 'S2B_MSIL1C_20190912T084559_N0208_R107_T36UUA_20190912T113801.SAFE']})

with result:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kalxas/code/git/owslib/owslib/ogcapi/features.py", line 75, in collection_items
    return self._request(method='POST', path=path, data=cql, kwargs=kwargs2)
  File "/home/kalxas/code/git/owslib/owslib/ogcapi/__init__.py", line 187, in _request
    raise RuntimeError(response.text)
RuntimeError: {"code": "InvalidParameterValue", "description": "transactions not allowed"}

kalxas avatar Oct 28 '22 09:10 kalxas