タグ API
プロジェクトリポジトリのタグを一覧表示します。
versionGitLab 15.4 で導入されたorder_by属性の値です。
プロジェクトのリポジトリタグの一覧を、更新日時の降順でソートして取得します。リポジトリが公開されている場合、このエンドポイントは認証なしでアクセスできます。
GET /projects/:id/repository/tags
パラメータを指定します:
| 属性 | 種類 | 必須 | 説明 | 
|---|---|---|---|
| id | 整数または文字列。 | yes | 認証ユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス。 | 
| order_by | 文字列です。 | いいえ | name、updated、versionの順に並べたタグを返します。デフォルトはupdatedです。 | 
| sort | 文字列です。 | いいえ | タグを ascまたはdesc順序でdescソートして返します。descデフォルトは .desc | 
| search | 文字列です。 | いいえ | 検索条件に一致するタグのリストを返します。 ^term、term$を使用すると、それぞれtermで始まり、 で終わるタグを検索できます。その他の正規表現はサポートしていません。 | 
[
  {
    "commit": {
      "id": "2695effb5807a22ff3d138d593fd856244e155e7",
      "short_id": "2695effb",
      "title": "Initial commit",
      "created_at": "2017-07-26T11:08:53.000+02:00",
      "parent_ids": [
        "2a4b78934375d7f53875269ffd4f45fd83a84ebe"
      ],
      "message": "Initial commit",
      "author_name": "John Smith",
      "author_email": "john@example.com",
      "authored_date": "2012-05-28T04:42:42-07:00",
      "committer_name": "Jack Smith",
      "committer_email": "jack@example.com",
      "committed_date": "2012-05-28T04:42:42-07:00"
    },
    "release": {
      "tag_name": "1.0.0",
      "description": "Amazing release. Wow"
    },
    "name": "v1.0.0",
    "target": "2695effb5807a22ff3d138d593fd856244e155e7",
    "message": null,
    "protected": true
  }
]
単一のリポジトリタグを取得します。
特定のリポジトリタグを取得します。リポジトリが公開されている場合、このエンドポイントは認証なしでアクセスできます。
GET /projects/:id/repository/tags/:tag_name
パラメータを指定します:
| 属性 | 種類 | 必須 | 説明 | 
|---|---|---|---|
| id | 整数/文字列 | yes | 認証ユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス | 
| tag_name | 文字列です。 | yes | タグの名前 | 
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/tags/v1.0.0"
レスポンスの例
{
  "name": "v5.0.0",
  "message": null,
  "target": "60a8ff033665e1207714d6670fcd7b65304ec02f",
  "commit": {
    "id": "60a8ff033665e1207714d6670fcd7b65304ec02f",
    "short_id": "60a8ff03",
    "title": "Initial commit",
    "created_at": "2017-07-26T11:08:53.000+02:00",
    "parent_ids": [
      "f61c062ff8bcbdb00e0a1b3317a91aed6ceee06b"
    ],
    "message": "v5.0.0\n",
    "author_name": "Arthur Verschaeve",
    "author_email": "contact@arthurverschaeve.be",
    "authored_date": "2015-02-01T21:56:31.000+01:00",
    "committer_name": "Arthur Verschaeve",
    "committer_email": "contact@arthurverschaeve.be",
    "committed_date": "2015-02-01T21:56:31.000+01:00"
  },
  "release": null,
  "protected": false
}
新しいタグの作成
指定されたrefを指す新しいタグをリポジトリに作成します。
POST /projects/:id/repository/tags
パラメータを指定します:
| 属性 | 種類 | 必須 | 説明 | 
|---|---|---|---|
| id | 整数または文字列。 | yes | 認証ユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス | 
| tag_name | 文字列です。 | yes | タグの名前 | 
| ref | 文字列です。 | yes | コミット SHA、別のタグ名、ブランチ名を使用してタグを作成します。 | 
| message | 文字列です。 | いいえ | 注釈付きタグの作成 | 
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/tags?tag_name=test&ref=master"
応答例
{
  "commit": {
    "id": "2695effb5807a22ff3d138d593fd856244e155e7",
    "short_id": "2695effb",
    "title": "Initial commit",
    "created_at": "2017-07-26T11:08:53.000+02:00",
    "parent_ids": [
      "2a4b78934375d7f53875269ffd4f45fd83a84ebe"
    ],
    "message": "Initial commit",
    "author_name": "John Smith",
    "author_email": "john@example.com",
    "authored_date": "2012-05-28T04:42:42-07:00",
    "committer_name": "Jack Smith",
    "committer_email": "jack@example.com",
    "committed_date": "2012-05-28T04:42:42-07:00"
  },
  "release": null,
  "name": "v1.0.0",
  "target": "2695effb5807a22ff3d138d593fd856244e155e7",
  "message": null,
  "protected": false
}
軽量タグを作成する場合、メッセージはnull になります。そうでない場合は、注釈が含まれます。
ターゲットには、注釈付きタグを作成する場合はタグオブジェクトIDが含まれ、そうでない場合は、軽量タグを作成する場合のコミットIDが含まれます。
エラーの場合、エラーメッセージとともにステータスコード405 が返されます。
タグの削除
指定した名前のリポジトリのタグを削除します。
DELETE /projects/:id/repository/tags/:tag_name
パラメータを指定します:
| 属性 | 種類 | 必須 | 説明 | 
|---|---|---|---|
| id | 整数または文字列。 | yes | 認証ユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス | 
| tag_name | 文字列です。 | yes | タグの名前 | 
タグのX.509署名の取得
GitLab 15.7 で導入されました。
タグが署名されている場合、タグからX.509署名を取得します。署名されていないタグは404 Not Found レスポンスを返します。
GET /projects/:id/repository/tags/:tag_name/signature
パラメータを指定します:
| 属性 | 種類 | 必須 | 説明 | 
|---|---|---|---|
| id | 整数または文字列。 | yes | 認証ユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス。 | 
| tag_name | 文字列です。 | yes | タグの名前。 | 
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/repository/tags/v1.1.1/signature"
タグがX.509で署名されている場合の応答例:
{
  "signature_type": "X509",
  "verification_status": "unverified",
  "x509_certificate": {
    "id": 1,
    "subject": "CN=gitlab@example.org,OU=Example,O=World",
    "subject_key_identifier": "BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC",
    "email": "gitlab@example.org",
    "serial_number": 278969561018901340486471282831158785578,
    "certificate_status": "good",
    "x509_issuer": {
      "id": 1,
      "subject": "CN=PKI,OU=Example,O=World",
      "subject_key_identifier": "AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB",
      "crl_url": "http://example.com/pki.crl"
    }
  }
}
タグが符号なしの場合の応答例
{
  "message": "404 GPG Signature Not Found"
}
