Getting records by date greater than or less than?
Closed this issue · 2 comments
mjvcallibrity commented
Hi,
I was wondering if it is presently build into the silverstripe-restfulapi to query for a record that is greater than or less than a provided value?
Example: www.mydomain.net/api/events?startDate__gt=2016-07-14
Thanks!
colymba commented
Hi, yes it is. As long as those filters are recognised by SilverStripe.
API doc here: https://github.com/colymba/silverstripe-restfulapi/blob/master/doc/DefaultQueryHandler.md#search-filter-modifiers
SilverStripe filters: https://docs.silverstripe.org/en/3.4/developer_guides/model/searchfilters/
So you should be able to do something like ?StartDate__GreaterThan=2016-07-14
mjvcallibrity commented
You have been immensely helpful and the query works like a charm. Many thanks!