Skip to main content
O controle de versão da API REST já foi feito. Para obter mais informações, confira "Sobre o controle de versão da API".

Pontos de extremidade da API REST para campos do Project

Usar a API REST para gerenciar campos do Project

List project fields for organization

List all fields for a specific organization-owned project.

Tokens de acesso refinados para "List project fields for organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Projects" organization permissions (read)

Esse ponto de extremidade pode ser usado sem autenticação ou as permissões acima mencionadas se apenas recursos públicos forem solicitados.

Parâmetros para "List project fields for organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
project_number integer Obrigatório

The project's number.

org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros de consulta
Nome, Tipo, Descrição
per_page integer

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

Padrão: 30

before string

A cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."

after string

A cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."

Códigos de status de resposta HTTP para "List project fields for organization"

Código de statusDescrição
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

Exemplos de código para "List project fields for organization"

Exemplo de solicitação

get/orgs/{org}/projectsV2/{project_number}/fields
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/orgs/ORG/projectsV2/PROJECT_NUMBER/fields

Response

Status: 200
[ { "id": 12345, "node_id": "PVTF_lADOABCD1234567890", "name": "Priority", "data_type": "single_select", "project_url": "https://api.github.com/projects/67890", "options": [ { "id": "option_1", "name": { "html": "Low", "raw": "Low" }, "color": "GREEN", "description": { "html": "Low priority items", "raw": "Low priority items" } }, { "id": "option_2", "name": { "html": "Medium", "raw": "Medium" }, "color": "YELLOW", "description": { "html": "Medium priority items", "raw": "Medium priority items" } }, { "id": "option_3", "name": { "html": "High", "raw": "High" }, "color": "RED", "description": { "html": "High priority items", "raw": "High priority items" } } ], "created_at": "2022-04-28T12:00:00Z", "updated_at": "2022-04-28T12:00:00Z" }, { "id": 67891, "node_id": "PVTF_lADOABCD9876543210", "name": "Status", "data_type": "single_select", "project_url": "https://api.github.com/projects/67890", "options": [ { "id": "option_4", "name": { "html": "Todo", "raw": "Todo" }, "color": "GRAY", "description": { "html": "Items to be worked on", "raw": "Items to be worked on" } }, { "id": "option_5", "name": { "html": "In Progress", "raw": "In Progress" }, "color": "BLUE", "description": { "html": "Items currently being worked on", "raw": "Items currently being worked on" } }, { "id": "option_6", "name": { "html": "Done", "raw": "Done" }, "color": "GREEN", "description": { "html": "Completed items", "raw": "Completed items" } } ], "created_at": "2022-04-29T10:30:00Z", "updated_at": "2022-04-29T10:30:00Z" }, { "id": 24680, "node_id": "PVTF_lADOABCD2468024680", "name": "Team notes", "data_type": "text", "project_url": "https://api.github.com/projects/67890", "created_at": "2022-05-15T08:00:00Z", "updated_at": "2022-05-15T08:00:00Z" }, { "id": 13579, "node_id": "PVTF_lADOABCD1357913579", "name": "Story points", "data_type": "number", "project_url": "https://api.github.com/projects/67890", "created_at": "2022-06-01T14:30:00Z", "updated_at": "2022-06-01T14:30:00Z" }, { "id": 98765, "node_id": "PVTF_lADOABCD9876598765", "name": "Due date", "data_type": "date", "project_url": "https://api.github.com/projects/67890", "created_at": "2022-06-10T09:15:00Z", "updated_at": "2022-06-10T09:15:00Z" }, { "id": 11223, "node_id": "PVTF_lADOABCD1122311223", "name": "Sprint", "data_type": "iteration", "project_url": "https://api.github.com/projects/67890", "configuration": { "duration": 14, "start_day": 1, "iterations": [ { "id": "iter_1", "title": { "html": "Sprint 1", "raw": "Sprint 1" }, "start_date": "2022-07-01", "duration": 14 }, { "id": "iter_2", "title": { "html": "Sprint 2", "raw": "Sprint 2" }, "start_date": "2022-07-15", "duration": 14 } ] }, "created_at": "2022-06-20T16:45:00Z", "updated_at": "2022-06-20T16:45:00Z" } ]

