Date Filtering on GET
Buzz supports filtering of GET
requests using date ranges and special date syntax.
- Dates are in the format
YYYY-MM-DD HH:MM:SS
- Dates are both read and written in the account-level timezone set in Buzz
GET
filtering may include just the date or the date and time. When just the date is provided, the time is defaulted to midnight.
Examples GET requests using a date field:
#Date greater than or equal to Jan 1, 2020
curl -X GET "[host]/rest/v2/[resource]?create_date__gte=2020-01-01" -b cookies.txt
#Date greater than or equal to Jan 1, 2020 at 2PM (note %20 for space)
curl -X GET "[host]/rest/v2/[resource]?create_date__gte=2020-01-01%2014:00:00" -b cookies.txt
#Date between Jan 1, 2020 and Jan 31, 2020
curl -X GET "[host]/rest/v2/[resource]?create_date__gte=2020-01-01&create_date__lte=2020-01-31%2023:59:59" -b cookies.txt
#Magic date filtering using __range modifier (see below)
curl -X GET "[host]/rest/v2/[resource]?create_date__range=last_7_days" -b cookies.txt
"Magic" Date Requests
Migration Notes from 0.5 API
- In Buzz 0.5 "magic" date fields could be used in the same fashion is proper date time values. In 2.0 you must use the
__range
modifier.- New magic date filters such as
last_7_complete_days
have been added to allow filtering on complete days.
A number of built-in "magic" strings may be used when filtering by a date field. These fields are calculated by Buzz when the query is executed, so the dates included are relative to the current date and time. These should be with the field modifier __range
, for example to specify a create_date
within the last 7 days you would add create_date__range=last_7_days
to your request.
Magic String | Description |
---|---|
today | From last midnight to next midnight |
yesterday | The last complete calendar day |
last_24_hours | From midnight the previous Sunday until midnight the coming Sunday |
this_week | Since midnight the previous Sunday |
last_week | The last complete calendar week |
this_year | From the January 1 to December 31 this year |
last_year | The last complete calendar year |
this_month | From the first day to the last day of the current month |
this_quarter | From the first day to the last day of the current quarter |
last_month | The last complete calendar month |
last_quarter | The last complete calendar quarter |
last_7_days | From midnight 7 days ago to the present |
last_14_days | From midnight 14 days ago to the present |
last_30_days | From midnight 30 days ago to the present |
last_90_days | From midnight 90 days ago to the present |
last_365_days | From midnight 365 days ago to the present |
last_7_complete_days | From midnight 7 days ago to last midnight |
last_14_complete_days | From midnight 14 days ago to last midnight |
last_30_complete_days | From midnight 30 days ago to last midnight |
last_90_complete_days | From midnight 90 days ago to last midnight |
last_365_complete_days | From midnight 365 days ago to last midnight |
past | Any date in the past. Useful for Buzz queries against end_date and similar fields. |
future | Any date in the future. Useful for Buzz queries against end_date and similar fields |
Updated over 4 years ago