You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
route: GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_id}
5
+
scope: codeScanning
6
+
type: API method
7
+
---
8
+
9
+
# Get a code scanning alert
10
+
11
+
Gets a single code scanning alert. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint.
12
+
13
+
The security `alert_id` is found at the end of the security alert's URL. For example, the security alert ID for `https://github.com/Octo-org/octo-repo/security/code-scanning/88` is `88`.
14
+
15
+
```js
16
+
octokit.codeScanning.getAlert({
17
+
owner,
18
+
repo,
19
+
alert_id,
20
+
});
21
+
```
22
+
23
+
## Parameters
24
+
25
+
<table>
26
+
<thead>
27
+
<tr>
28
+
<th>name</th>
29
+
<th>required</th>
30
+
<th>description</th>
31
+
</tr>
32
+
</thead>
33
+
<tbody>
34
+
<tr><td>owner</td><td>yes</td><td>
35
+
36
+
owner parameter
37
+
38
+
</td></tr>
39
+
<tr><td>repo</td><td>yes</td><td>
40
+
41
+
repo parameter
42
+
43
+
</td></tr>
44
+
<tr><td>alert_id</td><td>yes</td><td>
45
+
46
+
alert_id parameter
47
+
48
+
</td></tr>
49
+
</tbody>
50
+
</table>
51
+
52
+
See also: [GitHub Developer Guide documentation](https://developer.github.com/v3/code-scanning/#get-a-code-scanning-alert).
route: GET /repos/{owner}/{repo}/code-scanning/alerts
5
+
scope: codeScanning
6
+
type: API method
7
+
---
8
+
9
+
# List code scanning alerts for a repository
10
+
11
+
Lists all open code scanning alerts for a repository. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint.
12
+
13
+
```js
14
+
octokit.codeScanning.listAlertsForRepo({
15
+
owner,
16
+
repo,
17
+
});
18
+
```
19
+
20
+
## Parameters
21
+
22
+
<table>
23
+
<thead>
24
+
<tr>
25
+
<th>name</th>
26
+
<th>required</th>
27
+
<th>description</th>
28
+
</tr>
29
+
</thead>
30
+
<tbody>
31
+
<tr><td>owner</td><td>yes</td><td>
32
+
33
+
owner parameter
34
+
35
+
</td></tr>
36
+
<tr><td>repo</td><td>yes</td><td>
37
+
38
+
repo parameter
39
+
40
+
</td></tr>
41
+
<tr><td>state</td><td>no</td><td>
42
+
43
+
Set to `closed` to list only closed code scanning alerts.
44
+
45
+
</td></tr>
46
+
</tbody>
47
+
</table>
48
+
49
+
See also: [GitHub Developer Guide documentation](https://developer.github.com/v3/code-scanning/#list-code-scanning-alerts-for-a-repository).
"description": "Lists all open code scanning alerts for a repository. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint.",
"description": "Set to `closed` to list only closed code scanning alerts.",
20069
+
"in": "QUERY",
20070
+
"type": "string",
20071
+
"required": false,
20072
+
"enum": null,
20073
+
"allowNull": false,
20074
+
"mapToData": null,
20075
+
"validation": null,
20076
+
"alias": null,
20077
+
"deprecated": null
20078
+
}
20079
+
],
20080
+
"responses": [
20081
+
{
20082
+
"code": 200,
20083
+
"description": "response",
20084
+
"examples": [
20085
+
{
20086
+
"data": "[{\"rule_id\":\"js/trivial-conditional\",\"rule_severity\":\"warning\",\"rule_description\":\"Useless conditional\",\"tool\":\"CodeQL\",\"created_at\":\"2020-05-06T12:00:00Z\",\"open\":true,\"closed_by\":null,\"closed_at\":null,\"url\":\"https://api.github.com/repos/Octo-org/octo-repo/code-scanning/alerts/25\",\"html_url\":\"https://github.com/Octo-org/octo-repo/security/code-scanning/25\"},{\"rule_id\":\"js/useless-expression\",\"rule_severity\":\"warning\",\"rule_description\":\"Expression has no effect\",\"tool\":\"CodeQL\",\"created_at\":\"2020-05-06T12:00:00Z\",\"open\":true,\"closed_by\":null,\"closed_at\":null,\"url\":\"https://api.github.com/repos/Octo-org/octo-repo/code-scanning/alerts/88\",\"html_url\":\"https://github.com/Octo-org/octo-repo/security/code-scanning/88\"}]"
"description": "Gets a single code scanning alert. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint.\n\nThe security `alert_id` is found at the end of the security alert's URL. For example, the security alert ID for `https://github.com/Octo-org/octo-repo/security/code-scanning/88` is `88`.",
"data": "{\"rule_id\":\"js/useless-expression\",\"rule_severity\":\"warning\",\"rule_description\":\"Expression has no effect\",\"tool\":\"CodeQL\",\"created_at\":\"2020-05-06T12:00:00Z\",\"open\":true,\"closed_by\":null,\"closed_at\":null,\"url\":\"https://api.github.com/repos/Octo-org/octo-repo/code-scanning/alerts/88\",\"html_url\":\"https://github.com/Octo-org/octo-repo/security/code-scanning/88\"}"
Copy file name to clipboardExpand all lines: src/generated/method-types.ts
+28Lines changed: 28 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1737,6 +1737,34 @@ export type RestEndpointMethods = {
1737
1737
endpoint: EndpointInterface<{url: string}>;
1738
1738
};
1739
1739
};
1740
+
codeScanning: {
1741
+
/**
1742
+
* Gets a single code scanning alert. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint.
1743
+
*
1744
+
* The security `alert_id` is found at the end of the security alert's URL. For example, the security alert ID for `https://github.com/Octo-org/octo-repo/security/code-scanning/88` is `88`.
* Lists all open code scanning alerts for a repository. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint.
0 commit comments