我正在尝试使用rest API创建pull请求。我经历了documentaion。我正在按照json
下面的文档中提到的发布请求{
"title": "blah blah",
"description": "blah blah",
"state": "OPEN", "open": true,
"closed": false,
"fromRef":
{
"id": "feature/test1",
"repository":
{
"slug": "test-repo",
"name": null,
"project":
{
"key": "PR"
}
}
},
"toRef":
{
"id": "refs/heads/master",
"repository":
{
"slug": "test-repo",
"name": null,
"project":
{
"key": "PR"
}
}
},
"locked": false,
"reviewers": [
{
"user":
{
"name": "nikhil"
}
}
]
}
但我在回复时收到错误
{
"errors":
[
{
"context":"type","message":"Please enter a type of permission","exceptionName":null
},
{
"context":"permitted","message":"Please enter at least one user or group","exceptionName":null
}
]
}
我不知道要在json请求中添加什么权限参数。请帮我解决一下这个。这为我节省了很多时间。
答案 0 :(得分:2)
我对json有点看了一下这篇文章,并为我工作,如果还有人在寻找解决方法,这是我的要求,
curl -X POST -H" Content-Type:application / json" -u userName:passWord --basic https://bitbucketURL/rest/api/1.0/projects/projectName/repos/repoName/pull-requests -d' {" title":"放置一些标题"," description":& #34;放一些desc", " fromRef":{" id":" sourceBranch"," repository":{" slug":&#34 ; repoName"," name":null," project":{" key":" projectName " }" toRef":{" id":" destinationBranch"," repository":{" slug" :" repoName"," name":null," project":{" key":" projectName"}} },"评论者":[{"用户":{"姓名":" userId"}}]," close_source_branch&# 34;:false}'
注意 - 将bitbucketURL,userName,passWord,projectName,repoName,sourceBranch,destinationBranch,userId替换为您的详细信息。
答案 1 :(得分:0)
POST需要一种身份验证方法。请参阅https://developer.atlassian.com/static/rest/stash/3.11.6/stash-rest.html#authentication。
Pull Requests详细介绍了所涉及的repos所需的权限。