How could I get the update time of a branch in bit_bucket?

when I used url like https://api.bitbucket.org/2.0/repositories/team_name/repository/refs/branches/?pagelen=100&pagelen=100&pagelen=100&pagelen=100&pagelen=100&page=6 to get branches’ data , it works!
But I can only get one time field called “date” in the return of the response which we think is branch’s create time.
How could I get the update time of a branch in bit_bucket?

the json data below is one of the branches:

    {
      "name": "task/moveFast",
      "links": {
        "commits": {
          "href": ""
        },
        "self": {
          "href": ""
        },
        "html": {
          "href": ""
        }
      },
      "default_merge_strategy": "squash",
      "merge_strategies": [
        "merge_commit",
        "squash",
        "fast_forward"
      ],
      "type": "branch",
      "target": {
        "hash": "c2163bf167afba9d4e9b8366e4cdb695aa9987c2",
        "repository": {
          "links": {
            "self": {
              "href": ""
            },
            "html": {
              "href": ""
            },
            "avatar": {
              "href": ""
            }
          },
          "type": "repository",
          "name": "",
          "full_name": "",
          "uuid": "{02a67b69-0a53-4a01-90a7-45c84bf7a285}"
        },
        "links": {
          "self": {
            "href": ""
          },
          "comments": {
            "href": ""
          },
          "patch": {
            "href": ""
          },
          "html": {
            "href": ""
          },
          "diff": {
            "href": ""
          },
          "approve": {
            "href": ""
          },
          "statuses": {
            "href": ""
          }
        },
        "author": {
          "raw": "",
          "type": "author",
          "user": {
            "display_name": "",
            "uuid": "{9f90346d-c672-45d4-bcfc-cd21a3dbbd56}",
            "links": {
              "self": {
                "href": ""
              },
              "html": {
                "href": ""
              },
              "avatar": {
                "href": ""
              }
            },
            "type": "user",
            "nickname": ",
            "account_id": ""
          }
        },
        "parents": [
          {
            "hash": "",
            "type": "commit",
            "links": {
              "self": {
                "href": ""
              },
              "html": {
                "href": ""
              }
            }
          }
        ],
        "date": "2021-08-24T05:03:46+00:00",
        "message": "time optimal moveJ\n",
        "type": "commit"
      }
    }

Hey :wave:,

I’d suggest instead of accessing the branch, you could access the commits of the branch by using: /repositories/{workspace}/{repo_slug}/commits/{branch_name}. This way, the latest commit should contain the last time the branch was updated. :slight_smile:

2 Likes

Thank you for your reply!