Skip to main content

project_fields

Creates, updates, deletes, gets or lists a project_fields resource.

Overview

Nameproject_fields
TypeResource
Idgithub.projects.project_fields

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idintegerThe unique identifier of the field.
namestringThe name of the field.
issue_field_idintegerThe ID of the issue field.
node_idstringThe node ID of the field.
configurationobjectConfiguration for iteration fields.
created_atstring (date-time)The time when the field was created. (example: 2022-04-28T12:00:00Z)
data_typestringThe field's data type. (assignees, linked_pull_requests, reviewers, labels, milestone, repository, title, text, single_select, number, date, iteration, issue_type, parent_issue, sub_issues_progress)
optionsarrayThe options available for single select fields.
project_urlstringThe API URL of the project that contains the field. (example: https://api.github.com/projects/1)
updated_atstring (date-time)The time when the field was last updated. (example: 2022-04-28T12:00:00Z)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_field_for_orgselectproject_number, field_id, orgGet a specific field for an organization-owned project.
get_field_for_userselectproject_number, field_id, usernameGet a specific field for a user-owned project.
list_fields_for_orgselectproject_number, orgper_page, before, afterList all fields for a specific organization-owned project.
list_fields_for_userselectproject_number, usernameper_page, before, afterList all fields for a specific user-owned project.
add_field_for_orginsertproject_number, org, issue_field_id, name, data_type, single_select_options, iteration_configurationAdd a field to an organization-owned project.
add_field_for_userinsertusername, project_number, name, data_type, single_select_options, iteration_configurationAdd a field to a specified user owned project.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
field_idintegerThe unique identifier of the field.
orgstringThe organization name. The name is not case sensitive.
project_numberintegerThe project's number.
usernamestringThe handle for the GitHub user account.
afterstringA 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."
beforestringA 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."
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."

SELECT examples

Get a specific field for an organization-owned project.

SELECT
id,
name,
issue_field_id,
node_id,
configuration,
created_at,
data_type,
options,
project_url,
updated_at
FROM github.projects.project_fields
WHERE project_number = '{{ project_number }}' -- required
AND field_id = '{{ field_id }}' -- required
AND org = '{{ org }}' -- required
;

INSERT examples

Add a field to an organization-owned project.

INSERT INTO github.projects.project_fields (
issue_field_id,
name,
data_type,
single_select_options,
iteration_configuration,
project_number,
org
)
SELECT
{{ issue_field_id }} /* required */,
'{{ name }}' /* required */,
'{{ data_type }}' /* required */,
'{{ single_select_options }}' /* required */,
'{{ iteration_configuration }}' /* required */,
'{{ project_number }}',
'{{ org }}'
RETURNING
id,
name,
issue_field_id,
node_id,
configuration,
created_at,
data_type,
options,
project_url,
updated_at
;