Skip to main content

このバージョンの GitHub Enterprise はこの日付をもって終了となりました: 2023-01-18. 重大なセキュリティの問題に対してであっても、パッチリリースは作成されません。 パフォーマンスの向上、セキュリティの向上、新機能の向上を図るために、最新バージョンの GitHub Enterprise にアップグレードします。 アップグレードに関するヘルプについては、GitHub Enterprise サポートにお問い合わせく� さい

Issueのコメント

issue コメント API では、issue と pull request に関するコメントを管理できます。

issue コメント API について

issue コメント API では、issue と pull request に関するコメントを管理できます。 すべてのPull Requestは Issue ですが、すべての Issue がPull Requestというわけではありません。 このため、担当者、ラベル、マイルストーンなどの管理といった、両方の機能に "共通する" アクションは、Issues API で提供されます。 pull request レビューコメントを管理するには、代わりに pull request レビューコメント API を使用します。

カスタ�  メディアの種類

この API についてサポートされているメディアの種類は次のとおりです。

application/vnd.github.raw+json
application/vnd.github.text+json
application/vnd.github.html+json
application/vnd.github.full+json

メディア タイプの詳細については、カスタ�  メディア タイプに関する記事を参照してく� さい。

List issue comments for a repository

次のもので機能します GitHub Apps

By default, Issue Comments are ordered by ascending ID.

パラメーター

Headers
Name, Type, Description
acceptstring

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

Path parameters
Name, Type, Description
ownerstringRequired

The account owner of the repository. The name is not case sensitive.

repostringRequired

The name of the repository. The name is not case sensitive.

Query parameters
Name, Type, Description
sortstring

The property to sort the results by. created means when the repository was starred. updated means when the repository was last pushed to.

Default: created

Can be one of: created, updated

directionstring

Either asc or desc. Ignored without the sort parameter.

Can be one of: asc, desc

sincestring

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

per_pageinteger

The number of results per page (max 100).

Default: 30

pageinteger

Page number of the results to fetch.

Default: 1

HTTP 応答状態コード

status code説明
200

OK

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

コード サンプル

get/repos/{owner}/{repo}/issues/comments
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/comments

Response

Status: 200
[ { "id": 1, "node_id": "MDEyOklzc3VlQ29tbWVudDE=", "url": "https://api.github.com/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://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-14T16:00:49Z", "updated_at": "2011-04-14T16:00:49Z", "issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347", "author_association": "COLLABORATOR" } ]

Get an issue comment

次のもので機能します GitHub Apps

パラメーター

Headers
Name, Type, Description
acceptstring

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

Path parameters
Name, Type, Description
ownerstringRequired

The account owner of the repository. The name is not case sensitive.

repostringRequired

The name of the repository. The name is not case sensitive.

comment_idintegerRequired

The unique identifier of the comment.

HTTP 応答状態コード

status code説明
200

OK

404

Resource not found

コード サンプル

get/repos/{owner}/{repo}/issues/comments/{comment_id}
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/comments/COMMENT_ID

Response

Status: 200
{ "id": 1, "node_id": "MDEyOklzc3VlQ29tbWVudDE=", "url": "https://api.github.com/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://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-14T16:00:49Z", "updated_at": "2011-04-14T16:00:49Z", "issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347", "author_association": "COLLABORATOR" }

Update an issue comment

次のもので機能します GitHub Apps

パラメーター

Headers
Name, Type, Description
acceptstring

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

Path parameters
Name, Type, Description
ownerstringRequired

The account owner of the repository. The name is not case sensitive.

repostringRequired

The name of the repository. The name is not case sensitive.

comment_idintegerRequired

The unique identifier of the comment.

Body parameters
Name, Type, Description
bodystringRequired

The contents of the comment.

HTTP 応答状態コード

status code説明
200

OK

422

Validation failed, or the endpoint has been spammed.

コード サンプル

patch/repos/{owner}/{repo}/issues/comments/{comment_id}
curl \ -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://api.github.com/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://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-14T16:00:49Z", "updated_at": "2011-04-14T16:00:49Z", "issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347", "author_association": "COLLABORATOR" }

Delete an issue comment

次のもので機能します GitHub Apps

パラメーター

Headers
Name, Type, Description
acceptstring

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

Path parameters
Name, Type, Description
ownerstringRequired

The account owner of the repository. The name is not case sensitive.

repostringRequired

The name of the repository. The name is not case sensitive.

comment_idintegerRequired

The unique identifier of the comment.

HTTP 応答状態コード

status code説明
204

No Content

コード サンプル

delete/repos/{owner}/{repo}/issues/comments/{comment_id}
curl \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/comments/COMMENT_ID

Response

Status: 204

List issue comments

次のもので機能します GitHub Apps

Issue Comments are ordered by ascending ID.

パラメーター

Headers
Name, Type, Description
acceptstring

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

Path parameters
Name, Type, Description
ownerstringRequired

The account owner of the repository. The name is not case sensitive.

repostringRequired

The name of the repository. The name is not case sensitive.

issue_numberintegerRequired

The number that identifies the issue.

Query parameters
Name, Type, Description
sincestring

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

per_pageinteger

The number of results per page (max 100).

Default: 30

pageinteger

Page number of the results to fetch.

Default: 1

HTTP 応答状態コード

status code説明
200

OK

404

Resource not found

410

Gone

コード サンプル

get/repos/{owner}/{repo}/issues/{issue_number}/comments
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/ISSUE_NUMBER/comments

Response

Status: 200
[ { "id": 1, "node_id": "MDEyOklzc3VlQ29tbWVudDE=", "url": "https://api.github.com/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://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-14T16:00:49Z", "updated_at": "2011-04-14T16:00:49Z", "issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347", "author_association": "COLLABORATOR" } ]

Create an issue comment

次のもので機能します GitHub Apps

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. See "Secondary rate limits" and "Dealing with secondary rate limits" for details.

パラメーター

Headers
Name, Type, Description
acceptstring

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

Path parameters
Name, Type, Description
ownerstringRequired

The account owner of the repository. The name is not case sensitive.

repostringRequired

The name of the repository. The name is not case sensitive.

issue_numberintegerRequired

The number that identifies the issue.

Body parameters
Name, Type, Description
bodystringRequired

The contents of the comment.

HTTP 応答状態コード

status code説明
201

Created

403

Forbidden

404

Resource not found

410

Gone

422

Validation failed, or the endpoint has been spammed.

コード サンプル

post/repos/{owner}/{repo}/issues/{issue_number}/comments
curl \ -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://api.github.com/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://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-14T16:00:49Z", "updated_at": "2011-04-14T16:00:49Z", "issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347", "author_association": "COLLABORATOR" }