github的三个API测试:获取issue列表、获取单个issue、渲染markdown文本

2018/03/06 note 共 7284 字,约 21 分钟

1、获取issue列表(HTTP GET)

url:

https://api.github.com/repos/itlgl/note/issues?per_page=10&page=1&access_token=4a27c49affe39dd9fd9fe27c49e1c24cdbaac18d  

返回结果:

[  
  {  
    "url": "https://api.github.com/repos/itlgl/note/issues/2",  
    "repository_url": "https://api.github.com/repos/itlgl/note",  
    "labels_url": "https://api.github.com/repos/itlgl/note/issues/2/labels{/name}",  
    "comments_url": "https://api.github.com/repos/itlgl/note/issues/2/comments",  
    "events_url": "https://api.github.com/repos/itlgl/note/issues/2/events",  
    "html_url": "https://github.com/itlgl/note/issues/2",  
    "id": 302602184,  
    "number": 2,  
    "title": "Android Studio新版本gradle4.1的bug",  
    "user": {  
      "login": "itlgl",  
      "id": 7078104,  
      "avatar_url": "https://avatars0.githubusercontent.com/u/7078104?v=4",  
      "gravatar_id": "",  
      "url": "https://api.github.com/users/itlgl",  
      "html_url": "https://github.com/itlgl",  
      "followers_url": "https://api.github.com/users/itlgl/followers",  
      "following_url": "https://api.github.com/users/itlgl/following{/other_user}",  
      "gists_url": "https://api.github.com/users/itlgl/gists{/gist_id}",  
      "starred_url": "https://api.github.com/users/itlgl/starred{/owner}{/repo}",  
      "subscriptions_url": "https://api.github.com/users/itlgl/subscriptions",  
      "organizations_url": "https://api.github.com/users/itlgl/orgs",  
      "repos_url": "https://api.github.com/users/itlgl/repos",  
      "events_url": "https://api.github.com/users/itlgl/events{/privacy}",  
      "received_events_url": "https://api.github.com/users/itlgl/received_events",  
      "type": "User",  
      "site_admin": false  
    },  
    "labels": [  
      {  
        "id": 857595983,  
        "url": "https://api.github.com/repos/itlgl/note/labels/Android%20Studio",  
        "name": "Android Studio",  
        "color": "c2e0c6",  
        "default": false  
      }  
    ],  
    "state": "open",  
    "locked": false,  
    "assignee": null,  
    "assignees": [  
  
    ],  
    "milestone": null,  
    "comments": 0,  
    "created_at": "2018-03-06T08:14:02Z",  
    "updated_at": "2018-03-06T08:16:59Z",  
    "closed_at": null,  
    "author_association": "OWNER",  
    "body": "升级完Android Studio以后,默认使用`classpath 'com.android.tools.build:gradle:3.0.0'`。  \r\n新建Android项目后,再新建一个java library,如果java library使用了第三方jar包,运行时会报类找不到的异常。\r\n如果把项目的gradle版本降级,换成`classpath 'com.android.tools.build:gradle:2.3.3'`,则没有这个问题,java项目可以正常运行。"  
  },  
  {  
    "url": "https://api.github.com/repos/itlgl/note/issues/1",  
    "repository_url": "https://api.github.com/repos/itlgl/note",  
    "labels_url": "https://api.github.com/repos/itlgl/note/issues/1/labels{/name}",  
    "comments_url": "https://api.github.com/repos/itlgl/note/issues/1/comments",  
    "events_url": "https://api.github.com/repos/itlgl/note/issues/1/events",  
    "html_url": "https://github.com/itlgl/note/issues/1",  
    "id": 296273797,  
    "number": 1,  
    "title": "PKCS5padding和PKCS7padding",  
    "user": {  
      "login": "itlgl",  
      "id": 7078104,  
      "avatar_url": "https://avatars0.githubusercontent.com/u/7078104?v=4",  
      "gravatar_id": "",  
      "url": "https://api.github.com/users/itlgl",  
      "html_url": "https://github.com/itlgl",  
      "followers_url": "https://api.github.com/users/itlgl/followers",  
      "following_url": "https://api.github.com/users/itlgl/following{/other_user}",  
      "gists_url": "https://api.github.com/users/itlgl/gists{/gist_id}",  
      "starred_url": "https://api.github.com/users/itlgl/starred{/owner}{/repo}",  
      "subscriptions_url": "https://api.github.com/users/itlgl/subscriptions",  
      "organizations_url": "https://api.github.com/users/itlgl/orgs",  
      "repos_url": "https://api.github.com/users/itlgl/repos",  
      "events_url": "https://api.github.com/users/itlgl/events{/privacy}",  
      "received_events_url": "https://api.github.com/users/itlgl/received_events",  
      "type": "User",  
      "site_admin": false  
    },  
    "labels": [  
      {  
        "id": 834740541,  
        "url": "https://api.github.com/repos/itlgl/note/labels/%E5%A1%AB%E5%85%85%E7%AE%97%E6%B3%95",  
        "name": "填充算法",  
        "color": "c5def5",  
        "default": false  
      }  
    ],  
    "state": "open",  
    "locked": false,  
    "assignee": null,  
    "assignees": [  
  
    ],  
    "milestone": null,  
    "comments": 0,  
    "created_at": "2018-02-12T05:58:14Z",  
    "updated_at": "2018-02-12T05:58:14Z",  
    "closed_at": null,  
    "author_association": "OWNER",  
    "body": "### PKCS5padding\r\n在PKCS5Padding中,明确定义Block的大小是8位。\r\n补padding时,如果源数据不是8(Block的长度)的整数倍,补足到8的整数倍,差1位就补1个字节0x01,差2位就补2个字节0x02,以此类推;如果源数据是8的整数倍,在后面补8个字节0x08。\r\n### PKCS7padding\r\nPKCS7padding和PKCS5padding类似,但是没有明确定义Block的长度,可以在1-255之间(块长度超出255的尚待研究),填充的算法和PKCS5psdding一致。\r\n\r\n参考: http://www.cnblogs.com/AloneSword/p/3491466.html"  
  }  
]  

