project_items
Creates, updates, deletes, gets or lists a project_items resource.
Overview
| Name | project_items |
| Type | Resource |
| Id | github.projects.project_items |
Fields
The following fields are returned by SELECT queries:
- get_org_item
- get_user_item
- list_items_for_org
- list_items_for_user
Response
| Name | Datatype | Description |
|---|---|---|
id | number | The unique identifier of the project item. |
node_id | string | The node ID of the project item. |
archived_at | string (date-time) | The time when the item was archived. (example: 2022-04-28T12:00:00Z) |
content | object | The content of the item, which varies by content type. |
content_type | string | The type of content tracked in a project item (Issue, PullRequest, DraftIssue) (title: Projects v2 Item Content Type) |
created_at | string (date-time) | The time when the item was created. (example: 2022-04-28T12:00:00Z) |
creator | object | A GitHub user. (title: Simple User) |
fields | array | The fields and values associated with this item. |
item_url | string (uri) | The API URL of this item. (example: https://api.github.com/users/monalisa/2/projectsV2/items/3) |
project_url | string (uri) | The API URL of the project that contains this item. (example: https://api.github.com/users/monalisa/2/projectsV2/3) |
updated_at | string (date-time) | The time when the item was last updated. (example: 2022-04-28T12:00:00Z) |
Response
| Name | Datatype | Description |
|---|---|---|
id | number | The unique identifier of the project item. |
node_id | string | The node ID of the project item. |
archived_at | string (date-time) | The time when the item was archived. (example: 2022-04-28T12:00:00Z) |
content | object | The content of the item, which varies by content type. |
content_type | string | The type of content tracked in a project item (Issue, PullRequest, DraftIssue) (title: Projects v2 Item Content Type) |
created_at | string (date-time) | The time when the item was created. (example: 2022-04-28T12:00:00Z) |
creator | object | A GitHub user. (title: Simple User) |
fields | array | The fields and values associated with this item. |
item_url | string (uri) | The API URL of this item. (example: https://api.github.com/users/monalisa/2/projectsV2/items/3) |
project_url | string (uri) | The API URL of the project that contains this item. (example: https://api.github.com/users/monalisa/2/projectsV2/3) |
updated_at | string (date-time) | The time when the item was last updated. (example: 2022-04-28T12:00:00Z) |
Response
| Name | Datatype | Description |
|---|---|---|
id | number | The unique identifier of the project item. |
node_id | string | The node ID of the project item. |
archived_at | string (date-time) | The time when the item was archived. (example: 2022-04-28T12:00:00Z) |
content | object | The content of the item, which varies by content type. |
content_type | string | The type of content tracked in a project item (Issue, PullRequest, DraftIssue) (title: Projects v2 Item Content Type) |
created_at | string (date-time) | The time when the item was created. (example: 2022-04-28T12:00:00Z) |
creator | object | A GitHub user. (title: Simple User) |
fields | array | The fields and values associated with this item. |
item_url | string (uri) | The API URL of this item. (example: https://api.github.com/users/monalisa/2/projectsV2/items/3) |
project_url | string (uri) | The API URL of the project that contains this item. (example: https://api.github.com/users/monalisa/2/projectsV2/3) |
updated_at | string (date-time) | The time when the item was last updated. (example: 2022-04-28T12:00:00Z) |
Response
| Name | Datatype | Description |
|---|---|---|
id | number | The unique identifier of the project item. |
node_id | string | The node ID of the project item. |
archived_at | string (date-time) | The time when the item was archived. (example: 2022-04-28T12:00:00Z) |
content | object | The content of the item, which varies by content type. |
content_type | string | The type of content tracked in a project item (Issue, PullRequest, DraftIssue) (title: Projects v2 Item Content Type) |
created_at | string (date-time) | The time when the item was created. (example: 2022-04-28T12:00:00Z) |
creator | object | A GitHub user. (title: Simple User) |
fields | array | The fields and values associated with this item. |
item_url | string (uri) | The API URL of this item. (example: https://api.github.com/users/monalisa/2/projectsV2/items/3) |
project_url | string (uri) | The API URL of the project that contains this item. (example: https://api.github.com/users/monalisa/2/projectsV2/3) |
updated_at | string (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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_org_item | select | project_number, org, item_id | fields | Get a specific item from an organization-owned project. |
get_user_item | select | project_number, username, item_id | fields | Get a specific item from a user-owned project. |
list_items_for_org | select | project_number, org | q, fields, before, after, per_page | List all items for a specific organization-owned project accessible by the authenticated user. |
list_items_for_user | select | project_number, username | before, after, per_page, q, fields | List all items for a specific user-owned project accessible by the authenticated user. |
add_item_for_org | insert | org, project_number, type, id, owner, repo, number | Add an issue or pull request item to the specified organization owned project. | |
create_draft_item_for_authenticated_user | insert | user_id, project_number, title | Create draft issue item for the specified user owned project. | |
add_item_for_user | insert | username, project_number, type, id, owner, repo, number | Add an issue or pull request item to the specified user owned project. | |
update_item_for_org | update | project_number, org, item_id, fields | Update a specific item in an organization-owned project. | |
update_item_for_user | update | project_number, username, item_id, fields | Update a specific item in a user-owned project. | |
delete_item_for_org | delete | project_number, org, item_id | Delete a specific item from an organization-owned project. | |
delete_item_for_user | delete | project_number, username, item_id | Delete 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.
| Name | Datatype | Description |
|---|---|---|
item_id | integer | The unique identifier of the project item. |
org | string | The organization name. The name is not case sensitive. |
project_number | integer | The project's number. |
user_id | string | The unique identifier of the user. |
username | string | The handle for the GitHub user account. |
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." |
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." |
fields | | Limit 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_page | integer | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
q | string | Search query to filter items, see Filtering projects for more information. |
SELECT examples
- get_org_item
- get_user_item
- list_items_for_org
- list_items_for_user
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 }}'
;
Get a specific item from a user-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 username = '{{ username }}' -- required
AND item_id = '{{ item_id }}' -- required
AND fields = '{{ fields }}'
;
List all items for a specific organization-owned project accessible by the authenticated user.
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 q = '{{ q }}'
AND fields = '{{ fields }}'
AND before = '{{ before }}'
AND after = '{{ after }}'
AND per_page = '{{ per_page }}'
;
List all items for a specific user-owned project accessible by the authenticated user.
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 username = '{{ username }}' -- required
AND before = '{{ before }}'
AND after = '{{ after }}'
AND per_page = '{{ per_page }}'
AND q = '{{ q }}'
AND fields = '{{ fields }}'
;
INSERT examples
- add_item_for_org
- create_draft_item_for_authenticated_user
- add_item_for_user
- Manifest
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
;
Create draft issue item for the specified user owned project.
INSERT INTO github.projects.project_items (
title,
body,
user_id,
project_number
)
SELECT
'{{ title }}' /* required */,
'{{ body }}',
'{{ user_id }}',
'{{ project_number }}'
RETURNING
id,
node_id,
archived_at,
content,
content_type,
created_at,
creator,
item_url,
project_url,
updated_at
;
Add an issue or pull request item to the specified user owned project.
INSERT INTO github.projects.project_items (
type,
id,
owner,
repo,
number,
username,
project_number
)
SELECT
'{{ type }}' /* required */,
{{ id }} /* required */,
'{{ owner }}' /* required */,
'{{ repo }}' /* required */,
{{ number }} /* required */,
'{{ username }}',
'{{ project_number }}'
RETURNING
id,
node_id,
archived_at,
content,
content_type,
created_at,
creator,
item_url,
project_url,
updated_at
;
# Description fields are for documentation purposes
- name: project_items
props:
- name: org
value: "{{ org }}"
description: Required parameter for the project_items resource.
- name: project_number
value: {{ project_number }}
description: Required parameter for the project_items resource.
- name: user_id
value: "{{ user_id }}"
description: Required parameter for the project_items resource.
- name: username
value: "{{ username }}"
description: Required parameter for the project_items resource.
- name: type
value: "{{ type }}"
description: |
The type of item to add to the project. Must be either Issue or PullRequest.
valid_values: ['Issue', 'PullRequest']
- name: id
value: {{ id }}
description: |
The unique identifier of the issue or pull request to add to the project.
- name: owner
value: "{{ owner }}"
description: |
The repository owner login.
- name: repo
value: "{{ repo }}"
description: |
The repository name.
- name: number
value: {{ number }}
description: |
The issue or pull request number.
- name: title
value: "{{ title }}"
description: |
The title of the draft issue item to create in the project.
- name: body
value: "{{ body }}"
description: |
The body content of the draft issue item to create in the project.
UPDATE examples
- update_item_for_org
- update_item_for_user
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;
Update a specific item in a user-owned project.
UPDATE github.projects.project_items
SET
fields = '{{ fields }}'
WHERE
project_number = '{{ project_number }}' --required
AND username = '{{ username }}' --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_item_for_org
- delete_item_for_user
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
;
Delete a specific item from a user-owned project.
DELETE FROM github.projects.project_items
WHERE project_number = '{{ project_number }}' --required
AND username = '{{ username }}' --required
AND item_id = '{{ item_id }}' --required
;