-
Couldn't load subscription status.
- Fork 116
Description
Hi, when calling the /search endpoint that is implemented here: https://github.com/stac-utils/stac-fastapi/blob/main/stac_fastapi/api/stac_fastapi/api/app.py, it seems we cannot search by date, but only by datetime.
A GET request with /search?datetime=2000-01-01 will fail with this error from https://github.com/stac-utils/stac-fastapi/blob/main/stac_fastapi/types/stac_fastapi/types/rfc3339.py
b'{"detail":"Invalid RFC3339 datetime."}'
A POST request will fail with what seems to by a pydantic error:
b'{"detail":[{"type":"datetime_parsing","loc":["body","datetime"],"msg":"Input should be a valid datetime, invalid datetime separator, expected `T`, `t`, `_` or space","input":"2000-01-01","ctx":{"error":"invalid datetime separator, expected `T`, `t`, `_` or space"}}]}'
We would like to allow our users to search by date without time, then our application (that uses stac_fastapi) would return all products for this whole day. Would this be possible ?
Then we would like to do the same for milliseconds: our products have a ms information, so if the user searches by datetime+ms, we would like to return products only for this specific ms. If he searches by datetime without ms, we would like to return all products for this whole second.
Our problem is that, if he searches for ms=.000 (to have products only for this specific ms) with a GET request e.g. /search?datetime=2000-01-01T01:01:01.000Z, stac_fastpi removes the ms=.000 information: our app receives the value datetime=2000-01-01T01:01:01Z, so it doesn't know anymore if the user wanted only products for this specific ms, or for this whole second. I think this removal is made when stac_fastapi converts the str to datetime in rfc3339_str_to_datetime https://github.com/stac-utils/stac-fastapi/blob/main/stac_fastapi/types/stac_fastapi/types/rfc3339.py#L51 (I couldn't find where this datetime is converted back to str).
To summarize, my two questions are:
- Could a user search by date, not datetime ?
- Could we stop stac_fastpi from removing the "ms=.000" information ?
Thank you :)