Gist Comments API

Gist Comments use these custom media types. You can read more about the use of media types in the API here.

List comments on a gist

GET /gists/:gist_id/comments

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
  {
    "id": 1,
    "url": "https://api.github.com/gists/465acdb0e5732fafc0b7/comments/1",
    "body": "Just commenting for the sake of commenting",
    "user": {
      "login": "octocat",
      "id": 1,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "somehexcode",
      "url": "https://api.github.com/users/octocat"
    },
    "created_at": "2011-04-18T23:23:56Z"
  }
]

Get a single comment

GET /gists/:gist_id/comments/:id

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "id": 1,
  "url": "https://api.github.com/gists/465acdb0e5732fafc0b7/comments/1",
  "body": "Just commenting for the sake of commenting",
  "user": {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "somehexcode",
    "url": "https://api.github.com/users/octocat"
  },
  "created_at": "2011-04-18T23:23:56Z"
}

Create a comment

POST /gists/:gist_id/comments

Input

body
Required string
{
  "body": "Just commenting for the sake of commenting"
}

Response

Status: 201 Created
Location: https://api.github.com/gists/comments/1
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "id": 1,
  "url": "https://api.github.com/gists/465acdb0e5732fafc0b7/comments/1",
  "body": "Just commenting for the sake of commenting",
  "user": {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "somehexcode",
    "url": "https://api.github.com/users/octocat"
  },
  "created_at": "2011-04-18T23:23:56Z"
}

Edit a comment

PATCH /gists/:gist_id/comments/:id

Input

body
Required string
{
  "body": "Just commenting for the sake of commenting"
}

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "id": 1,
  "url": "https://api.github.com/gists/465acdb0e5732fafc0b7/comments/1",
  "body": "Just commenting for the sake of commenting",
  "user": {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "somehexcode",
    "url": "https://api.github.com/users/octocat"
  },
  "created_at": "2011-04-18T23:23:56Z"
}

Delete a comment

DELETE /gists/:gist_id/comments/:id

Response

Status: 204 No Content
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999

Custom media types

These are the supported media types for gist comments. You can read more about the use of media types in the API here.

application/vnd.github.VERSION.raw+json
application/vnd.github.VERSION.text+json
application/vnd.github.VERSION.html+json
application/vnd.github.VERSION.full+json