Forums

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

Bitbucket API use to download Pull Review Requests report

Rupali Desai
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!
February 18, 2026

I am trying to use  "https://api.bitbucket.org/2.0/repositories/" & BB_WORKSPACE & "/" & BB_REPO & "/pullrequests"

 

Dim baseUrl As String
baseUrl = "https://api.bitbucket.org/2.0/repositories/" & BB_WORKSPACE & "/" & BB_REPO & "/pullrequests"

' Build query:
' q=destination.branch.name="main" AND state="MERGED"
Dim q As String
q = "destination.branch.name=""" & DEST_BRANCH & """ AND state=""MERGED"""

Dim fields As String
fields = "values.id,values.title,values.created_on,values.closed_on," & _
"values.source.branch.name,values.destination.branch.name,next"

Dim url As String
url = baseUrl & "?q=" & UrlEncode(q) & "&fields=" & UrlEncode(fields) & "&pagelen=50"

Dim cycles() As Double
Dim cycleCount As Long
cycleCount = 0

Do While Len(url) > 0
Dim json As String
json = HttpGet_BB(url, BB_USER, BB_TOKEN)

Loop

 

I am receiving error 401.

 

I tried

Private Const BB_USER As String = "your-email"
Private Const BB_TOKEN As String = "your-app-password"

or 

Private Const BB_USER As String = "x-token-auth"
Private Const BB_TOKEN As String = "your-workspace-token"

 

Private Const BB_WORKSPACE As String = "your-workspace"
Private Const BB_REPO As String = "your-repo"
Private Const DEST_BRANCH As String = "main"

 

I need help in how to generate the token from Bitbucket.

I tried to use it from Workspace as well as repo.

I receiving 401 in both the cases.

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events