Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Create pull request using command line or Jenkins

Pratik Shah November 7, 2019

Hallo,

I am new to this community and this is my first post.

I am trying to create a Pull request through Jenkins in bitbucket server repo, at first place with a reviewer named e.g. Max.

Can anyone help me with this?

Is it also possible to create Pull request in bitbucket server repo using command line?

Thank You for your time.

1 answer

1 accepted

0 votes
Answer accepted
Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 7, 2019

Hi @Pratik Shah ,

Welcome to the community..!

if you want to create pull request from command line I would suggest you to consider API

THIS page has complete details of PR APIs with examples

Hope it helps you

 

BR,

Leo

Pratik Shah November 7, 2019

Thank you very much for reply Leo.

Can you please provide me concrete example of how to use this API?

For e.g. my repo is https://xyz.com/bitbucket/projects/abc/repos/abxdgf

How can I create pull requets from feature/dfg branch to develop branch using command line?

 

Thank You once again.

BR,

Pratik

Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 7, 2019

Hi @Pratik Shah ,

I framed API call with given sample URL, you'll have modify URL, Project key and reponame in the call

curl -X POST -H "Content-Type: application/json" -u username:Password --basic https://xyz.com/bitbucket/rest/api/1.0/projects/abc/repos/abxdgf/pull-requests -d '{ "title": "PR Title Here", "description": "PR Description here", "fromRef": { "id": "feature/dfg", "repository": { "slug": "abxdgf", "name": null, "project": { "key": "abc" }}}, "toRef": {"id": "develop","repository":{"slug": "abxdgf", "name": null, "project": {"key": "abc"}}}}'

 

BR,

Leo 

Pratik Shah November 8, 2019

@Leo .. Thank You very much.. That actually works and has made my life much easier.

One more question: Is it possible to create pull request in same way, but by passing source branch name in a variable?

 

With best regard's,

Pratik

Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 8, 2019

You can try it out but I didn't get a chance to play in that way 

Vivek Asthana
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 21, 2023

Am getting illegal port number error while using these command..please guide

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events