colymba / silverstripe-restfulapi

SilverStripe RESTful API with a default JSON serializer.
BSD 3-Clause "New" or "Revised" License
64 stars 33 forks source link

Getting records by date greater than or less than? #71

Closed mjvcallibrity closed 8 years ago

mjvcallibrity commented 8 years ago

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 8 years ago

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 8 years ago

You have been immensely helpful and the query works like a charm. Many thanks!