Time Filters

The following API entry points provide the ability to search for records based on when they were created:

  • GET /posts

  • GET /posts/stats

With each of these endpoints, two parameters work together to specify a time range for records to be included in the results:

  • published_at_from – beginning of the time range

  • published_at_to – end of the time range

Expressing A Time Value

The time values used with these parameters must be expressed with a Unix Epoch Timestamp.

Unix Epoch Timestamp

The Unix Epoch timestamp must be expressed as an integer count of seconds that have elapsed since 00:00:00 UTC on the first of January 1970. A tool such as epochconverter.com may be useful for translating to and from other representations.

For example, noon UTC on the first of January, 2022, would be represented as 1641038400.

Time Range Options

A time range may be specified in the following ways:

  • Specify an explicit start and end time using both parameters.

  • Specify an explicit start and leave the present time as an implied end of the range.

  • Omit both of these parameters to accept a system default time range of recent posts. As of November 2022, the system default time range covers the last seven days of recent posts.

Note that the use of the published_at_to parameter without the published_at_from parameter is not supported and may yield unexpected results.

Explicit Range

The following request will retrieve posts from the first of January, 2022, at noon UTC to noon UTC the following day:

GET /posts?published_at_from=1641038400&published_at_to=1641124800

Explicit Start Of Range With Implied End

Omitting the published_at_to parameter will cause the present time to be the implied end of the time range. The following request will retrieve posts from the first of January, 2022, at noon UTC to the present time:

GET /posts?published_at_from=1641038400

Explicit End Of Range With Implied Start

Omitting both the published_at_to and the published_at_from parameters will imply a default time range of recent posts:

GET /posts

Last updated