---
title: "GitHub常用API"
description: "api地址区分大小写"
canonical_url: "https://yangqiuyi.com/blog/kai-fa/github-chang-yong-api"
---

> Index of every page on this site: [llms.txt](https://yangqiuyi.com/llms.txt)

**api地址区分大小写**

<table>
<thead>
  <tr>
    <th>
      功能
    </th>
    
    <th>
      api地址
    </th>
    
    <th>
      请求方式
    </th>
    
    <th>
      请求参数
    </th>
    
    <th>
      返回参数
    </th>
    
    <th>
      例子
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      获取用户信息
    </td>
    
    <td>
      <a href="https://api.github.com/users/" rel="nofollow">
        https://api.github.com/users/
      </a>
    </td>
    
    <td>
      get
    </td>
    
    <td>
      path路径： 用户名
    </td>
    
    <td>
      <code>
        一个用户对象
      </code>
    </td>
    
    <td>
      <a href="https://api.github.com/users/ygunoil" rel="nofollow">
        https://api.github.com/users/ygunoil
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      获取用户所有仓库
    </td>
    
    <td>
      <a href="https://api.github.com/users/%7B%E7%94%A8%E6%88%B7%E5%90%8D%7D/repos" rel="nofollow">
        https://api.github.com/users/{用户名}/repos
      </a>
    </td>
    
    <td>
      get
    </td>
    
    <td>
      path路径： 用户名
    </td>
    
    <td>
      <code>
        返回一个数组
      </code>
    </td>
    
    <td>
      <a href="https://api.github.com/users/ygunoil/repos" rel="nofollow">
        https://api.github.com/users/ygunoil/repos
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      获取某个仓库的详细信息
    </td>
    
    <td>
      <a href="https://api.github.com/repos/ygunoil/Common-functions" rel="nofollow">
        https://api.github.com/repos/{用户名}/
      </a>
      
      {仓库名}
    </td>
    
    <td>
      get
    </td>
    
    <td>
      path路径： 用户名 和 仓库名
    </td>
    
    <td>
      <code>
        返回一个仓库对象
      </code>
    </td>
    
    <td>
      <a href="https://api.github.com/repos/ygunoil/Common-functions" rel="nofollow">
        https://api.github.com/repos/ygunoil/Common-functions
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      获取某个仓库里根目录文件或文件夹数组
    </td>
    
    <td>
      <a href="https://api.github.com/repos/ygunoil/Common-functions/contents" rel="nofollow">
        https://api.github.com/repos/
      </a>
      
      <a href="https://api.github.com/repos/ygunoil/Common-functions" rel="nofollow">
        /{用户名}/
      </a>
      
      <a href="https://api.github.com/repos/ygunoil/Common-functions/contents" rel="nofollow">
        {仓库名}/contents
      </a>
    </td>
    
    <td>
      get
    </td>
    
    <td>
      path路径： 用户名 和 仓库名
    </td>
    
    <td>
      <code>
        返回一个首层文件或文件夹数组
      </code>
    </td>
    
    <td>
      <a href="https://api.github.com/repos/ygunoil/Common-functions/contents" rel="nofollow">
        https://api.github.com/repos/ygunoil/Common-functions/contents
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      获取某个仓库里子目录文件或文件夹数组
    </td>
    
    <td>
      <a href="https://api.github.com/repos/ygunoil/Common-functions/contents" rel="nofollow">
        https://api.github.com/repos/
      </a>
      
      <a href="https://api.github.com/repos/ygunoil/Common-functions" rel="nofollow">
        /{用户名}/
      </a>
      
      <a href="https://api.github.com/repos/ygunoil/Common-functions/contents" rel="nofollow">
        {仓库名}/contents
      </a>
      
      /{文件名或文件夹名}
    </td>
    
    <td>
      get
    </td>
    
    <td>
      path路径： 用户名 和 仓库名和文件名或文件夹名
    </td>
    
    <td>
      返回一个文件数组
    </td>
    
    <td>
      <a href="https://api.github.com/repos/ygunoil/Common-functions/contents/utilshttps://api.github.com/repos/ygunoil/Common-functions/contents/utils/Currency/CurrencyFormat.js" rel="nofollow">
        https://api.github.com/repos/ygunoil/Common-functions/contents/utilshttps://api.github.com/repos/ygunoil/Common-functions/contents/utils/Currency/CurrencyFormat.js
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      获取某文件的原始内容（Raw）
    </td>
    
    <td>
      <a href="https://api.github.com/repos/ygunoil/Common-functions/contents" rel="nofollow">
        1. 通过上面的文件信息中提取<code>
          download_url
        </code>
        
        这条链接，就能获取它的原始内容了。
      </a>
      
      <a href="https://api.github.com/repos/ygunoil/Common-functions/contents" rel="nofollow">
        2. 或者直接访问：<code>
          https://raw.githubusercontent.com/{用户名}/{仓库名}/{分支名}/
        </code>
      </a>
      
      {文件路径}
    </td>
    
    <td>
      get
    </td>
    
    <td>
      path路径： 用户名 和 仓库名和文件l路径
    </td>
    
    <td>
      返回一个文件内容的字符串
    </td>
    
    <td>
      <a href="https://raw.githubusercontent.com/ygunoil/Common-functions/master/utils/Currency/CurrencyFormat.js" rel="nofollow">
        https://raw.githubusercontent.com/ygunoil/Common-functions/master/utils/Currency/CurrencyFormat.js
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      获取某个用户的跟随者列表
    </td>
    
    <td>
      <a href="https://api.github.com/users/%7B%E7%94%A8%E6%88%B7%E5%90%8D%7D/followers" rel="nofollow">
        https://api.github.com/users/{用户名}/followers
      </a>
    </td>
    
    <td>
      get
    </td>
    
    <td>
      path路径： 用户名
    </td>
    
    <td>
      <code>
        返回一个数组
      </code>
    </td>
    
    <td>
      <a href="https://api.github.com/users/ygunoil/followers" rel="nofollow">
        https://api.github.com/users/ygunoil/followers
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      获取某个用户正在关注谁列表
    </td>
    
    <td>
      <a href="https://api.github.com/users/%7B%E7%94%A8%E6%88%B7%E5%90%8D%7D%7D/following" rel="nofollow">
        https://api.github.com/users/{用户名}}/following
      </a>
    </td>
    
    <td>
      get
    </td>
    
    <td>
      path路径： 用户名
    </td>
    
    <td>
      返回一个数组
    </td>
    
    <td>
      <a href="https://api.github.com/users/ygunoil/following" rel="nofollow">
        https://api.github.com/users/ygunoil/following
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      获取某个用户加入的组织列表
    </td>
    
    <td>
      <a href="https://api.github.com/users/ygunoil/orgs" rel="nofollow">
        https://api.github.com/users/{用户名}/orgs
      </a>
    </td>
    
    <td>
      get
    </td>
    
    <td>
      path路径： 用户名
    </td>
    
    <td>
      返回一个数组
    </td>
    
    <td>
      <a href="https://api.github.com/users/ygunoil/orgs" rel="nofollow">
        https://api.github.com/users/ygunoil/orgs
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      repo中所有的commits列表
    </td>
    
    <td>
      <a href="https://api.github.com/repos/%7B%E7%94%A8%E6%88%B7%E5%90%8D%7D/%7B%E4%BB%93%E5%BA%93%E5%90%8D%7D/commits" rel="nofollow">
        https://api.github.com/repos/{用户名}/{仓库名}/commits
      </a>
    </td>
    
    <td>
      get
    </td>
    
    <td>
      
    </td>
    
    <td>
      
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      某一条commit详情
    </td>
    
    <td>
      <a href="https://api.github.com/repos/%7B%E7%94%A8%E6%88%B7%E5%90%8D%7D/%7B%E4%BB%93%E5%BA%93%E5%90%8D%7D/commits/%7B%E6%9F%90%E4%B8%80%E6%9D%A1commit%E7%9A%84SHA%7D" rel="nofollow">
        https://api.github.com/repos/{用户名}/{仓库名}/commits/{某一条commit的SHA}
      </a>
    </td>
    
    <td>
      get
    </td>
    
    <td>
      
    </td>
    
    <td>
      
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      issues列表
    </td>
    
    <td>
      <a href="https://api.github.com/repos/%7B%E7%94%A8%E6%88%B7%E5%90%8D%7D/%7B%E4%BB%93%E5%BA%93%E5%90%8D%7D/issues" rel="nofollow">
        https://api.github.com/repos/{用户名}/{仓库名}/issues
      </a>
    </td>
    
    <td>
      get
    </td>
    
    <td>
      
    </td>
    
    <td>
      
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      某条issue详情
    </td>
    
    <td>
      <a href="https://api.github.com/repos/%7B%E7%94%A8%E6%88%B7%E5%90%8D%7D/%7B%E4%BB%93%E5%BA%93%E5%90%8D%7D/issues/%7B%E5%BA%8F%E5%8F%B7%7D" rel="nofollow">
        https://api.github.com/repos/{用户名}/{仓库名}/issues/{序号}
      </a>
    </td>
    
    <td>
      get
    </td>
    
    <td>
      issues都是以1,2,3这样的序列排号的
    </td>
    
    <td>
      
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      某issue中的comments列表
    </td>
    
    <td>
      <a href="https://api.github.com/repos/%7B%E7%94%A8%E6%88%B7%E5%90%8D%7D/%7B%E4%BB%93%E5%BA%93%E5%90%8D%7D/issues/%7B%E5%BA%8F%E5%8F%B7%7D/comments" rel="nofollow">
        https://api.github.com/repos/{用户名}/{仓库名}/issues/{序号}/comments
      </a>
    </td>
    
    <td>
      get
    </td>
    
    <td>
      
    </td>
    
    <td>
      
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      某comment详情
    </td>
    
    <td>
      <a href="https://api.github.com/repos/%7B%E7%94%A8%E6%88%B7%E5%90%8D%7D/%7B%E4%BB%93%E5%BA%93%E5%90%8D%7D/issues/comments/%7B%E8%AF%84%E8%AE%BA%E8%AF%A6%E6%83%85%E7%9A%84ID%7D" rel="nofollow">
        https://api.github.com/repos/{用户名}/{仓库名}/issues/comments/{评论详情的ID}
      </a>
    </td>
    
    <td>
      get
    </td>
    
    <td>
      评论ID是从issues列表中获得的
    </td>
    
    <td>
      
    </td>
    
    <td>
      
    </td>
  </tr>
</tbody>
</table>

## Sitemap

See the full [sitemap](https://yangqiuyi.com/sitemap.md) for all pages.
