Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Create PR using curl command

Steve Iribarne
Contributor
May 3, 2020

Hello

I've done a ton of searching and I'm sure the answer is somewhere in my searching, but I'm a complete NOOB at curl/rest/ etc... so I'm not exactly sure what I'm looking for.

I am writing a bash script (yes I'm old) ... and I'm at the point where I need to automate the process of creating a Pull Request.

So in order for my bash script to be able to create a PR, (we use SSH to access bitbucket (not http/username/password stuff)) and I think I need to use an OATH consumer token

So far I've added the an OATH consumer to my JIRA account.

Then I run the command:

curl -X POST -u "<key>:<secret>" https://bitbucket.org/site/oauth2/access_token -d grant_type=client_credentials

I get the response back:

{"access_token": "<ret_token>", "scopes": "pullrequest:write pipeline:variable", "expires_in": 7200, "refresh_token": "QKP5aVp43gu3kubF5X", "token_type": "bearer"}

 

All is good.. then I want to create a Pull Request... so I don't know where to put the access_token in the PR curl command:

 

curl -H "Content-Type: application/json" https://bitbucket.org/res\
t/api/1.0/projects/<myProj>/repos/<my_repo_name>/pull-requests -X POST --data pr.json

I know I'm doing something basic wrong.. Remember I'm a complete NOOB here.

 

Any help would be greatly appreciated.

 

-Steve

1 answer

0 votes
Steve Iribarne
Contributor
May 8, 2020

crickets.. must mean that there is an answer out there somewhere... 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events