Related pages

HTTP API

Timestamps

The HTTP API uses RFC3339 timestamps both in different JSON objects and in query parameters. Most programming languages have built-in support or a library available for both formatting and parsing a RFC3339 timestamp.

The HTTP API currently normalizes timestamps to UTC in its output.

Example RFC3339 timestamps

1985-04-12T23:20:50.52Z
1990-12-31T15:59:60-08:00
2018-02-17T04:19:03.636Z

JSON

In JSON objects the timestamps is represented by a string with the formatted RFC3339 timestamp.

Query support - single

Exact date

Exact dates are supported both in RFC3339 format and in a more lenient format which takes the date in ISO8601 format with optional hours and minutes.

Examples of lenient format:

  • 2018-02-10 - will be treated as 00:00 UTC on the given date
  • 2017-01-01 10:00 - will be treated as 10:00 UTC on the given date

Use in a query criteria:

{
  "type": "propertyHere",
  "criteria": "2017-01-01 10:00"
}

Relative dates

In addition to exact dates a few relative dates are supported for simpler queries:

  • none - no date should be available
  • any - any date should be available
  • today - todays date at 00:00 UTC
  • tomorrow- tomorrows date at 00:00 UTC
  • closing-today - today before Contentor "closing time", currently 18:00 UTC
  • start-of-week - the start of the current week at 00:00 UTC
  • end-of-week - the end of the current week at 00:00 UTC

Query support - ranges

When timestamps are used in queries they can be queried exactly or as a range.

Simple range

Some simple ranges that consist of a single string are available when querying:

{
  "type": "propertyHere",
  "criteria": "this-week"
}

The following ranges are supported and match using UTC:

  • none - no dates considered within the range
  • past - only dates before now will matched
  • previous-month - match the previous month
  • previous-week - match the previous week
  • yesterday - match yesterday
  • today - match today
  • tomorrow - match tomorrow
  • this-week - match this week, from Monday to Sunday
  • next-week - match next week, from Monday to Sunday
  • this-month - match the current month
  • next-month - match the next month
  • this-year - match the current year
  • future - match only dates in the future

Manual range

Exact dates and relative dates can be combined into a range using a JSON object with from and to properties. One of the properties need to be specified, but if the other is skipped it is treated as an open range.

The from and to properties can be any exact or relative date.

Open range which matches up to today:

{
  "type": "propertyHere",
  "criteria": {
    "to": "today"
  }
}

Open range which matches from today:

{
  "type": "propertyHere",
  "criteria": {
    "from": "today"
  }
}

Open range which matches between two days:

{
  "type": "propertyHere",
  "criteria": {
    "from": "2017-01-01",
    "to": "2018-01-01"
  }
}