@@ -715,6 +715,61 @@ gh api graphql -f query='
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
## Managing projects
|
||||
|
||||
### Creating projects
|
||||
|
||||
You can use a mutation to create a new project. For more information, see "[About mutations](/graphql/guides/forming-calls-with-graphql#about-mutations)."
|
||||
|
||||
To create a new project using the API, you'll need to provide a name for the project and the node ID of a {% data variables.product.product_name %} user or organization who will become the project's owner.
|
||||
|
||||
You can find the node ID of a {% data variables.product.product_name %} user or organization if you know the username. Replace <code>GITHUB_OWNER</code> with the {% data variables.product.product_name %} username of the new project owner.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
curl --request GET \
|
||||
--url https://api.github.com/users/<em>GITHUB_OWNER</em> \
|
||||
--header 'Authorization: token <em>TOKEN</em>' \
|
||||
--header 'Accept: application/vnd.github+json'
|
||||
```
|
||||
{% endcurl %}
|
||||
|
||||
{% cli %}
|
||||
```shell
|
||||
gh api -H "Accept: application/vnd.github+json" /users/<em>GITHUB_OWNER</em>
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
To create the project, replace `OWNER_ID` with the node ID of the new project owner and replace `PROJECT_NAME` with a name for the project.
|
||||
|
||||
{% curl %}
|
||||
```shell
|
||||
curl --request POST \
|
||||
--url https://api.github.com/graphql \
|
||||
--header 'Authorization: token <em>TOKEN</em>' \
|
||||
--data '{"query":"mutation {createProjectV2(input: {ownerId: \"<em>OWNER_ID</em>\" title: \"<em>PROJECT_NAME</em>\"}) {projectV2 {id}}}"}'
|
||||
```
|
||||
{% endcurl %}
|
||||
|
||||
{% cli %}
|
||||
```shell
|
||||
gh api graphql -f query='
|
||||
mutation{
|
||||
createProjectV2(
|
||||
input: {
|
||||
ownerId: "<em>OWNER_ID</em>",
|
||||
title: "<em>PROJECT_NAME</em>"
|
||||
}
|
||||
){
|
||||
projectV2 {
|
||||
id
|
||||
}
|
||||
}
|
||||
}'
|
||||
```
|
||||
{% endcli %}
|
||||
|
||||
|
||||
## Using webhooks
|
||||
|
||||
You can use webhooks to subscribe to events taking place in your project. For example, when an item is edited, {% data variables.product.product_name %} can send a HTTP POST payload to the webhook's configured URL which can trigger automation on your server. For more information about webhooks, see "[About webhooks](/developers/webhooks-and-events/webhooks/about-webhooks)." To learn more about the `projects_v2_item` webhook event, see "[Webhook events and payloads](/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#projects_v2_item)."
|
||||
|
||||
Reference in New Issue
Block a user