【问题标题】:Bitbucket REST Api: How can I order all branches by date desc with rest api call?Bitbucket REST Api:如何通过调用 rest api 按日期 desc 对所有分支进行排序?
【发布时间】:2019-01-17 21:31:01
【问题描述】:

我需要获取 latest 分支的 name。所以,我列出了分支,但列表的顺序不是按创建日期描述的。

并且下面的 api 调用不起作用。它的响应就像那个“消息”:“无效的字段名称:updated_on”

https://api.bitbucket.org/2.0/repositories/{user_name}/{repo_name}/refs/branches?sort=-updated_on

感谢和最好的问候

【问题讨论】:

    标签: bitbucket bitbucket-api


    【解决方案1】:

    我找到了答案。所有分支都有目标字段,目标有日期字段。因此,为了按日期对分支进行排序,您需要通过“target.date”来指向目标的日期

    如下:

    https://api.bitbucket.org/2.0/repositories/{user_name}/{repo_name}/refs/branches?sort=-target.date

    【讨论】:

      猜你喜欢
      • 2016-07-22
      • 1970-01-01
      • 2020-04-16
      • 2017-09-23
      • 2016-04-03
      • 1970-01-01
      • 2013-12-15
      • 1970-01-01
      • 2022-11-07
      相关资源
      最近更新 更多