Esta versión de GitHub Enterprise se discontinuó el 2022-06-03. No se realizarán lanzamientos de patch, ni siquiera para problemas de seguridad críticos. Para obtener un mejor desempeño, más seguridad y nuevas características, actualiza a la última versión de GitHub Enterprise. Para obtener ayuda con la actualización, contacta al soporte de GitHub Enterprise.
Gist comments
The Gist comments API lets you view and modify comments on a gist.
About the Gist comments API
La API de comentarios de gists te permite ver y modificar los comentarios en un gist. Para obtener más información sobre los gists, consulta la sección "Editar y compartir el contenido con los gists".
Tipos de medios personalizados para los comentarios de los Gists
Estos son los tipos de medios compatibles para los comentarios de los gists.
application/vnd.github.VERSION.raw
application/vnd.github.VERSION.base64
Para obtener más información acerca de los tipos de medios, consulta la sección "Tipos de medios personalizados".
List gist comments
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
gist_id stringRequeridoThe unique identifier of the gist. |
Parámetros de consulta |
Nombre, Tipo, Descripción |
per_page integerThe number of results per page (max 100). Predeterminado: |
page integerPage number of the results to fetch. Predeterminado: |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
200 | OK |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Ejemplos 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
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
gist_id stringRequeridoThe unique identifier of the gist. |
Parámetros de cuerpo |
Nombre, Tipo, Descripción |
body stringRequeridoThe comment text. |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
201 | Created |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Ejemplos 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
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
gist_id stringRequeridoThe unique identifier of the gist. |
comment_id integerRequeridoThe unique identifier of the comment. |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
200 | OK |
304 | Not modified |
403 | Forbidden Gist |
404 | Resource not found |
Ejemplos 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
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
gist_id stringRequeridoThe unique identifier of the gist. |
comment_id integerRequeridoThe unique identifier of the comment. |
Parámetros de cuerpo |
Nombre, Tipo, Descripción |
body stringRequeridoThe comment text. |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
200 | OK |
404 | Resource not found |
Ejemplos 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
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
gist_id stringRequeridoThe unique identifier of the gist. |
comment_id integerRequeridoThe unique identifier of the comment. |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
204 | No Content |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Ejemplos 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