REST API v2: Creating a database returns createdAt date as number, but should be date-time format

Heinrich Ulbricht _WikiTraccs_
Contributor
September 23, 2024

When using the REST API to (successfully) create a Confluence database, the returned createdAt date is returned as number like so:

"createdAt": 1727122655397

The documentation claims that the data type should be string and have date-time format, like so:

"createdAt": "2024-09-23T20:17:35.607Z"
When creating a page instead of a database, the returned createdAt date has the expected date-time format.
Is this a new format being introduced for the API, a bug, or me doing something wrong?

1 answer

0 votes
Jim Knepley - ReleaseTEAM
Atlassian Partner
September 23, 2024

That number is the "epoch" time that relates to "Monday, September 23, 2024 8:17:35.397 PM"

It's easily converted, but that's not the point. I agree that the value isn't what is documented, and one or the other should be updated. I would report the behavior as a bug to support.

In the meantime, Epoch time is ubiquitous and whatever programming language you're using can certainly convert it. In Python, the datetime library can do it with the fromtimestamp() method.

Heinrich Ulbricht _WikiTraccs_
Contributor
September 23, 2024

@Jim Knepley - ReleaseTEAM I agree that the number timestamp is fine as well, if not better. In my case a JSON to domain object converter got confused because so far, and according to the docs, it expected a date-time string. This can be changed for sure.

But dates being represented by different types in the same data structure? Because the createdAt in the history property is still returned as string. This just doesn't feel right and looks like an oversight.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events