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.
Pontos de extremidade da API REST para comentários de issues
Use a API REST para gerenciar os comentários em problemas e solicitações de pull.
Sobre comentários em problemas e solicitações de pull
Use a API REST para criar e gerenciar os comentários em problemas e solicitações de pull. Cada pull request é um problema, mas nem todos os problemas são um pull request. Por esse motivo, as ações "compartilhadas" para ambos os recursos, como gerenciamento de destinatários, rótulos e marcos, são fornecidas nos pontos de extremidade de Problemas. Para gerenciar comentários de revisão de solicitação de pull, confira “Pontos de extremidade da API REST para comentários de revisões de solicitações de pull”.
List issue comments for a repository
You can use the REST API to list comments on issues and pull requests for a repository. Every pull request is an issue, but not every issue is a pull request.
By default, issue comments are ordered by ascending ID.
This endpoint supports the following custom media types. For more information, see "Media types."
- application/vnd.github.raw+json: Returns the raw markdown body. Response will include- body. This is the default if you do not pass any specific media type.
- application/vnd.github.text+json: Returns a text only representation of the markdown body. Response will include- body_text.
- application/vnd.github.html+json: Returns HTML rendered from the body's markdown. Response will include- body_html.
- application/vnd.github.full+json: Returns raw, text, and HTML representations. Response will include- body,- body_text, and- body_html.
Parâmetros para "List issue comments for a repository"
| Nome, Tipo, Descrição | 
|---|
| acceptstringSetting to  | 
| Nome, Tipo, Descrição | 
|---|
| ownerstring ObrigatórioThe account owner of the repository. The name is not case sensitive. | 
| repostring ObrigatórioThe name of the repository without the  | 
| Nome, Tipo, Descrição | 
|---|
| sortstringThe property to sort the results by. Padrão:  Pode ser um dos:  | 
| directionstringEither  Pode ser um dos:  | 
| sincestringOnly show results that were last updated after the given time. This is a timestamp in ISO 8601 format:  | 
| per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão:  | 
| pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão:  | 
Códigos de status de resposta HTTP para "List issue comments for a repository"
| Código de status | Descrição | 
|---|---|
| 200 | OK | 
| 404 | Resource not found | 
| 422 | Validation failed, or the endpoint has been spammed. | 
Exemplos de código para "List issue comments for a repository"
Exemplo de solicitação
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/commentsResponse
Status: 200[
  {
    "id": 1,
    "node_id": "MDEyOklzc3VlQ29tbWVudDE=",
    "url": "https://HOSTNAME/repos/octocat/Hello-World/issues/comments/1",
    "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1",
    "body": "Me too",
    "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-14T16:00:49Z",
    "updated_at": "2011-04-14T16:00:49Z",
    "issue_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/1347",
    "author_association": "COLLABORATOR"
  }
]Get an issue comment
You can use the REST API to get comments on issues and pull requests. Every pull request is an issue, but not every issue is a pull request.
This endpoint supports the following custom media types. For more information, see "Media types."
- application/vnd.github.raw+json: Returns the raw markdown body. Response will include- body. This is the default if you do not pass any specific media type.
- application/vnd.github.text+json: Returns a text only representation of the markdown body. Response will include- body_text.
- application/vnd.github.html+json: Returns HTML rendered from the body's markdown. Response will include- body_html.
- application/vnd.github.full+json: Returns raw, text, and HTML representations. Response will include- body,- body_text, and- body_html.
Parâmetros para "Get an issue comment"
| Nome, Tipo, Descrição | 
|---|
| acceptstringSetting to  | 
| Nome, Tipo, Descrição | 
|---|
| ownerstring ObrigatórioThe account owner of the repository. The name is not case sensitive. | 
| repostring ObrigatórioThe name of the repository without the  | 
| comment_idinteger ObrigatórioThe unique identifier of the comment. | 
Códigos de status de resposta HTTP para "Get an issue comment"
| Código de status | Descrição | 
|---|---|
| 200 | OK | 
| 404 | Resource not found | 
Exemplos de código para "Get an issue comment"
Exemplo de solicitação
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/comments/COMMENT_IDResponse
Status: 200{
  "id": 1,
  "node_id": "MDEyOklzc3VlQ29tbWVudDE=",
  "url": "https://HOSTNAME/repos/octocat/Hello-World/issues/comments/1",
  "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1",
  "body": "Me too",
  "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-14T16:00:49Z",
  "updated_at": "2011-04-14T16:00:49Z",
  "issue_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/1347",
  "author_association": "COLLABORATOR"
}Update an issue comment
You can use the REST API to update comments on issues and pull requests. Every pull request is an issue, but not every issue is a pull request.
This endpoint supports the following custom media types. For more information, see "Media types."
- application/vnd.github.raw+json: Returns the raw markdown body. Response will include- body. This is the default if you do not pass any specific media type.
- application/vnd.github.text+json: Returns a text only representation of the markdown body. Response will include- body_text.
- application/vnd.github.html+json: Returns HTML rendered from the body's markdown. Response will include- body_html.
- application/vnd.github.full+json: Returns raw, text, and HTML representations. Response will include- body,- body_text, and- body_html.
Parâmetros para "Update an issue comment"
| Nome, Tipo, Descrição | 
|---|
| acceptstringSetting to  | 
| Nome, Tipo, Descrição | 
|---|
| ownerstring ObrigatórioThe account owner of the repository. The name is not case sensitive. | 
| repostring ObrigatórioThe name of the repository without the  | 
| comment_idinteger ObrigatórioThe unique identifier of the comment. | 
| Nome, Tipo, Descrição | 
|---|
| bodystring ObrigatórioThe contents of the comment. | 
Códigos de status de resposta HTTP para "Update an issue comment"
| Código de status | Descrição | 
|---|---|
| 200 | OK | 
| 422 | Validation failed, or the endpoint has been spammed. | 
Exemplos de código para "Update an issue comment"
Exemplo de solicitação
curl -L \
  -X PATCH \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/comments/COMMENT_ID \
  -d '{"body":"Me too"}'Response
