Skip to main content

Esta versão do GitHub Enterprise Server foi descontinuada em 2024-03-26. Nenhum lançamento de patch será feito, mesmo para questões críticas de segurança. Para obter melhor desempenho, segurança aprimorada e novos recursos, atualize para a última versão do GitHub Enterprise Server. Para obter ajuda com a atualização, entre em contato com o suporte do GitHub Enterprise.

Depois que um administrador do site fizer upgrade da sua instância do Enterprise Server para Enterprise Server 3.9 ou posterior, o controle de versão da API REST será feito. Para saber como encontrar a versão da sua instância, confira "Sobre as versões do GitHub Docs". Para obter mais informações, confira "Sobre o controle de versão da API".

Pontos de extremidade da API REST para comentários essenciais

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".

List gist comments

Lists the comments on a gist.

This endpoint supports the following custom media types. For more information, see "Media types."

  • application/vnd.github.raw+json: Returns the raw markdown. This is the default if you do not pass any specific media type.
  • application/vnd.github.base64+json: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.

Parâmetros para "List gist comments"

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

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

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

The unique identifier of the gist.

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

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Padrão: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

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"

Exemplo de solicitação

get/gists/{gist_id}/comments
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/gists/GIST_ID/comments

Response

Status: 200
[ { "id": 1, "node_id": "MDExOkdpc3RDb21tZW50MQ==", "url": "https://HOSTNAME/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://HOSTNAME/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "received_events_url": "https://HOSTNAME/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

Creates a comment on a gist.

This endpoint supports the following custom media types. For more information, see "Media types."

  • application/vnd.github.raw+json: Returns the raw markdown. This is the default if you do not pass any specific media type.
  • application/vnd.github.base64+json: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.

Parâmetros para "Create a gist comment"

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

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

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

The unique identifier of the gist.

Parâmetros do corpo
Nome, Tipo, 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"

Exemplo de solicitação

post/gists/{gist_id}/comments
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/gists/GIST_ID/comments \ -d '{"body":"This is a comment to a gist"}'

Response

Status: 201
{ "id": 1, "node_id": "MDExOkdpc3RDb21tZW50MQ==", "url": "https://HOSTNAME/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://HOSTNAME/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "received_events_url": "https://HOSTNAME/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

Gets a comment on a gist.

This endpoint supports the following custom media types. For more information, see "Media types."

  • application/vnd.github.raw+json: Returns the raw markdown. This is the default if you do not pass any specific media type.
  • application/vnd.github.base64+json: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.

Parâmetros para "Get a gist comment"

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

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

Parâmetros de caminho
Nome, Tipo, 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"

Exemplo de solicitação

get/gists/{gist_id}/comments/{comment_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/gists/GIST_ID/comments/COMMENT_ID

Response

Status: 200
{ "id": 1, "node_id": "MDExOkdpc3RDb21tZW50MQ==", "url": "https://HOSTNAME/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://HOSTNAME/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "received_events_url": "https://HOSTNAME/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

Updates a comment on a gist.

This endpoint supports the following custom media types. For more information, see "Media types."

  • application/vnd.github.raw+json: Returns the raw markdown. This is the default if you do not pass any specific media type.
  • application/vnd.github.base64+json: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.

Parâmetros para "Update a gist comment"

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

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

Parâmetros de caminho
Nome, Tipo, 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, Tipo, 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"

Exemplo de solicitação

patch/gists/{gist_id}/comments/{comment_id}
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/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://HOSTNAME/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://HOSTNAME/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "received_events_url": "https://HOSTNAME/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, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, 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"

Exemplo de solicitação

delete/gists/{gist_id}/comments/{comment_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/gists/GIST_ID/comments/COMMENT_ID

Response

Status: 204