How can I search a file with a name on bitbucket via rest API? (v1.0)
It seems there is an endpoint useful to get the file but there is no one to search and find the file(s) with name.
I found this option for Bitbucket Server:
Call POST
request for https://<bitbucket_server>/rest/search/latest/search
endpoint:
Option 1: with parameters {"query":"\"<file_name_with_extension>\"","entities":{"code":{"start":1,"limit":10}}}
OR
Option 2: with parameters {"query":"<part_of_file_name> ext:<file_extension>","entities":{"code":{"start":1,"limit":10}}}
where start
is page number, limit
is number of the results on the page.
In my case I used Option 2, because I needed to search file containing some keyword in the name.
This request returns JSON.
UPD 17th Feb: mentioned above search happens in default branches only. So, if you need to search in all branches, then there is option to go through all files in each branch.