如何从问题ID获取g​​ithub问题网址?

时间:2018-05-24 15:54:24

标签: reactjs axios github-api query-parameters

我正在创建一个github问题应用程序,在显示特定仓库的问题列表后,我想点击一个问题并导航到问题详细信息页面。

所以我通过路由参数传递{issue.id}。现在,为了获取axios GET请求获取详细信息,我想从给定的ID中获取此特定问题的url

有人可以指导吗?

1 个答案:

答案 0 :(得分:-1)

请检查此网址:

https://developer.github.com/v3/issues/#list-issues

Example:

https://api.github.com/repos/octocat/Hello-World/issues

https://api.github.com/repos/octocat/Hello-World/issues{/number}



Hope this helps.

示例回复:

[
  {
    "url": "https://api.github.com/repos/octocat/Hello-World/issues/404",
    "repository_url": "https://api.github.com/repos/octocat/Hello-World",
    "labels_url": "https://api.github.com/repos/octocat/Hello-World/issues/404/labels{/name}",
    "comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/404/comments",
    "events_url": "https://api.github.com/repos/octocat/Hello-World/issues/404/events",
    "html_url": "https://github.com/octocat/Hello-World/issues/404",
    "id": 322291044,
    "number": 404,
    "title": "Internationalization",
    "user": {
      "login": "dgruntz",
      "id": 1516800,
      "avatar_url": "https://avatars0.githubusercontent.com/u/1516800?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/dgruntz",
      "html_url": "https://github.com/dgruntz",
      "followers_url": "https://api.github.com/users/dgruntz/followers",
      "following_url": "https://api.github.com/users/dgruntz/following{/other_user}",
      "gists_url": "https://api.github.com/users/dgruntz/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/dgruntz/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/dgruntz/subscriptions",
      "organizations_url": "https://api.github.com/users/dgruntz/orgs",
      "repos_url": "https://api.github.com/users/dgruntz/repos",
      "events_url": "https://api.github.com/users/dgruntz/events{/privacy}",
      "received_events_url": "https://api.github.com/users/dgruntz/received_events",
      "type": "User",
      "site_admin": false
    },
    "labels": [

    ],
    "state": "open",
    "locked": false,
    "assignee": null,
    "assignees": [

    ],
    "milestone": null,
    "comments": 0,
    "created_at": "2018-05-11T13:11:00Z",
    "updated_at": "2018-05-11T13:11:00Z",
    "closed_at": null,
    "author_association": "NONE",
    "body": "I miss internationalization support for this project. Will that ever be added?"
  } ]