plone / plone.restapi

RESTful API for Plone.
http://plonerestapi.readthedocs.org/
84 stars 73 forks source link

@aliases endpoint should support filtering by date (from, to) #1792

Open tisto opened 2 weeks ago

tisto commented 2 weeks ago

PR for adding aliases: https://github.com/plone/plone.restapi/pull/1398

The @aliases endpoint allows to filter by path:

http://localhost:8080/Plone/++api++/@aliases&q=/de/ft/my-path

However, there is no way to filter by a date range. This is something the ClassicUI controlpanel allows. I propose to add two new parameters (from, to) to be able to filter for a date range:

http://localhost:8080/Plone/++api++/@aliases&q=/de/ft/my-path&from=2021-11-04&to=2022-01-01

stevepiercy commented 2 weeks ago

For new parameter names, Plone REST API uses start and end attributes for event content types, instead of from and to.

https://6.docs.plone.org/plone.restapi/docs/source/endpoints/content-types.html#event

I don't feel strongly about parameter names, but I think consistency is helpful.

tisto commented 2 weeks ago

@stevepiercy good point! Consistency is indeed crucial. I was under the assumption that plone.app.querystring and zcatalog use from/to. Seems ZCatalog uses just a query tuple without specifying a name for those parameters though.

However, I am not sure if the Event content type is sufficient for the argument. Those are attributes of the Event content type in Plone not necessarily the way date ranges are queried.

In any case. I am undecided and would appreciate more people to chime in. @davisagli @thet @sneridagh maybe?

stevepiercy commented 2 weeks ago

Indeed, there may be many instances of date range parameters, and I lack familiarity with the code base to be authoritative. Someone with more familiarity than I should chime in.

Also hopefully interpretation of the two date parameters would allow the omission of one or the other parameter, effectively allowing a minimum or maximum date without an upper or lower bound.