【问题标题】:Getting whole repository structure from GitHub API using one request使用一个请求从 GitHub API 获取整个存储库结构
【发布时间】:2019-10-30 21:27:40
【问题描述】:

是否有可能使用对 github api 的一个请求以某种方式获取有关整个存储库的信息,或者我们必须递归地询问特定级别的 API?

根据这个要求:https://api.github.com/repos/microsoft/terminal/contents?ref=master

我们只升级了一级。

【问题讨论】:

    标签: github-api


    【解决方案1】:

    您可以get the tree recursively 使用:

    /repos/:owner/:repo/git/trees/:tree_sha?recursive=1
    

    在你的情况下是:

    https://api.github.com/repos/microsoft/terminal/git/trees/master?recursive=true

    【讨论】:

      【解决方案2】:

      您可以在此处提出请求以查看有关您的分支的详细信息:

      在响应中,您将看到“commit”字段,其中有“sha”。把它放在这个请求中:

      您将像这样收到您的 repo 下的每个文件。

      干杯!

      【讨论】:

        猜你喜欢
        • 2011-11-19
        • 1970-01-01
        • 2019-09-30
        • 1970-01-01
        • 2022-11-03
        • 2020-12-10
        • 2021-01-26
        • 2017-09-01
        • 1970-01-01
        相关资源
        最近更新 更多