Puntos de conexión de la API de REST para comentarios de gist
Puedes usar la API REST para ver y modificar los comentarios en un gist. Para más información sobre gists, consulta Editar y compartir contenido con gists.
Lists the comments on a gist.
This endpoint supports the following custom media types. For more information, see "Media types."
application/vnd..raw+json
: Returns the raw markdown. This is the default if you do not pass any specific media type.application/vnd..base64+json
: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.
Tokens de acceso específicos para "List gist comments"
Este punto de conexión funciona con los siguientes tipos de token pormenorizados:
El token pormenorizado no requiere ningún permiso.
Parámetros para "List gist comments"
Nombre, Tipo, Descripción |
---|
accept stringSetting to |
Nombre, Tipo, Descripción |
---|
gist_id string RequeridoThe unique identifier of the gist. |
Nombre, Tipo, Descripción |
---|
per_page integerThe number of results per page (max 100). For more information, see "Using pagination in the REST API." Valor predeterminado: |
page integerThe page number of the results to fetch. For more information, see "Using pagination in the REST API." Valor predeterminado: |
Códigos de estado de respuesta HTTP para "List gist comments"
status code | Descripción |
---|---|
200 | OK |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Ejemplos de código para "List gist comments"
Si accedes a en GHE.com, reemplaza api..com
por el subdominio dedicado de la empresa en api.SUBDOMAIN.ghe.com
.
Ejemplo de solicitud
curl -L \ -H "Accept: application/vnd.+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X--Api-Version: 2022-11-28" \ https://api..com/gists/GIST_ID/comments
Response
Status: 200
[ { "id": 1, "node_id": "MDExOkdpc3RDb21tZW50MQ==", "url": "https://api..com/gists/a6db0bec360bb87e9418/comments/1", "body": "Just commenting for the sake of commenting", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api..com/users/octocat", "html_url": "https://.com/octocat", "followers_url": "https://api..com/users/octocat/followers", "following_url": "https://api..com/users/octocat/following{/other_user}", "gists_url": "https://api..com/users/octocat/gists{/gist_id}", "starred_url": "https://api..com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api..com/users/octocat/subscriptions", "organizations_url": "https://api..com/users/octocat/orgs", "repos_url": "https://api..com/users/octocat/repos", "events_url": "https://api..com/users/octocat/events{/privacy}", "received_events_url": "https://api..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" } ]
Creates a comment on a gist.
This endpoint supports the following custom media types. For more information, see "Media types."
application/vnd..raw+json
: Returns the raw markdown. This is the default if you do not pass any specific media type.application/vnd..base64+json
: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.
Tokens de acceso específicos para "Create a gist comment"
Este punto de conexión funciona con los siguientes tipos de token pormenorizados:
El token pormenorizado debe tener el siguiente conjunto de permisos:
- "Gists" user permissions (write)
Parámetros para "Create a gist comment"
Nombre, Tipo, Descripción |
---|
accept stringSetting to |
Nombre, Tipo, Descripción |
---|
gist_id string RequeridoThe unique identifier of the gist. |
Nombre, Tipo, Descripción |
---|
body string RequeridoThe comment text. |
Códigos de estado de respuesta HTTP para "Create a gist comment"
status code | Descripción |
---|---|
201 | Created |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Ejemplos de código para "Create a gist comment"
Si accedes a en GHE.com, reemplaza api..com
por el subdominio dedicado de la empresa en api.SUBDOMAIN.ghe.com
.
Ejemplo de solicitud
curl -L \ -X POST \ -H "Accept: application/vnd.+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X--Api-Version: 2022-11-28" \ https://api..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..com/gists/a6db0bec360bb87e9418/comments/1", "body": "Just commenting for the sake of commenting", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api..com/users/octocat", "html_url": "https://.com/octocat", "followers_url": "https://api..com/users/octocat/followers", "following_url": "https://api..com/users/octocat/following{/other_user}", "gists_url": "https://api..com/users/octocat/gists{/gist_id}", "starred_url": "https://api..com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api..com/users/octocat/subscriptions", "organizations_url": "https://api..com/users/octocat/orgs", "repos_url": "https://api..com/users/octocat/repos", "events_url": "https://api..com/users/octocat/events{/privacy}", "received_events_url": "https://api..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" }
Gets a comment on a gist.
This endpoint supports the following custom media types. For more information, see "Media types."
application/vnd..raw+json
: Returns the raw markdown. This is the default if you do not pass any specific media type.application/vnd..base64+json
: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.
Tokens de acceso específicos para "Get a gist comment"
Este punto de conexión funciona con los siguientes tipos de token pormenorizados:
El token pormenorizado no requiere ningún permiso.
Parámetros para "Get a gist comment"
Nombre, Tipo, Descripción |
---|
accept stringSetting to |
Nombre, Tipo, Descripción |
---|
gist_id string RequeridoThe unique identifier of the gist. |
comment_id integer RequeridoThe unique identifier of the comment. |
Códigos de estado de respuesta HTTP para "Get a gist comment"
status code | Descripción |
---|---|
200 | OK |
304 | Not modified |
403 | Forbidden Gist |
404 | Resource not found |
Ejemplos de código para "Get a gist comment"
Si accedes a en GHE.com, reemplaza api..com
por el subdominio dedicado de la empresa en api.SUBDOMAIN.ghe.com
.
Ejemplo de solicitud
curl -L \ -H "Accept: application/vnd.+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X--Api-Version: 2022-11-28" \ https://api..com/gists/GIST_ID/comments/COMMENT_ID
Response
Status: 200
{ "id": 1, "node_id": "MDExOkdpc3RDb21tZW50MQ==", "url": "https://api..com/gists/a6db0bec360bb87e9418/comments/1", "body": "Just commenting for the sake of commenting", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api..com/users/octocat", "html_url": "https://.com/octocat", "followers_url": "https://api..com/users/octocat/followers", "following_url": "https://api..com/users/octocat/following{/other_user}", "gists_url": "https://api..com/users/octocat/gists{/gist_id}", "starred_url": "https://api..com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api..com/users/octocat/subscriptions", "organizations_url": "https://api..com/users/octocat/orgs", "repos_url": "https://api..com/users/octocat/repos", "events_url": "https://api..com/users/octocat/events{/privacy}", "received_events_url": "https://api..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" }
Updates a comment on a gist.
This endpoint supports the following custom media types. For more information, see "Media types."
application/vnd..raw+json
: Returns the raw markdown. This is the default if you do not pass any specific media type.application/vnd..base64+json
: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.
Tokens de acceso específicos para "Update a gist comment"
Este punto de conexión funciona con los siguientes tipos de token pormenorizados:
El token pormenorizado debe tener el siguiente conjunto de permisos:
- "Gists" user permissions (write)
Parámetros para "Update a gist comment"
Nombre, Tipo, Descripción |
---|
accept stringSetting to |
Nombre, Tipo, Descripción |
---|
gist_id string RequeridoThe unique identifier of the gist. |
comment_id integer RequeridoThe unique identifier of the comment. |
Nombre, Tipo, Descripción |
---|
body string RequeridoThe comment text. |
Códigos de estado de respuesta HTTP para "Update a gist comment"
status code | Descripción |
---|---|
200 | OK |
404 | Resource not found |
Ejemplos de código para "Update a gist comment"
Si accedes a en GHE.com, reemplaza api..com
por el subdominio dedicado de la empresa en api.SUBDOMAIN.ghe.com
.
Ejemplo de solicitud
curl -L \ -X \ -H "Accept: application/vnd.+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X--Api-Version: 2022-11-28" \ https://api..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..com/gists/a6db0bec360bb87e9418/comments/1", "body": "Just commenting for the sake of commenting", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api..com/users/octocat", "html_url": "https://.com/octocat", "followers_url": "https://api..com/users/octocat/followers", "following_url": "https://api..com/users/octocat/following{/other_user}", "gists_url": "https://api..com/users/octocat/gists{/gist_id}", "starred_url": "https://api..com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api..com/users/octocat/subscriptions", "organizations_url": "https://api..com/users/octocat/orgs", "repos_url": "https://api..com/users/octocat/repos", "events_url": "https://api..com/users/octocat/events{/privacy}", "received_events_url": "https://api..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" }
Tokens de acceso específicos para "Delete a gist comment"
Este punto de conexión funciona con los siguientes tipos de token pormenorizados:
El token pormenorizado debe tener el siguiente conjunto de permisos:
- "Gists" user permissions (write)
Parámetros para "Delete a gist comment"
Nombre, Tipo, Descripción |
---|
accept stringSetting to |
Nombre, Tipo, Descripción |
---|
gist_id string RequeridoThe unique identifier of the gist. |
comment_id integer RequeridoThe unique identifier of the comment. |
Códigos de estado de respuesta HTTP para "Delete a gist comment"
status code | Descripción |
---|---|
204 | No Content |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Ejemplos de código para "Delete a gist comment"
Si accedes a en GHE.com, reemplaza api..com
por el subdominio dedicado de la empresa en api.SUBDOMAIN.ghe.com
.
Ejemplo de solicitud
curl -L \ -X DELETE \ -H "Accept: application/vnd.+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X--Api-Version: 2022-11-28" \ https://api..com/gists/GIST_ID/comments/COMMENT_ID
Response
Status: 204