Skip to content

Rest-API Date-Time objects are epoch not strings #5445

@jansenm

Description

@jansenm

Current Behavior

According to the documentation all dates (as far as i can see) are documented as:

      "ManagedUser" : {
        "required" : [ "lastPasswordChange", "username" ],
        "type" : "object",
        "properties" : {
          ...,
          "lastPasswordChange" : {
            "type" : "string",
            "format" : "date-time"
          },

So supposedly they are string with a datetime format. Unfortunately this:

~# curl -X "GET" "${DEPENDENCY_TRACK_URL}/api/v1/team"  -H "X-Api-Key: ${DEPENDENCY_TRACK_API_KEY}" | jq .[].managedUsers
[
  {
    "username": "admin",
    **"lastPasswordChange": 1760094591720,**
    "fullname": "Administrator",
    "email": "admin@localhost",
    "suspended": false,
    "forcePasswordChange": false,
    "nonExpiryPassword": true
  }
]
[]
[]

does not look like a string. Its apparently epoch in milliseconds. This breaks a lot of bindings out there that assume you can take the openapi.json file at face value.

Steps to Reproduce

See above

Expected Behavior

The openapi.json file documents the correct format that the api returns.

Dependency-Track Version

v4.13.5

Dependency-Track Distribution

Container Image

Database Server

PostgreSQL

Database Server Version

No response

Browser

Google Chrome

Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    api docsapi-inconsistencydefectSomething isn't workingp2Non-critical bugs, and features that help organizations to identify and reduce riskpending releasesize/SSmall effort

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions