Hi
I created a project on bitbucket and created a pull request.
https://bitbucket.org/<my_pseudo>/<my_repo>/pull-requests/1/
I create an app-password
Now I would like to retrieve pull request information with "curl" and REST API.
I try
curl -v -u <my_login>:<my_app_password> https://api.bitbucket.org/2.0/repositories/test/pull-requests
No response but verbose says that:
* Trying 18.205.93.8:443...
* Connected to api.bitbucket.org (18.205.93.8) port 443 (#0)
* schannel: disabled automatic use of client certificate
* schannel: ALPN, offering http/1.1
* schannel: ALPN, server accepted to use http/1.1
* Server auth using Basic with user '<my_login>'
> GET /2.0/repositories/test/pull-requests HTTP/1.1
> Host: api.bitbucket.org
> Authorization: Basic b2xpdmllci5hcHBlcmU6SlV5OFljQzdhUzVTRm1QcXhQN1k=
> User-Agent: curl/7.79.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
< Server: nginx
< Vary: Origin
* Authentication problem. Ignoring this.
< WWW-Authenticate: Basic realm="Bitbucket.org HTTP"
< Content-Type: text/plain
< X-B3-TraceId: a0259912425ae7e4
< X-Usage-Output-Ops: 0
< X-Dc-Location: Micros
< Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
< Date: Sun, 24 Apr 2022 09:41:27 GMT
< X-Usage-User-Time: 0.009101
< X-Usage-System-Time: 0.004353
< X-Served-By: 13ec9c009674
< ETag: "d41d8cd98f00b204e9800998ecf8427e"
< X-Static-Version: 9c0ba0615ff1
< X-Render-Time: 0.0149459838867
< Connection: keep-alive
< X-Usage-Input-Ops: 0
< X-Version: 9c0ba0615ff1
< X-Request-Count: 2147
< X-Frame-Options: SAMEORIGIN
< Content-Length: 0
<
* Connection #0 to host api.bitbucket.org left intact
I search here https://developer.atlassian.com/cloud/bitbucket/rest/intro/ but I miss a tutorial for absolute beginner
Thanks
Olivier
Hello @extralucide
Welcome to Atlassian Community!
You may use this API to get PR details
Sample CURL call as below:
curl -X GET -u username:AppPassword "https://api.bitbucket.org/2.0/repositories/workspaceID/repo_slug/pullrequests/1"
Kindly replace with the workspace ID, repo slug & PR number.
I hope this helps.
Kind regards,
Karthick S
Hi @Karthick S
is the snippet you provided above still valid ? I am getting 401 in the response.
I took a quick look in the community posts and found a post mentioning that basic auth with password is deprecated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
We have indeed deprecated the use of account passwords for Git over HTTPS and API. An account's password can be used only for logging in to the website from browser.
You can use an app password instead, as indicated in the call that Karthick provided. You can read more about app passwords here:
username should be the Bitbucket username of the account you generated the app password for (it can be found here: https://bitbucket.org/account/settings/).
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.