2、获取单个issue内容(HTTP GET)

url:

https://api.github.com/repos/itlgl/note/issues/1?access_token=4a27c49affe39dd9fd9fe27c49e1c24cdbaac18d  

返回结果:

{  
  "url": "https://api.github.com/repos/itlgl/note/issues/1",  
  "repository_url": "https://api.github.com/repos/itlgl/note",  
  "labels_url": "https://api.github.com/repos/itlgl/note/issues/1/labels{/name}",  
  "comments_url": "https://api.github.com/repos/itlgl/note/issues/1/comments",  
  "events_url": "https://api.github.com/repos/itlgl/note/issues/1/events",  
  "html_url": "https://github.com/itlgl/note/issues/1",  
  "id": 296273797,  
  "number": 1,  
  "title": "PKCS5padding和PKCS7padding",  
  "user": {  
    "login": "itlgl",  
    "id": 7078104,  
    "avatar_url": "https://avatars0.githubusercontent.com/u/7078104?v=4",  
    "gravatar_id": "",  
    "url": "https://api.github.com/users/itlgl",  
    "html_url": "https://github.com/itlgl",  
    "followers_url": "https://api.github.com/users/itlgl/followers",  
    "following_url": "https://api.github.com/users/itlgl/following{/other_user}",  
    "gists_url": "https://api.github.com/users/itlgl/gists{/gist_id}",  
    "starred_url": "https://api.github.com/users/itlgl/starred{/owner}{/repo}",  
    "subscriptions_url": "https://api.github.com/users/itlgl/subscriptions",  
    "organizations_url": "https://api.github.com/users/itlgl/orgs",  
    "repos_url": "https://api.github.com/users/itlgl/repos",  
    "events_url": "https://api.github.com/users/itlgl/events{/privacy}",  
    "received_events_url": "https://api.github.com/users/itlgl/received_events",  
    "type": "User",  
    "site_admin": false  
  },  
  "labels": [  
    {  
      "id": 834740541,  
      "url": "https://api.github.com/repos/itlgl/note/labels/%E5%A1%AB%E5%85%85%E7%AE%97%E6%B3%95",  
      "name": "填充算法",  
      "color": "c5def5",  
      "default": false  
    }  
  ],  
  "state": "open",  
  "locked": false,  
  "assignee": null,  
  "assignees": [  
  
  ],  
  "milestone": null,  
  "comments": 0,  
  "created_at": "2018-02-12T05:58:14Z",  
  "updated_at": "2018-02-12T05:58:14Z",  
  "closed_at": null,  
  "author_association": "OWNER",  
  "body": "### PKCS5padding\r\n在PKCS5Padding中,明确定义Block的大小是8位。\r\n补padding时,如果源数据不是8(Block的长度)的整数倍,补足到8的整数倍,差1位就补1个字节0x01,差2位就补2个字节0x02,以此类推;如果源数据是8的整数倍,在后面补8个字节0x08。\r\n### PKCS7padding\r\nPKCS7padding和PKCS5padding类似,但是没有明确定义Block的长度,可以在1-255之间(块长度超出255的尚待研究),填充的算法和PKCS5psdding一致。\r\n\r\n参考: http://www.cnblogs.com/AloneSword/p/3491466.html",  
  "closed_by": null  
}  

3、渲染markdown文本(HTTP POST)

url:

https://api.github.com/markdown?access_token=4a27c49affe39dd9fd9fe27c49e1c24cdbaac18d  

报文头:

"Accept", "application/json, text/javascript, */*; q=0.01"  

json报文:

{"text":"### PKCS5padding\r\n在PKCS5Padding中,明确定义Block的大小是8位。\r\n补padding时,如果源数据不是8(Block的长度)的整数倍,补足到8的整数倍,差1位就补1个字节0x01,差2位就补2个字节0x02,以此类推;如果源数据是8的整数倍,在后面补8个字节0x08。\r\n### PKCS7padding\r\nPKCS7padding和PKCS5padding类似,但是没有明确定义Block的长度,可以在1-255之间(块长度超出255的尚待研究),填充的算法和PKCS5psdding一致。\r\n\r\n参考: http://www.cnblogs.com/AloneSword/p/3491466.html","mode":"gfm"}  

返回结果:

<h3>PKCS5padding</h3>  
<p>在PKCS5Padding中,明确定义Block的大小是8位。<br>  
补padding时,如果源数据不是8(Block的长度)的整数倍,补足到8的整数倍,差1位就补1个字节0x01,差2位就补2个字节0x02,以此类推;如果源数据是8的整数倍,在后面补8个字节0x08。</p>  
<h3>PKCS7padding</h3>  
<p>PKCS7padding和PKCS5padding类似,但是没有明确定义Block的长度,可以在1-255之间(块长度超出255的尚待研究),填充的算法和PKCS5psdding一致。</p>  
<p>参考: <a href="http://www.cnblogs.com/AloneSword/p/3491466.html" rel="nofollow">http://www.cnblogs.com/AloneSword/p/3491466.html</a></p>  

文档信息

Search

    Table of Contents