Hello, please forgive any mistakes around terminology. I'm learning rest api usage on my own through trial and error.
I'm trying to build a Powershell module to wrap around the BitBucket API with a focus on just reading source info from repositories for use in automating CI/CD streams. I'm running into an issue with trying to hit the 2.0/repositories/{username}/{repo_slug}/src endpoint. I keep getting a forbidden response.
I'm using OAuth with a consumer. I'm authenticating with the client_credentials grant type. The consumer initially started with all repo permissions, but I also tried expanding it to include all permissions, and continued to get the error. However, I can use the same OAuth token to successfully hit the endpoint when I include the path to a particular folder or file in the repo.
I was trying to hit the endpoint from browsing the api documentation found at: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/src#get
My overall goal in trying to hit this endpoint was to explore how I can parse and iterate through api responses to build a list of available files and their paths within a repo given only the repo name.
Any help would be greatly appreciated.
Facing exactly the same issue.
Have you found a solution?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately not. For my purposes, I already know the branch names of the repo I'm querying for the CI/CD solution, so I went with the URL 2.0/repositories/{username}/{repo_slug}/src/{branchname}. That one works normally.
Though I imagine there would be another endpoint to allow you to obtain a list of branches other than the one returning the forbidden response. You could probably use that to return the list of branches and have the user select from that to then parse through the files in the selected branch with the above endpoint.
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.