Skip to main content
REST API 现已经过版本控制。 有关详细信息,请参阅“关于 API 版本控制”。

Project (classic) 列的 REST API 终结点

使用 REST API 创建和管理 项目(经典) 上的列。

注意:

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

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

Get a project column

Gets information about a project column.

“Get a project column”的细粒度访问令牌

This endpoint works with the following fine-grained token types:

令牌必须至少具有以下权限集之一:

  • "Projects" repository permissions (read)
  • "Projects" organization permissions (read)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此终结点。

“Get a project column”的参数

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

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

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

The unique identifier of the column.

“Get a project column”的 HTTP 响应状态代码

状态代码说明
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

“Get a project column”的示例代码

请求示例

get/projects/columns/{column_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/COLUMN_ID

Response

Status: 200
{ "url": "https://api.github.com/projects/columns/367", "project_url": "https://api.github.com/projects/120", "cards_url": "https://api.github.com/projects/columns/367/cards", "id": 367, "node_id": "MDEzOlByb2plY3RDb2x1bW4zNjc=", "name": "To Do", "created_at": "2016-09-05T14:18:44Z", "updated_at": "2016-09-05T14:22:28Z" }

Update an existing project column

“Update an existing project column”的细粒度访问令牌

This endpoint works with the following fine-grained token types:

令牌必须至少具有以下权限集之一:

  • "Projects" repository permissions (write)
  • "Projects" organization permissions (write)

“Update an existing project column”的参数

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

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

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

The unique identifier of the column.

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

Name of the project column

“Update an existing project column”的 HTTP 响应状态代码

状态代码说明
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

“Update an existing project column”的示例代码

请求示例

patch/projects/columns/{column_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/COLUMN_ID \ -d '{"name":"To Do"}'

Response

Status: 200
{ "url": "https://api.github.com/projects/columns/367", "project_url": "https://api.github.com/projects/120", "cards_url": "https://api.github.com/projects/columns/367/cards", "id": 367, "node_id": "MDEzOlByb2plY3RDb2x1bW4zNjc=", "name": "To Do", "created_at": "2016-09-05T14:18:44Z", "updated_at": "2016-09-05T14:22:28Z" }

Delete a project column

Deletes a project column.

“Delete a project column”的细粒度访问令牌

This endpoint works with the following fine-grained token types:

令牌必须至少具有以下权限集之一:

  • "Projects" repository permissions (write)
  • "Projects" organization permissions (write)

“Delete a project column”的参数

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

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

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

The unique identifier of the column.

“Delete a project column”的 HTTP 响应状态代码

状态代码说明
204

No Content

304

Not modified

401

Requires authentication

403

Forbidden

“Delete a project column”的示例代码

请求示例

delete/projects/columns/{column_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/COLUMN_ID

Response

Status: 204

Move a project column

“Move a project column”的细粒度访问令牌

This endpoint works with the following fine-grained token types:

令牌必须至少具有以下权限集之一:

  • "Projects" repository permissions (write)
  • "Projects" organization permissions (write)

“Move a project column”的参数

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

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

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

The unique identifier of the column.

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

The position of the column in a project. Can be one of: first, last, or after:<column_id> to place after the specified column.

“Move a project column”的 HTTP 响应状态代码

状态代码说明
201

Created

304

Not modified

401

Requires authentication

403

Forbidden

422

Validation failed, or the endpoint has been spammed.

“Move a project column”的示例代码

请求示例

post/projects/columns/{column_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/COLUMN_ID/moves \ -d '{"position":"last"}'

Response

List project columns

Lists the project columns in a project.

“List project columns”的细粒度访问令牌

This endpoint works with the following fine-grained token types:

令牌必须至少具有以下权限集之一:

  • "Projects" repository permissions (read)
  • "Projects" organization permissions (read)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此终结点。

“List project columns”的参数

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

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

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

The unique identifier of the project.

查询参数
名称, 类型, 说明
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

默认: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

默认: 1

“List project columns”的 HTTP 响应状态代码

状态代码说明
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

“List project columns”的示例代码

请求示例

get/projects/{project_id}/columns
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/PROJECT_ID/columns

Response

Status: 200
[ { "url": "https://api.github.com/projects/columns/367", "project_url": "https://api.github.com/projects/120", "cards_url": "https://api.github.com/projects/columns/367/cards", "id": 367, "node_id": "MDEzOlByb2plY3RDb2x1bW4zNjc=", "name": "To Do", "created_at": "2016-09-05T14:18:44Z", "updated_at": "2016-09-05T14:22:28Z" } ]

Create a project column

Creates a new project column.

“Create a project column”的细粒度访问令牌

This endpoint works with the following fine-grained token types:

令牌必须至少具有以下权限集之一:

  • "Projects" repository permissions (write)
  • "Projects" organization permissions (write)

“Create a project column”的参数

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

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

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

The unique identifier of the project.

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

Name of the project column

“Create a project column”的 HTTP 响应状态代码

状态代码说明
201

Created

304

Not modified

401

Requires authentication

403

Forbidden

422

Validation failed, or the endpoint has been spammed.

“Create a project column”的示例代码

请求示例

post/projects/{project_id}/columns
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/PROJECT_ID/columns \ -d '{"name":"Remaining tasks"}'

Response

Status: 201
{ "url": "https://api.github.com/projects/columns/367", "project_url": "https://api.github.com/projects/120", "cards_url": "https://api.github.com/projects/columns/367/cards", "id": 367, "node_id": "MDEzOlByb2plY3RDb2x1bW4zNjc=", "name": "To Do", "created_at": "2016-09-05T14:18:44Z", "updated_at": "2016-09-05T14:22:28Z" }