Status: 200{
  "id": 1,
  "node_id": "MDEyOklzc3VlQ29tbWVudDE=",
  "url": "https://HOSTNAME/repos/octocat/Hello-World/issues/comments/1",
  "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1",
  "body": "Me too",
  "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-14T16:00:49Z",
  "updated_at": "2011-04-14T16:00:49Z",
  "issue_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/1347",
  "author_association": "COLLABORATOR"
}Delete an issue comment
You can use the REST API to delete comments on issues and pull requests. Every pull request is an issue, but not every issue is a pull request.
Parâmetros para "Delete an issue comment"
| Nome, Tipo, Descrição | 
|---|
| acceptstringSetting to  | 
| Nome, Tipo, Descrição | 
|---|
| ownerstring ObrigatórioThe account owner of the repository. The name is not case sensitive. | 
| repostring ObrigatórioThe name of the repository without the  | 
| comment_idinteger ObrigatórioThe unique identifier of the comment. | 
Códigos de status de resposta HTTP para "Delete an issue comment"
| Código de status | Descrição | 
|---|---|
| 204 | No Content | 
Exemplos de código para "Delete an issue comment"
Exemplo de solicitação
curl -L \
  -X DELETE \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/comments/COMMENT_IDResponse
Status: 204List issue comments
You can use the REST API to list comments on issues and pull requests. Every pull request is an issue, but not every issue is a pull request.
Issue comments are ordered by ascending ID.
This endpoint supports the following custom media types. For more information, see "Media types."
- application/vnd.github.raw+json: Returns the raw markdown body. Response will include- body. This is the default if you do not pass any specific media type.
- application/vnd.github.text+json: Returns a text only representation of the markdown body. Response will include- body_text.
- application/vnd.github.html+json: Returns HTML rendered from the body's markdown. Response will include- body_html.
- application/vnd.github.full+json: Returns raw, text, and HTML representations. Response will include- body,- body_text, and- body_html.
Parâmetros para "List issue comments"
| Nome, Tipo, Descrição | 
|---|
| acceptstringSetting to  | 
| Nome, Tipo, Descrição | 
|---|
| ownerstring ObrigatórioThe account owner of the repository. The name is not case sensitive. | 
| repostring ObrigatórioThe name of the repository without the  | 
| issue_numberinteger ObrigatórioThe number that identifies the issue. | 
| Nome, Tipo, Descrição | 
|---|
| sincestringOnly show results that were last updated after the given time. This is a timestamp in ISO 8601 format:  | 
| per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão:  | 
| pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão:  | 
Códigos de status de resposta HTTP para "List issue comments"
| Código de status | Descrição | 
|---|---|
| 200 | OK | 
| 404 | Resource not found | 
| 410 | Gone | 
Exemplos de código para "List issue comments"
Exemplo de solicitação
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/ISSUE_NUMBER/commentsResponse
Status: 200[
  {
    "id": 1,
    "node_id": "MDEyOklzc3VlQ29tbWVudDE=",
    "url": "https://HOSTNAME/repos/octocat/Hello-World/issues/comments/1",
    "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1",
    "body": "Me too",
    "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-14T16:00:49Z",
    "updated_at": "2011-04-14T16:00:49Z",
    "issue_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/1347",
    "author_association": "COLLABORATOR"
  }
]Create an issue comment
You can use the REST API to create comments on issues and pull requests. Every pull request is an issue, but not every issue is a pull request.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see "Rate limits for the API" and "Best practices for using the REST API."
This endpoint supports the following custom media types. For more information, see "Media types."
- application/vnd.github.raw+json: Returns the raw markdown body. Response will include- body. This is the default if you do not pass any specific media type.
- application/vnd.github.text+json: Returns a text only representation of the markdown body. Response will include- body_text.
- application/vnd.github.html+json: Returns HTML rendered from the body's markdown. Response will include- body_html.
- application/vnd.github.full+json: Returns raw, text, and HTML representations. Response will include- body,- body_text, and- body_html.
Parâmetros para "Create an issue comment"
| Nome, Tipo, Descrição | 
|---|
| acceptstringSetting to  | 
| Nome, Tipo, Descrição | 
|---|
| ownerstring ObrigatórioThe account owner of the repository. The name is not case sensitive. | 
| repostring ObrigatórioThe name of the repository without the  | 
| issue_numberinteger ObrigatórioThe number that identifies the issue. | 
| Nome, Tipo, Descrição | 
|---|
| bodystring ObrigatórioThe contents of the comment. | 
Códigos de status de resposta HTTP para "Create an issue comment"
| Código de status | Descrição | 
|---|---|
| 201 | Created | 
| 403 | Forbidden | 
| 404 | Resource not found | 
| 410 | Gone | 
| 422 | Validation failed, or the endpoint has been spammed. | 
Exemplos de código para "Create an issue comment"
Exemplo de solicitação
curl -L \
  -X POST \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/ISSUE_NUMBER/comments \
  -d '{"body":"Me too"}'Response
Status: 201{
  "id": 1,
  "node_id": "MDEyOklzc3VlQ29tbWVudDE=",
  "url": "https://HOSTNAME/repos/octocat/Hello-World/issues/comments/1",
  "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1",
  "body": "Me too",
  "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-14T16:00:49Z",
  "updated_at": "2011-04-14T16:00:49Z",
  "issue_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/1347",
  "author_association": "COLLABORATOR"
}