使用Bitbucket Rest API(V1.0)搜索文件

发布于 2025-02-07 12:13:19 字数 219 浏览 0 评论 0 原文

如何通过REST API在Bitbucket上搜索使用名称的文件? (v1.0)

似乎有一个获取文件很有用,但是没有人可以搜索并使用名称找到文件。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悲喜皆因你 2025-02-14 12:13:19

我找到了BitBucket服务器的此选项:

call 发布请求 https:///lt; bitbucket_server>/rest/reast/search/search/最终/search/search endpoint

选项1: 带有参数 {“ query”:“ \”&lt; file_name_with_extension&gt; \; \“”,“ entities”:{“ code”:{“ start”:1,“ limit”:10}}}}}}}}}}} < /code>

选项2:带有参数 {“ query”:“&lt; part_of_file_name&gt; ext:&lt; file_extension&gt;“,“ entities”,“ entities”:{“ code”:“ code”:“ :1,“限制”:10}}}

其中开始是页码, limit 是页面上结果的数字。

在我的情况下,我使用了选项2,因为我需要在名称中搜索包含一些关键字的文件。

此请求返回JSON。

UPD 2月17日:上面提到的搜索仅在默认分支中发生。因此,如果您需要在所有分支中进行搜索,则可以选择通过每个分支中的所有文件。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文