|
| 1 | +--- |
| 2 | +name: Create a campaign for an organization |
| 3 | +example: octokit.rest.campaigns.createCampaign({ org, name, description, ends_at, code_scanning_alerts, code_scanning_alerts[].repository_id, code_scanning_alerts[].alert_numbers }) |
| 4 | +route: POST /orgs/{org}/campaigns |
| 5 | +scope: campaigns |
| 6 | +type: API method |
| 7 | +--- |
| 8 | + |
| 9 | +# Create a campaign for an organization |
| 10 | + |
| 11 | +Create a campaign for an organization. |
| 12 | + |
| 13 | +The authenticated user must be an owner or security manager for the organization to use this endpoint. |
| 14 | + |
| 15 | +OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint. |
| 16 | + |
| 17 | +Fine-grained tokens must have the "Code scanning alerts" repository permissions (read) on all repositories included |
| 18 | +in the campaign. |
| 19 | + |
| 20 | +```js |
| 21 | +octokit.rest.campaigns.createCampaign({ |
| 22 | + org, |
| 23 | +name, |
| 24 | +description, |
| 25 | +ends_at, |
| 26 | +code_scanning_alerts, |
| 27 | +code_scanning_alerts[].repository_id, |
| 28 | +code_scanning_alerts[].alert_numbers |
| 29 | + }) |
| 30 | +``` |
| 31 | + |
| 32 | +## Parameters |
| 33 | + |
| 34 | +<table> |
| 35 | + <thead> |
| 36 | + <tr> |
| 37 | + <th>name</th> |
| 38 | + <th>required</th> |
| 39 | + <th>description</th> |
| 40 | + </tr> |
| 41 | + </thead> |
| 42 | + <tbody> |
| 43 | + <tr><td>org</td><td>yes</td><td> |
| 44 | + |
| 45 | +The organization name. The name is not case sensitive. |
| 46 | + |
| 47 | +</td></tr> |
| 48 | +<tr><td>name</td><td>yes</td><td> |
| 49 | + |
| 50 | +The name of the campaign |
| 51 | + |
| 52 | +</td></tr> |
| 53 | +<tr><td>description</td><td>yes</td><td> |
| 54 | + |
| 55 | +A description for the campaign |
| 56 | + |
| 57 | +</td></tr> |
| 58 | +<tr><td>managers</td><td>no</td><td> |
| 59 | + |
| 60 | +The logins of the users to set as the campaign managers. At this time, only a single manager can be supplied. |
| 61 | + |
| 62 | +</td></tr> |
| 63 | +<tr><td>team_managers</td><td>no</td><td> |
| 64 | + |
| 65 | +The slugs of the teams to set as the campaign managers. |
| 66 | + |
| 67 | +</td></tr> |
| 68 | +<tr><td>ends_at</td><td>yes</td><td> |
| 69 | + |
| 70 | +The end date and time of the campaign. The date must be in the future. |
| 71 | + |
| 72 | +</td></tr> |
| 73 | +<tr><td>contact_link</td><td>no</td><td> |
| 74 | + |
| 75 | +The contact link of the campaign. Must be a URI. |
| 76 | + |
| 77 | +</td></tr> |
| 78 | +<tr><td>code_scanning_alerts</td><td>yes</td><td> |
| 79 | + |
| 80 | +The code scanning alerts to include in this campaign |
| 81 | + |
| 82 | +</td></tr> |
| 83 | +<tr><td>code_scanning_alerts[].repository_id</td><td>yes</td><td> |
| 84 | + |
| 85 | +The repository id |
| 86 | + |
| 87 | +</td></tr> |
| 88 | +<tr><td>code_scanning_alerts[].alert_numbers</td><td>yes</td><td> |
| 89 | + |
| 90 | +The alert numbers |
| 91 | + |
| 92 | +</td></tr> |
| 93 | +<tr><td>generate_issues</td><td>no</td><td> |
| 94 | + |
| 95 | +If true, will automatically generate issues for the campaign. The default is false. |
| 96 | + |
| 97 | +</td></tr> |
| 98 | + </tbody> |
| 99 | +</table> |
| 100 | + |
| 101 | +See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/campaigns/campaigns#create-a-campaign-for-an-organization). |
0 commit comments