400 Bad Request: Invalid date format in Bitbucket REST API
0 reputation · 20 Aug 2024, 20:50 UTC
Pull Request Date Conversion
When automating pull request creation via the Bitbucket REST API (v2), the system requires date/time values to adhere strictly to the ISO 8601 format. A common failure occurs when a timestamp is provided without an explicit timezone offset, triggering a 400 Bad Request error.
While Bitbucket stores timestamps internally in UTC and renders them in the UI based on the authenticated user's profile settings, the API does not perform automatic conversion from a local time string to UTC based on those user preferences. This requires the calling application to handle the offset conversion prior to the request.
For environments using Bitbucket Server/Data Center (7.0+) or Bitbucket Cloud, there is uncertainty regarding the most reliable way to synchronize client-side local time with the API's UTC requirement during daylight-saving transitions.
- Does the API support any alternative format that allows the server to infer the timezone from the user's profile?
- What is the recommended method for ensuring the offset-aware ISO 8601 string remains consistent with the user's intended local time during DST shifts?