Skip to main content
The REST API is now versioned. For more information, see "About API versioning."

Project (classic) 卡

使用 REST API 创建和管理 经典项目 上的卡片。

注意:

  • 这些终结点仅与 projects (classic) 交互。 若要管理 Projects,请使用 GraphQL API。 有关详细信息,请参阅“使用 API 管理 Projects”。
  • 若要创建新的 经典项目,组织、用户或存储库必须至少有一个 经典项目。

用于管理 projects (classic) 的 REST API 仅支持使用 personal access token (classic) 进行身份验证。 有关详细信息,请参阅“管理个人访问令牌”。

Get a project card

Works with GitHub Apps

Gets information about a project card.

Parameters for "Get a project card"

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
card_id integer 必须

The unique identifier of the card.

HTTP response status codes for "Get a project card"

Status codeDescription
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

Code samples for "Get a project card"

get/projects/columns/cards/{card_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/projects/columns/cards/CARD_ID

Response

Status: 200
{ "url": "https://api.github.com/projects/columns/cards/1478", "id": 1478, "node_id": "MDExOlByb2plY3RDYXJkMTQ3OA==", "note": "Add payload for delete Project column", "creator": { "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": "2016-09-05T14:21:06Z", "updated_at": "2016-09-05T14:20:22Z", "archived": false, "column_url": "https://api.github.com/projects/columns/367", "content_url": "https://api.github.com/repos/api-playground/projects-test/issues/3", "project_url": "https://api.github.com/projects/120" }

Update an existing project card

Works with GitHub Apps

Parameters for "Update an existing project card"

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
card_id integer 必须

The unique identifier of the card.

正文参数
名称, 类型, 说明
note string or null

The project card's note

archived boolean

Whether or not the card is archived

HTTP response status codes for "Update an existing project card"

Status codeDescription
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Code samples for "Update an existing project card"

patch/projects/columns/cards/{card_id}
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/projects/columns/cards/CARD_ID \ -d '{"note":"Add payload for delete Project column"}'

Response

Status: 200
{ "url": "https://api.github.com/projects/columns/cards/1478", "id": 1478, "node_id": "MDExOlByb2plY3RDYXJkMTQ3OA==", "note": "Add payload for delete Project column", "creator": { "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": "2016-09-05T14:21:06Z", "updated_at": "2016-09-05T14:20:22Z", "archived": false, "column_url": "https://api.github.com/projects/columns/367", "content_url": "https://api.github.com/repos/api-playground/projects-test/issues/3", "project_url": "https://api.github.com/projects/120" }

Delete a project card

Works with GitHub Apps

Deletes a project card

Parameters for "Delete a project card"

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
card_id integer 必须

The unique identifier of the card.

HTTP response status codes for "Delete a project card"

Status codeDescription
204

No Content

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

Code samples for "Delete a project card"

delete/projects/columns/cards/{card_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/projects/columns/cards/CARD_ID

Response

Status: 204

Move a project card

Works with GitHub Apps

Parameters for "Move a project card"

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
card_id integer 必须

The unique identifier of the card.

正文参数
名称, 类型, 说明
position string 必须

The position of the card in a column. Can be one of: top, bottom, or after:<card_id> to place after the specified card.

column_id integer

The unique identifier of the column the card should be moved to

HTTP response status codes for "Move a project card"

Status codeDescription
201

Created

304

Not modified

401

Requires authentication

403

Forbidden

422

Validation failed, or the endpoint has been spammed.

503

Service Unavailable

Code samples for "Move a project card"

post/projects/columns/cards/{card_id}/moves
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/projects/columns/cards/CARD_ID/moves \ -d '{"column_id":42,"position":"bottom"}'

Response

List project cards

Works with GitHub Apps

Lists the project cards in a project.

Parameters for "List project cards"

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
column_id integer 必须

The unique identifier of the column.

查询参数
名称, 类型, 说明
archived_state string

Filters the project cards that are returned by the card's state.

默认: not_archived

可以是以下选项之一: all, archived, not_archived

per_page integer

The number of results per page (max 100).

默认: 30

page integer

Page number of the results to fetch.

默认: 1

HTTP response status codes for "List project cards"

Status codeDescription
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

Code samples for "List project cards"

get/projects/columns/{column_id}/cards
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/projects/columns/COLUMN_ID/cards

Response

Status: 200
[ { "url": "https://api.github.com/projects/columns/cards/1478", "id": 1478, "node_id": "MDExOlByb2plY3RDYXJkMTQ3OA==", "note": "Add payload for delete Project column", "creator": { "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": "2016-09-05T14:21:06Z", "updated_at": "2016-09-05T14:20:22Z", "archived": false, "column_url": "https://api.github.com/projects/columns/367", "content_url": "https://api.github.com/repos/api-playground/projects-test/issues/3", "project_url": "https://api.github.com/projects/120" } ]

Create a project card

Works with GitHub Apps

Parameters for "Create a project card"

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
column_id integer 必须

The unique identifier of the column.

正文参数
名称, 类型, 说明
note string or null 必须

The project card's note

content_id integer 必须

The unique identifier of the content associated with the card

content_type string 必须

The piece of content associated with the card

HTTP response status codes for "Create a project card"

Status codeDescription
201

Created

304

Not modified

401

Requires authentication

403

Forbidden

422

Validation failed

503

Service Unavailable

Code samples for "Create a project card"

post/projects/columns/{column_id}/cards
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/projects/columns/COLUMN_ID/cards \ -d '{"note":"Add payload for delete Project column"}'

Response

Status: 201
{ "url": "https://api.github.com/projects/columns/cards/1478", "id": 1478, "node_id": "MDExOlByb2plY3RDYXJkMTQ3OA==", "note": "Add payload for delete Project column", "creator": { "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": "2016-09-05T14:21:06Z", "updated_at": "2016-09-05T14:20:22Z", "archived": false, "column_url": "https://api.github.com/projects/columns/367", "content_url": "https://api.github.com/repos/api-playground/projects-test/issues/3", "project_url": "https://api.github.com/projects/120" }