Add a field to an organization-owned project.

Add a field to an organization-owned project.

Tokens de acesso refinados para "Add a field to an organization-owned project."

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Projects" organization permissions (write)

Esse ponto de extremidade pode ser usado sem autenticação ou as permissões acima mencionadas se apenas recursos públicos forem solicitados.

Parâmetros para "Add a field to an organization-owned project."

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
project_number integer Obrigatório

The project's number.

org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
issue_field_id integer Obrigatório

The ID of the IssueField to create the field for.

name string Obrigatório

The name of the field.

data_type string Obrigatório

The field's data type.

Valor: iteration

single_select_options array of objects

The options available for single select fields. At least one option must be provided when creating a single select field.

Nome, Tipo, Descrição
name string

The display name of the option.

color string

The color associated with the option.

Pode ser um dos: BLUE, GRAY, GREEN, ORANGE, PINK, PURPLE, RED, YELLOW

description string

The description of the option.

iteration_configuration object Obrigatório

The configuration for iteration fields.

Nome, Tipo, Descrição
start_date string

The start date of the first iteration.

duration integer

The default duration for iterations in days. Individual iterations can override this value.

iterations array of objects

Zero or more iterations for the field.

Nome, Tipo, Descrição
title string

The title of the iteration.

start_date string

The start date of the iteration.

duration integer

The duration of the iteration in days.

Códigos de status de resposta HTTP para "Add a field to an organization-owned project."

Código de statusDescrição
201

Response for adding a field to an organization-owned project.

304

Not modified

401

Requires authentication

403

Forbidden

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Add a field to an organization-owned project."

Exemplos de solicitação

post/orgs/{org}/projectsV2/{project_number}/fields
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/orgs/ORG/projectsV2/PROJECT_NUMBER/fields \ -d '{"name":"Team notes","data_type":"text"}'

Response for adding a field to an organization-owned project.

Status: 201
{ "id": 24680, "node_id": "PVTF_lADOABCD2468024680", "name": "Team notes", "data_type": "text", "project_url": "https://api.github.com/projects/67890", "created_at": "2022-05-15T08:00:00Z", "updated_at": "2022-05-15T08:00:00Z" }

Get project field for organization

Get a specific field for an organization-owned project.

Tokens de acesso refinados para "Get project field for organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Projects" organization permissions (read)

Esse ponto de extremidade pode ser usado sem autenticação ou as permissões acima mencionadas se apenas recursos públicos forem solicitados.

Parâmetros para "Get project field for organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
project_number integer Obrigatório

The project's number.

field_id integer Obrigatório

The unique identifier of the field.

org string Obrigatório

The organization name. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get project field for organization"

Código de statusDescrição
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

Exemplos de código para "Get project field for organization"

Exemplo de solicitação

