Esta versão do GitHub Enterprise foi descontinuada em 2022-06-03. Nenhum lançamento de patch será feito, mesmo para questões críticas de segurança. Para obter melhor desempenho, melhorar a segurança e novos recursos, upgrade to the latest version of GitHub Enterprise. Para ajuda com a atualização, contact GitHub Enterprise support.
Comentários do Gist
A API de comentários do Gist permite que você veja e modifique os comentários em um gist.
Sobre a API de comentários do Gist
A API de comentários do Gist permite que você veja e modifique os comentários em um gist. Para obter mais informações sobre gists, consulte "Editando e compartilhando o 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, consulte "Tipos de mídia personalizados".
List gist comments
Parâmetros
Headers |
---|
Nome, Tipo, Descrição |
accept stringSetting to |
Path parameters |
Nome, Tipo, Descrição |
gist_id stringObrigatórioThe unique identifier of the gist. |
Parâmetros de consulta |
Nome, Tipo, Descrição |
per_page integerThe number of results per page (max 100). Padrão: |
page integerPage number of the results to fetch. Padrão: |
HTTP response status codes
Status code | Descrição |
---|---|
200 | OK |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Amostras de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/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
Headers |
---|
Nome, Tipo, Descrição |
accept stringSetting to |
Path parameters |
Nome, Tipo, Descrição |
gist_id stringObrigatórioThe unique identifier of the gist. |
Body parameters |
Nome, Tipo, Descrição |
body stringObrigatórioThe comment text. |
HTTP response status codes
Status code | Descrição |
---|---|
201 | Created |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Amostras de código
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <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://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
Headers |
---|
Nome, Tipo, Descrição |
accept stringSetting to |
Path parameters |
Nome, Tipo, Descrição |
gist_id stringObrigatórioThe unique identifier of the gist. |
comment_id integerObrigatórioThe unique identifier of the comment. |
HTTP response status codes
Status code | Descrição |
---|---|
200 | OK |
304 | Not modified |
403 | Forbidden Gist |
404 | Resource not found |
Amostras de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/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
Headers |
---|
Nome, Tipo, Descrição |
accept stringSetting to |
Path parameters |
Nome, Tipo, Descrição |
gist_id stringObrigatórioThe unique identifier of the gist. |
comment_id integerObrigatórioThe unique identifier of the comment. |
Body parameters |
Nome, Tipo, Descrição |
body stringObrigatórioThe comment text. |
HTTP response status codes
Status code | Descrição |
---|---|
200 | OK |
404 | Resource not found |
Amostras de código
curl \
-X PATCH \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <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://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
Headers |
---|
Nome, Tipo, Descrição |
accept stringSetting to |
Path parameters |
Nome, Tipo, Descrição |
gist_id stringObrigatórioThe unique identifier of the gist. |
comment_id integerObrigatórioThe unique identifier of the comment. |
HTTP response status codes
Status code | Descrição |
---|---|
204 | No Content |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Amostras de código
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/gists/GIST_ID/comments/COMMENT_ID
Response
Status: 204