REST API endpoints for Project views
Use the REST API to manage Project views
Create a view for an organization-owned project
Create a new view in an organization-owned project. Views allow you to customize how items in a project are displayed and filtered.
"Create a view for an organization-owned project" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Projects" organization permissions (write)
"Create a view for an organization-owned project" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
org string 必須The organization name. The name is not case sensitive. |
project_number integer 必須The project's number. |
| 名前, タイプ, 説明 |
|---|
name string 必須The name of the view. |
layout string 必須The layout of the view. 次のいずれかにできます: |
filter string The filter query for the view. See Filtering projects for more information. |
visible_fields array of integers
|
"Create a view for an organization-owned project" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
201 | Response for creating a view in an organization-owned project. |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
503 | Service unavailable |
"Create a view for an organization-owned project" のコード サンプル
GHE.com で GitHub にアクセスする場合は、api.github.com を api.SUBDOMAIN.ghe.com にあるエンタープライズの専用サブドメインに置き換えます。
要求の例
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/views \
-d '{"name":"All Issues","layout":"table","filter":"is:issue","visible_fields":[123,456,789]}'Response for creating a table view
Status: 201{
"value": {
"id": 1,
"number": 1,
"name": "Sprint Board",
"layout": "board",
"node_id": "PVTV_lADOANN5s84ACbL0zgBueEI",
"project_url": "https://api.github.com/orgs/octocat/projectsV2/1",
"html_url": "https://github.com/orgs/octocat/projects/1/views/1",
"creator": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"created_at": "2022-04-28T12:00:00Z",
"updated_at": "2022-04-28T12:00:00Z",
"filter": "is:issue is:open",
"visible_fields": [
123,
456,
789
],
"sort_by": [
[
123,
"asc"
],
[
456,
"desc"
]
],
"group_by": [
123
],
"vertical_group_by": [
456
]
}
}Create a view for a user-owned project
Create a new view in a user-owned project. Views allow you to customize how items in a project are displayed and filtered.
"Create a view for a user-owned project" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"Create a view for a user-owned project" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
user_id string 必須The unique identifier of the user. |
project_number integer 必須The project's number. |
| 名前, タイプ, 説明 |
|---|
name string 必須The name of the view. |
layout string 必須The layout of the view. 次のいずれかにできます: |
filter string The filter query for the view. See Filtering projects for more information. |
visible_fields array of integers
|
"Create a view for a user-owned project" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
201 | Response for creating a view in a user-owned project. |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
503 | Service unavailable |
"Create a view for a user-owned project" のコード サンプル
GHE.com で GitHub にアクセスする場合は、api.github.com を api.SUBDOMAIN.ghe.com にあるエンタープライズの専用サブドメインに置き換えます。
要求の例
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/USER_ID/projectsV2/PROJECT_NUMBER/views \
-d '{"name":"All Issues","layout":"table","filter":"is:issue","visible_fields":[123,456,789]}'Response for creating a table view
Status: 201{
"value": {
"id": 1,
"number": 1,
"name": "Sprint Board",
"layout": "board",
"node_id": "PVTV_lADOANN5s84ACbL0zgBueEI",
"project_url": "https://api.github.com/orgs/octocat/projectsV2/1",
"html_url": "https://github.com/orgs/octocat/projects/1/views/1",
"creator": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"created_at": "2022-04-28T12:00:00Z",
"updated_at": "2022-04-28T12:00:00Z",
"filter": "is:issue is:open",
"visible_fields": [
123,
456,
789
],
"sort_by": [
[
123,
"asc"
],
[
456,
"desc"
]
],
"group_by": [
123
],
"vertical_group_by": [
456
]
}
}