Skip to content

API endpoint "/projects/:id/repository/tags/:tag_name" should contain values of the tags protection

Problem

Currently, when calling "/projects/:id/repository/branches/:branch_name", the JSON response contains the protection level for the branch:

$ curl -sS --header "PRIVATE-TOKEN: $TOKEN" "https://gitlab.xxxxx.com/api/v4/projects/519/repository/branches/master" | jq .
{
  "name": "master",
  "commit": {
    "id": "74f61a1950845a0aa35b065684077d4465xxxx",
    "short_id": "74f61a19",
    "created_at": "2019-08-30T09:46:44.000Z",
    "parent_ids": [
      "4cb8a4698d60f8c4364893199740f5b71xxxx"
    ],
    "title": "abc",
    "message": "abc",
    "author_name": "xxxx",
    "author_email": "xxxx@xxxx.com",
    "authored_date": "2019-08-30T09:41:35.000Z",
    "committer_name": "xxxx",
    "committer_email": "xxxx@xxxx.com",
    "committed_date": "2019-08-30T09:46:44.000Z"
  },
  "merged": false,
  "protected": true,
  "developers_can_push": true,
  "developers_can_merge": true,
  "can_push": true,
  "default": true
}

On the other hand, when calling the similar endpoint for a tag, it doesn't contain the protection level:

$ curl -sS --header "PRIVATE-TOKEN: $TOKEN" "https://gitlab.xxxxx.com/api/v4/projects/519/repository/tags/xxxxx-1.4.3" | jq .
{
  "name": "xxxxx-1.4.3",
  "message": "xxxxx 1.4.3",
  "target": "6c2016b90d69e5f4c277245f64801ee12cxxxx",
  "commit": {
    "id": "614144c58b0f8072ca17085f786541d768bxxx",
    "short_id": "614144c5",
    "created_at": "2019-09-02T13:52:33.000Z",
    "parent_ids": [
      "bf6b3030966ee2f518316476b70cfa16a9xxxxx"
    ],
    "title": "xxxxx",
    "message": "xxxxx",
    "author_name": "xxxxx",
    "author_email": "xxxxx@xxxxx.com",
    "authored_date": "2019-08-30T13:40:25.000Z",
    "committer_name": "xxxxx xxxxx",
    "committer_email": "xxxxx@xxxxx.com",
    "committed_date": "2019-09-02T13:52:33.000Z"
  },
  "release": null
}

Proposal

Add the same fields that the endpoint for branches have to the tags endpoint.

Workaround

To get the protection, it has to be calculated after listing the entire protected tags.