Skip to main content

project_items

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

Overview

Nameproject_items
TypeResource
Idgithub.projects.project_items

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idnumberThe unique identifier of the project item.
node_idstringThe node ID of the project item.
archived_atstring (date-time)The time when the item was archived. (example: 2022-04-28T12:00:00Z)
contentobjectThe content of the item, which varies by content type.
content_typestringThe type of content tracked in a project item (Issue, PullRequest, DraftIssue) (title: Projects v2 Item Content Type)
created_atstring (date-time)The time when the item was created. (example: 2022-04-28T12:00:00Z)
creatorobjectA GitHub user. (title: Simple User)
fieldsarrayThe fields and values associated with this item.
item_urlstring (uri)The API URL of this item. (example: https://api.github.com/users/monalisa/2/projectsV2/items/3)
project_urlstring (uri)The API URL of the project that contains this item. (example: https://api.github.com/users/monalisa/2/projectsV2/3)
updated_atstring (date-time)The time when the item was last updated. (example: 2022-04-28T12:00:00Z)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_org_itemselectproject_number, org, item_idfieldsGet a specific item from an organization-owned project.
get_user_itemselectproject_number, username, item_idfieldsGet a specific item from a user-owned project.
list_items_for_orgselectproject_number, orgq, fields, before, after, per_pageList all items for a specific organization-owned project accessible by the authenticated user.
list_items_for_userselectproject_number, usernamebefore, after, per_page, q, fieldsList all items for a specific user-owned project accessible by the authenticated user.
add_item_for_orginsertorg, project_number, type, id, owner, repo, numberAdd an issue or pull request item to the specified organization owned project.
create_draft_item_for_authenticated_userinsertuser_id, project_number, titleCreate draft issue item for the specified user owned project.
add_item_for_userinsertusername, project_number, type, id, owner, repo, numberAdd an issue or pull request item to the specified user owned project.
update_item_for_orgupdateproject_number, org, item_id, fieldsUpdate a specific item in an organization-owned project.
update_item_for_userupdateproject_number, username, item_id, fieldsUpdate a specific item in a user-owned project.
delete_item_for_orgdeleteproject_number, org, item_idDelete a specific item from an organization-owned project.
delete_item_for_userdeleteproject_number, username, item_idDelete a specific item from a 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
item_idintegerThe unique identifier of the project item.
orgstringThe organization name. The name is not case sensitive.
project_numberintegerThe project's number.
user_idstringThe unique identifier of the user.
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."
fieldsLimit results to specific fields, by their IDs. If not specified, the title field will be returned. Example: fields[]=123&fields[]=456&fields[]=789 or fields=123,456,789
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
qstringSearch query to filter items, see Filtering projects for more information.

SELECT examples

Get a specific item from an organization-owned project.

SELECT
id,
node_id,
archived_at,
content,
content_type,
created_at,
creator,
fields,
item_url,
project_url,
updated_at
FROM github.projects.project_items
WHERE project_number = '{{ project_number }}' -- required
AND org = '{{ org }}' -- required
AND item_id = '{{ item_id }}' -- required
AND fields = '{{ fields }}'
;

INSERT examples

Add an issue or pull request item to the specified organization owned project.

INSERT INTO github.projects.project_items (
type,
id,
owner,
repo,
number,
org,
project_number
)
SELECT
'{{ type }}' /* required */,
{{ id }} /* required */,
'{{ owner }}' /* required */,
'{{ repo }}' /* required */,
{{ number }} /* required */,
'{{ org }}',
'{{ project_number }}'
RETURNING
id,
node_id,
archived_at,
content,
content_type,
created_at,
creator,
item_url,
project_url,
updated_at
;

UPDATE examples

Update a specific item in an organization-owned project.

UPDATE github.projects.project_items
SET
fields = '{{ fields }}'
WHERE
project_number = '{{ project_number }}' --required
AND org = '{{ org }}' --required
AND item_id = '{{ item_id }}' --required
AND fields = '{{ fields }}' --required
RETURNING
id,
node_id,
archived_at,
content,
content_type,
created_at,
creator,
fields,
item_url,
project_url,
updated_at;

DELETE examples

Delete a specific item from an organization-owned project.

DELETE FROM github.projects.project_items
WHERE project_number = '{{ project_number }}' --required
AND org = '{{ org }}' --required
AND item_id = '{{ item_id }}' --required
;