get/orgs/{org}/projectsV2/{project_number}/fields/{field_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/orgs/ORG/projectsV2/PROJECT_NUMBER/fields/FIELD_ID

Response

Status: 200
{ "id": 12345, "node_id": "PVTF_lADOABCD1234567890", "name": "Priority", "data_type": "single_select", "project_url": "https://api.github.com/projects/67890", "options": [ { "id": "option_1", "name": { "html": "Low", "raw": "Low" }, "color": "GREEN", "description": { "html": "Low priority items", "raw": "Low priority items" } }, { "id": "option_2", "name": { "html": "Medium", "raw": "Medium" }, "color": "YELLOW", "description": { "html": "Medium priority items", "raw": "Medium priority items" } }, { "id": "option_3", "name": { "html": "High", "raw": "High" }, "color": "RED", "description": { "html": "High priority items", "raw": "High priority items" } } ], "created_at": "2022-04-28T12:00:00Z", "updated_at": "2022-04-28T12:00:00Z" }

List project fields for user

List all fields for a specific user-owned project.

Tokens de acesso refinados para "List project fields for user"

Esse ponto de extremidade não funciona com tokens de acesso de usuário do aplicativo GitHub, tokens de acesso de instalação do aplicativo GitHub ou tokens de acesso pessoal refinados.

Parâmetros para "List project fields for user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
project_number integer Obrigatório

The project's number.

username string Obrigatório

The handle for the GitHub user account.

Parâmetros de consulta
Nome, Tipo, Descrição
per_page integer

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

Padrão: 30

before string

A cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."

after string

A cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."

Códigos de status de resposta HTTP para "List project fields for user"

Código de statusDescrição
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

Exemplos de código para "List project fields for user"

Exemplo de solicitação

get/users/{username}/projectsV2/{project_number}/fields
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/users/USERNAME/projectsV2/PROJECT_NUMBER/fields

Response

Status: 200
[ { "id": 12345, "node_id": "PVTF_lADOABCD1234567890", "name": "Priority", "data_type": "single_select", "project_url": "https://api.github.com/projects/67890", "options": [ { "id": "option_1", "name": { "html": "Low", "raw": "Low" }, "color": "GREEN", "description": { "html": "Low priority items", "raw": "Low priority items" } }, { "id": "option_2", "name": { "html": "Medium", "raw": "Medium" }, "color": "YELLOW", "description": { "html": "Medium priority items", "raw": "Medium priority items" } }, { "id": "option_3", "name": { "html": "High", "raw": "High" }, "color": "RED", "description": { "html": "High priority items", "raw": "High priority items" } } ], "created_at": "2022-04-28T12:00:00Z", "updated_at": "2022-04-28T12:00:00Z" }, { "id": 67891, "node_id": "PVTF_lADOABCD9876543210", "name": "Status", "data_type": "single_select", "project_url": "https://api.github.com/projects/67890", "options": [ { "id": "option_4", "name": { "html": "Todo", "raw": "Todo" }, "color": "GRAY", "description": { "html": "Items to be worked on", "raw": "Items to be worked on" } }, { "id": "option_5", "name": { "html": "In Progress", "raw": "In Progress" }, "color": "BLUE", "description": { "html": "Items currently being worked on", "raw": "Items currently being worked on" } }, { "id": "option_6", "name": { "html": "Done", "raw": "Done" }, "color": "GREEN", "description": { "html": "Completed items", "raw": "Completed items" } } ], "created_at": "2022-04-29T10:30:00Z", "updated_at": "2022-04-29T10:30:00Z" }, { "id": 24680, "node_id": "PVTF_lADOABCD2468024680", "name": "Team notes", "data_type": "text", "project_url": "https://api.github.com/projects/67890", "created_at": "2022-05-15T08:00:00Z", "updated_at": "2022-05-15T08:00:00Z" }, { "id": 13579, "node_id": "PVTF_lADOABCD1357913579", "name": "Story points", "data_type": "number", "project_url": "https://api.github.com/projects/67890", "created_at": "2022-06-01T14:30:00Z", "updated_at": "2022-06-01T14:30:00Z" }, { "id": 98765, "node_id": "PVTF_lADOABCD9876598765", "name": "Due date", "data_type": "date", "project_url": "https://api.github.com/projects/67890", "created_at": "2022-06-10T09:15:00Z", "updated_at": "2022-06-10T09:15:00Z" }, { "id": 11223, "node_id": "PVTF_lADOABCD1122311223", "name": "Sprint", "data_type": "iteration", "project_url": "https://api.github.com/projects/67890", "configuration": { "duration": 14, "start_day": 1, "iterations": [ { "id": "iter_1", "title": { "html": "Sprint 1", "raw": "Sprint 1" }, "start_date": "2022-07-01", "duration": 14 }, { "id": "iter_2", "title": { "html": "Sprint 2", "raw": "Sprint 2" }, "start_date": "2022-07-15", "duration": 14 } ] }, "created_at": "2022-06-20T16:45:00Z", "updated_at": "2022-06-20T16:45:00Z" } ]

Add field to user owned project

Add a field to a specified user owned project.

Tokens de acesso refinados para "Add field to user owned project"

Esse ponto de extremidade não funciona com tokens de acesso de usuário do aplicativo GitHub, tokens de acesso de instalação do aplicativo GitHub ou tokens de acesso pessoal refinados.

Parâmetros para "Add field to user owned project"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
username string Obrigatório

The handle for the GitHub user account.

project_number integer Obrigatório

The project's number.

Parâmetros do corpo
Nome, Tipo, Descrição
name string Obrigatório

The name of the field.

data_type string Obrigatório

The field's data type.

Valor: iteration

single_select_options array of objects

The options available for single select fields. At least one option must be provided when creating a single select field.

Nome, Tipo, Descrição
name string

The display name of the option.

color string

The color associated with the option.

Pode ser um dos: BLUE, GRAY, GREEN, ORANGE, PINK, PURPLE, RED, YELLOW

description string

The description of the option.

iteration_configuration object Obrigatório

The configuration for iteration fields.

Nome, Tipo, Descrição
start_date string

The start date of the first iteration.

duration integer

The default duration for iterations in days. Individual iterations can override this value.

iterations array of objects

Zero or more iterations for the field.

Nome, Tipo, Descrição
title string

The title of the iteration.

start_date string

The start date of the iteration.

duration integer

The duration of the iteration in days.

Códigos de status de resposta HTTP para "Add field to user owned project"

Código de statusDescrição
201

Created

304

Not modified

401

Requires authentication

403

Forbidden

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Add field to user owned project"

Exemplos de solicitação

post/users/{username}/projectsV2/{project_number}/fields
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/users/USERNAME/projectsV2/PROJECT_NUMBER/fields \ -d '{"name":"Team notes","data_type":"text"}'

Response

Status: 201
{ "id": 24680, "node_id": "PVTF_lADOABCD2468024680", "name": "Team notes", "data_type": "text", "project_url": "https://api.github.com/projects/67890", "created_at": "2022-05-15T08:00:00Z", "updated_at": "2022-05-15T08:00:00Z" }

Get project field for user

Get a specific field for a user-owned project.

Tokens de acesso refinados para "Get project field for user"

Esse ponto de extremidade não funciona com tokens de acesso de usuário do aplicativo GitHub, tokens de acesso de instalação do aplicativo GitHub ou tokens de acesso pessoal refinados.

Parâmetros para "Get project field for user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
project_number integer Obrigatório

The project's number.

field_id integer Obrigatório

The unique identifier of the field.

username string Obrigatório

The handle for the GitHub user account.

Códigos de status de resposta HTTP para "Get project field for user"

Código de statusDescrição
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

Exemplos de código para "Get project field for user"

Exemplo de solicitação

get/users/{username}/projectsV2/{project_number}/fields/{field_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/users/USERNAME/projectsV2/PROJECT_NUMBER/fields/FIELD_ID

Response

Status: 200
{ "id": 12345, "node_id": "PVTF_lADOABCD1234567890", "name": "Priority", "data_type": "single_select", "project_url": "https://api.github.com/projects/67890", "options": [ { "id": "option_1", "name": { "html": "Low", "raw": "Low" }, "color": "GREEN", "description": { "html": "Low priority items", "raw": "Low priority items" } }, { "id": "option_2", "name": { "html": "Medium", "raw": "Medium" }, "color": "YELLOW", "description": { "html": "Medium priority items", "raw": "Medium priority items" } }, { "id": "option_3", "name": { "html": "High", "raw": "High" }, "color": "RED", "description": { "html": "High priority items", "raw": "High priority items" } } ], "created_at": "2022-04-28T12:00:00Z", "updated_at": "2022-04-28T12:00:00Z" }