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

Collections: filter dates require full ISO strings #2766

Open
josephjclark opened this issue Dec 9, 2024 · 0 comments
Open

Collections: filter dates require full ISO strings #2766

josephjclark opened this issue Dec 9, 2024 · 0 comments

Comments

@josephjclark
Copy link
Contributor

When calling out the Collections REST API, we can filter queries by date with created_before, created_after, updated_before, updated_after.

These dates should be any partial ISO 8601 strings, which round to the earliest/latest resolution. So basically if I say created_before=2024-12-08 It'll return anything created before the start of the 8th of December

Per the spec:

updated_after / created_after only returns records GTE this the start of (last second? of) this date
updated_before / created_before only returns records LTE the end of (last second? of) this date

Note: uh is that spec inverted? Anything created before 8th december should not be include. If doing created after, then also anything created on dec 8 should be excluded. I suppose you could also do created_at which includes anything inside that interval - so created_at=2024-12-08 should return anything created on the 8th december.

Anyway, I can simulate this behaviour in the adaptor, but the backing API should really be providing this behaviour

Reproduction

This returns a 400 bad request

curl -X GET http://localhost:4000/collections/stuff?updated_after=2024-12-06 -H "Authorization: Bearer $OPENFN_PAT"

But this is fine:

 curl -X GET http://localhost:4000/collections/stuff?updated_after=2024-12-06T12:00:12.177825Z -H "Authorization: Bearer $OPENFN_PAT"
@github-project-automation github-project-automation bot moved this to New Issues in v2 Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New Issues
Development

No branches or pull requests

1 participant