本文介绍了如何使用API 1.0在Bitbucket中创建拉取请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建一个自动化管道,在那,我想从jenkins的工作中在bitbucket中创建一个拉取请求.我找到了一些文档,可以在其中使用rest api创建请求请求.但这是针对api 2.0的.我有旧的bitbucket,我不确定必须使用哪个api版本.
I am trying to create an automation pipeline and in that, I want to create a pull request in bitbucket from my jenkins job. I found some document where I can create a pull request using rest api. But that is for api 2.0. I have old bitbucket and I am not sure which api version I have to use.
谢谢
推荐答案
您可以使用REST API 1.0在Bitbucket中创建请求请求,
You can create a pull request in Bitbucket using the REST API 1.0 doing the following:
curl -s --user USER:PASS --request PUT --data @- --header Content-Type:application/json https://BITBUCKET-SERVER/rest/api/1.0/projects/TO-PROJECT/repos/TO-REPOSITORY/pull-requests << EOF
{
"title": "SOME-TITTLE",
"description": "SOME-DESCRIPTION",
"state": "OPEN",
"open": true,
"closed": false,
"fromRef": {
"id": "refs/heads/FROM-BRANCH",
"repository": {
"slug": "FROM-REPO",
"name": null,
"project": {
"key": "FROM-PROJECT"
}
}
},
"toRef": {
"id": "refs/heads/TO-BRANCH",
"repository": {
"slug": "TO-REPO",
"name": null,
"project": {
"key": "TO-PROJECT"
}
}
},
"locked": false,
"reviewers": [
{
"user": {
"name": "REVIEWER"
}
}
]
}
这篇关于如何使用API 1.0在Bitbucket中创建拉取请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!