Skip to main content
O controle de versão da API REST já foi feito. Para obter mais informações, confira "Sobre o controle de versão da API".

Comentários do gist

Use a API REST para ver e modificar comentários em um gist.

Sobre os comentários de gist

Use a API REST para ver e modificar comentários em um gist. Para obter mais informações sobre gists, confira "Editar e compartilhar conteúdo com gists".

Tipos de mídia personalizados para comentários do Gist

Estes são os tipos de mídia compatíveis para comentários de gist.

application/vnd.github.VERSION.raw
application/vnd.github.VERSION.base64

Para obter mais informações sobre os tipos de mídia, confira "Tipos de mídia".

List gist comments

Parâmetros para "List gist comments"

Cabeçalhos
Nome, Type, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Type, Descrição
gist_id string Obrigatório

The unique identifier of the gist.

Parâmetros de consulta
Nome, Type, Descrição
per_page integer

The number of results per page (max 100).

Padrão: 30

page integer

Page number of the results to fetch.

Padrão: 1

Códigos de status de resposta HTTP para "List gist comments"

Código de statusDescrição
200

OK

304

Not modified

403

Forbidden

404

Resource not found

Exemplos de código para "List gist comments"

get/gists/{gist_id}/comments
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/gists/GIST_ID/comments

Response

Status: 200
[ { "id": 1, "node_id": "MDExOkdpc3RDb21tZW50MQ==", "url": "https://api.github.com/gists/a6db0bec360bb87e9418/comments/1", "body": "Just commenting for the sake of commenting", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "created_at": "2011-04-18T23:23:56Z", "updated_at": "2011-04-18T23:23:56Z", "author_association": "COLLABORATOR" } ]

Create a gist comment

Parâmetros para "Create a gist comment"

Cabeçalhos
Nome, Type, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Type, Descrição
gist_id string Obrigatório

The unique identifier of the gist.

Parâmetros do corpo
Nome, Type, Descrição
body string Obrigatório

The comment text.

Códigos de status de resposta HTTP para "Create a gist comment"

Código de statusDescrição
201

Created

304

Not modified

403

Forbidden

404

Resource not found

Exemplos de código para "Create a gist comment"

post/gists/{gist_id}/comments
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/gists/GIST_ID/comments \ -d '{"body":"This is a comment to a gist"}'

Response

Status: 201
{ "id": 1, "node_id": "MDExOkdpc3RDb21tZW50MQ==", "url": "https://api.github.com/gists/a6db0bec360bb87e9418/comments/1", "body": "Just commenting for the sake of commenting", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "created_at": "2011-04-18T23:23:56Z", "updated_at": "2011-04-18T23:23:56Z", "author_association": "COLLABORATOR" }

Get a gist comment

Parâmetros para "Get a gist comment"

Cabeçalhos
Nome, Type, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Type, Descrição
gist_id string Obrigatório

The unique identifier of the gist.

comment_id integer Obrigatório

The unique identifier of the comment.

Códigos de status de resposta HTTP para "Get a gist comment"

Código de statusDescrição
200

OK

304

Not modified

403

Forbidden Gist

404

Resource not found

Exemplos de código para "Get a gist comment"

get/gists/{gist_id}/comments/{comment_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/gists/GIST_ID/comments/COMMENT_ID

Response

Status: 200
{ "id": 1, "node_id": "MDExOkdpc3RDb21tZW50MQ==", "url": "https://api.github.com/gists/a6db0bec360bb87e9418/comments/1", "body": "Just commenting for the sake of commenting", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "created_at": "2011-04-18T23:23:56Z", "updated_at": "2011-04-18T23:23:56Z", "author_association": "COLLABORATOR" }

Update a gist comment

Parâmetros para "Update a gist comment"

Cabeçalhos
Nome, Type, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Type, Descrição
gist_id string Obrigatório

The unique identifier of the gist.

comment_id integer Obrigatório

The unique identifier of the comment.

Parâmetros do corpo
Nome, Type, Descrição
body string Obrigatório

The comment text.

Códigos de status de resposta HTTP para "Update a gist comment"

Código de statusDescrição
200

OK

404

Resource not found

Exemplos de código para "Update a gist comment"

patch/gists/{gist_id}/comments/{comment_id}
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/gists/GIST_ID/comments/COMMENT_ID \ -d '{"body":"This is an update to a comment in a gist"}'

Response

Status: 200
{ "id": 1, "node_id": "MDExOkdpc3RDb21tZW50MQ==", "url": "https://api.github.com/gists/a6db0bec360bb87e9418/comments/1", "body": "Just commenting for the sake of commenting", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "created_at": "2011-04-18T23:23:56Z", "updated_at": "2011-04-18T23:23:56Z", "author_association": "COLLABORATOR" }

Delete a gist comment

Parâmetros para "Delete a gist comment"

Cabeçalhos
Nome, Type, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Type, Descrição
gist_id string Obrigatório

The unique identifier of the gist.

comment_id integer Obrigatório

The unique identifier of the comment.

Códigos de status de resposta HTTP para "Delete a gist comment"

Código de statusDescrição
204

No Content

304

Not modified

403

Forbidden

404

Resource not found

Exemplos de código para "Delete a gist comment"

delete/gists/{gist_id}/comments/{comment_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/gists/GIST_ID/comments/COMMENT_ID

Response

Status: 204