Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-19287

Webhooks REST API returns incorrect timestamps for created and updated dates

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Low
    • None
    • 8.9.0, 8.9.7, 8.19.1
    • API - REST

    Description

      Issue Summary

      The Webhooks REST API endpoint, /rest/api/latest/projects/<PROJ>/repos/<REPO>/webhooks*, is returning incorrect timestamps for the createdDate and updatedDate fields. The issue is that the epoch timestamp returned for these fields is being updated to the current timestamp at the time the API is called. As a result, each time we access this endpoint, both of these values reflect the current time, rather than the actual creation or update times of the webhook.

      This is reproducible on Data Center: yes

      Steps to Reproduce

      1. Invoke the webhook API endpoint, either for a specific webhook or for all webhooks.
      2. Observe the values of createdDate and updatedDate.

      Expected Results

      The createdDate and updatedDate fields should accurately reflect the timestamp for when the webhook was originally created and last updated, respectively.

      Actual Results

      The createdDate and updatedDate fields are displaying the timestamp for when the API call was made. This is demonstrated in the following examples:

      First call:

      {
        "id": 1,
        "name": "calibration webhook",
        "createdDate": 1709896932275,
        "updatedDate": 1709896932275,
        "events": [
          "pr:opened",
          "repo:refs_changed"
        ],
        "configuration": {
          "createdBy": "bitbucket"
        },
        "url": "https://webhook.site/a44dc0db-d73a-40d6-b1b6-1bd801ad3371",
        "active": true,
        "scopeType": "repository",
        "sslVerificationRequired": true
      } 
      

      Second call, a few moments after the first:

      {
        "id": 1,
        "name": "calibration webhook",
        "createdDate": 1709897074546,
        "updatedDate": 1709897074546,
        "events": [
          "pr:opened",
          "repo:refs_changed"
        ],
        "configuration": {
          "createdBy": "bitbucket"
        },
        "url": "https://webhook.site/a44dc0db-d73a-40d6-b1b6-1bd801ad3371",
        "active": true,
        "scopeType": "repository",
        "sslVerificationRequired": true
      } 

      Workaround

      To obtain the correct creation date of the webhook, use the alternative endpoint /rest/auditing/1.0/events?search=webhook.

      Attachments

        Issue Links

          Activity

            People

              8f36004e07e8 Milly Wilson
              0d126627ee05 Gustavo Saviano Silva
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: