plone.restapi icon indicating copy to clipboard operation
plone.restapi copied to clipboard

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

Open tisto opened this issue 1 year ago • 4 comments

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

tisto avatar Jun 15 '24 05:06 tisto

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.

stevepiercy avatar Jun 15 '24 06:06 stevepiercy

@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?

tisto avatar Jun 15 '24 10:06 tisto

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.

stevepiercy avatar Jun 15 '24 12:06 stevepiercy

I see that these start and end filter params are not supported by RedirectControlPanal in plone/ProductCMFPlone.

Another solution could be dealing with this filtering in plone.restapi directly once we get a response from RedirectControlPanel, but as other params like query are being dealt with in Products.CMFPlone, so I'll be adding there first, then will integrate these params here in plone.restapi also.

I am open to suggestions. Thanks, @tisto @stevepiercy.

Faakhir30 avatar Sep 08 '24 11:09 Faakhir30