更新时间:2023-04-07 GMT+08:00
分享

新建标签

功能介绍

新建标签

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

POST /v2/repositories/{repository_id}/tags

表1 路径参数

参数

是否必选

参数类型

描述

repository_id

Integer

仓库主键id

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。

通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

表3 请求Body参数

参数

是否必选

参数类型

描述

tag_name

String

标签名称

ref

String

分支名称

message

String

备注

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

error

Error object

响应错误

result

AddTagsResponse object

响应结果

status

String

响应状态

表5 Error

参数

参数类型

描述

code

String

错误码

message

String

错误信息

表6 AddTagsResponse

参数

参数类型

描述

name

String

标签名称

message

String

备注

commit

CommitRepoV2 object

提交信息

表7 CommitRepoV2

参数

参数类型

描述

id

String

提交对应的SHA id

short_id

String

提交对应的短SHA id

created_at

String

创建时间

title

String

提交标题

parent_ids

Array of strings

父提交id

message

String

提交信息

author_name

String

作者

committer_name

String

提交作者

committed_date

String

提交时间

请求示例

POST https://{endpoint}/v2/repositories/{repository_id}/tags

{
  "tag_name" : "test20220920",
  "ref" : "master",
  "message" : "test20220920"
}

响应示例

状态码: 200

OK

{
  "result" : {
    "name" : "test_tag_name",
    "message" : "test message",
    "commit" : {
      "id" : "3b68902cf0eb7de3d5c8757e4a990bc3fe0af349",
      "short_id" : "3b68902c",
      "created_at" : "2022-03-08T03:14:39.000Z",
      "title" : "新建文件",
      "parent_ids" : [ "08618c900a4048aae7e4cd88913d3d521eae02eb" ],
      "message" : "新建文件",
      "author_name" : "repo",
      "committer_name" : "repo",
      "committed_date" : "2022-03-08T03:14:39.000Z"
    }
  },
  "status" : "success"
}

状态码

状态码

描述

200

OK

错误码

请参见错误码

分享:

    相关文档

    相关产品