githubgithub-api

How to get a single gist from github with GET /gists/:id


Somehow I fail to get a single gist from github.

Lets say i would like to get the following gist: https://gist.github.com/jrm2k6/6637633

Just copy&paste in URL field of your browser.

With https://api.github.com/users/jrm2k6 I can get the users info as json.

With https://api.github.com/users/jrm2k6/gists I can list all the public gists from this user as json.

But how do I get a specific gist GET /gists/:id with the id = 6637633 like it is described here in the api documentation: http://developer.github.com/v3/gists/#get-a-single-gist

With https://api.github.com/users/jrm2k6/gists/6637633 I should receive the content of the gist as json but instead I receive an error

{
  "message": "Not Found",
  "documentation_url": "http://developer.github.com/v3"
}

What am I doing wrong?

SOLUTION: You do not need the /users/:user. Working: https://api.github.com/gists/6637633


Solution

  • The documentation for all gists mentions

    GET /users/:user/gists

    Notice that the documentation for a single gist mentions

    GET /gists/:id

    so you do not need a user. https://api.github.com/gists/6637633 will work.