Bitbucket是一个基于Git的代码托管平台,它提供了一组REST API,可以通过API来管理和操作Bitbucket上的资源。要使用Bitbucket REST API添加多个审阅者,可以按照以下步骤进行操作:
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests
,其中{projectKey}
是项目的键,{repositorySlug}
是仓库的唯一标识符。以下是一个示例的HTTP请求和响应:
请求:
POST /rest/api/1.0/projects/PROJ/repos/repo/pull-requests
Authorization: Bearer <access_token>
Content-Type: application/json
{
"title": "添加多个审阅者",
"description": "请审阅我的代码变更",
"fromRef": {
"id": "refs/heads/feature-branch"
},
"toRef": {
"id": "refs/heads/master"
},
"reviewers": [
{
"user": {
"name": "reviewer1"
}
},
{
"user": {
"name": "reviewer2"
}
}
]
}
响应:
HTTP/1.1 201 Created
Content-Type: application/json
{
"id": 123,
"title": "添加多个审阅者",
"description": "请审阅我的代码变更",
"fromRef": {
"id": "refs/heads/feature-branch"
},
"toRef": {
"id": "refs/heads/master"
},
"reviewers": [
{
"user": {
"name": "reviewer1"
}
},
{
"user": {
"name": "reviewer2"
}
}
],
"links": {
"self": [
{
"href": "https://bitbucket.example.com/projects/PROJ/repos/repo/pull-requests/123"
}
]
}
}
在这个示例中,我们创建了一个标题为"添加多个审阅者"的审阅请求,将代码变更从"feature-branch"分支合并到"master"分支。同时,我们指定了两个审阅者,分别是"reviewer1"和"reviewer2"。
请注意,以上示例中的<access_token>
需要替换为实际的访问令牌。
对于Bitbucket的REST API的详细信息,你可以参考腾讯云的Bitbucket API文档:Bitbucket REST API。
领取专属 10元无门槛券
手把手带您无忧上云