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 StringDescription
todayFrom last midnight to next midnight
yesterdayThe last complete calendar day
last_24_hoursFrom midnight the previous Sunday until midnight the coming Sunday
this_weekSince midnight the previous Sunday
last_weekThe last complete calendar week
this_yearFrom the January 1 to December 31 this year
last_yearThe last complete calendar year
this_monthFrom the first day to the last day of the current month
this_quarterFrom the first day to the last day of the current quarter
last_monthThe last complete calendar month
last_quarterThe last complete calendar quarter
last_7_daysFrom midnight 7 days ago to the present
last_14_daysFrom midnight 14 days ago to the present
last_30_daysFrom midnight 30 days ago to the present
last_90_daysFrom midnight 90 days ago to the present
last_365_daysFrom midnight 365 days ago to the present
last_7_complete_daysFrom midnight 7 days ago to last midnight
last_14_complete_daysFrom midnight 14 days ago to last midnight
last_30_complete_daysFrom midnight 30 days ago to last midnight
last_90_complete_daysFrom midnight 90 days ago to last midnight
last_365_complete_daysFrom midnight 365 days ago to last midnight
pastAny date in the past. Useful for Buzz queries against end_date and similar fields.
futureAny date in the future. Useful for Buzz queries against end_date and similar fields

What’s Next