I have to check the list of files stored under a particular branch with full path. Currently, I could not find a way of accessing it via a rest endpoint
Hi Tanmoy,
I am not on the Bitbucket team, but I will try to help.
Is there any reason why you need to use a REST API?
If you can use a git client then you could try something like
git ls-tree -r --name-only <branch name>
I hope that helps!
Thanks for your reply Martyn.
My branch has directories inside it. So, I want to list all the files with a relative path from the branch.
$ git ls-tree --name-only feature/API-460
.gitignore
db_connection
sql
I have some jobs that reference the branch files as part of CI.
Accessing via git command would mean that I have to install git client on the machine that wants to access bitbucket.
So, what I am trying to find is a rest-endpoint that would fetch the same result as:
$ git ls-tree -r feature/API-460
100644 blob 73febeeb4545e1 .gitignore
100755 blob 3126b0bfa7ca db_connection/conf.json
100644 blob 27a08b947d5438b0 sql/v1.0.sql
100644 blob e228c3188f92c9d96 sql/v1.1.sql
100644 blob 71ab229376c83 sql/v1.2.sql
100644 blob 39e425ba26ed91e536b sql/v1.3.sql
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tanmoy,
I think it will be simpler for you to install a git client on the machine you're using. Then you can use git commands and shell commands to modify the output to your liking.
The only kind of REST endpoint close to what you're looking for is:
You would need to then call that multiple times to manually traverse the directory tree. Ie. it will only list .gitignore, db_connection and sql in the first call. You would then need to make a second call to list the contents of db_connection/ and a third call to list the content of sql/
I hope that helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nothing more irritating then answering a question with the wrong solution, I also need to list files under a branch, and we are doing it with node.js so we need to use the bitbucket API... get lost.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.