Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to /collection/<missing>/items returns 200 #120

Closed
TomAugspurger opened this issue Mar 30, 2021 · 3 comments · Fixed by #528
Closed

Request to /collection/<missing>/items returns 200 #120

TomAugspurger opened this issue Mar 30, 2021 · 3 comments · Fixed by #528
Assignees
Labels
pgstac spec Compliance with STAC/OGC specifications sqlalchemy
Milestone

Comments

@TomAugspurger
Copy link

If I make a request to an endpoint for a collection that doesn't exists, I get a 404

In [14]: import requests

In [19]: r = requests.get("https://pct-pqe-staging.westeurope.cloudapp.azure.com/stac/v1/collections/not-a-collection")

In [20]: r.status_code
Out[20]: 404

But if I make a request to that collection's /items I get a 200, and the response includes an empty FeatureCollection.

In [21]: r = requests.get("https://pct-pqe-staging.westeurope.cloudapp.azure.com/stac/v1/collections/not-a-collection/items")

In [22]: r.status_code
Out[22]: 200

In [23]: r.json()
Out[23]:
{'type': 'FeatureCollection',
 'features': [],
 'links': [],
 'context': {'returned': 0, 'matched': 0}}

I wanted to verify that this is the expected behavior. I didn't find anything in the API spec, but I admittedly didn't look too closely.

Reported in TomAugspurger/stac-dask-discussion#1

@geospatial-jeff
Copy link
Collaborator

I also can't find anything in the spec, but this smells funny to me. I think it would be more RESTful to return a 404 in this case since the resource being requested doesn't exist on the server (an item can't exist outside of a collection).

@philvarner philvarner added the spec Compliance with STAC/OGC specifications label Mar 24, 2022
@philvarner
Copy link
Collaborator

philvarner commented Mar 24, 2022

OAFeat Part 1 says for both /collection/ and /collection//items:

If the parameter collectionId does not exist on the server, the status code of the response
will be 404 (see [Table 2](https://docs.opengeospatial.org/is/17-069r3/17-069r3.html#status_codes)).

@geospatial-jeff
Copy link
Collaborator

Not sure if this is happening in sqlalchemy backend, added label anyways to investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pgstac spec Compliance with STAC/OGC specifications sqlalchemy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants