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
Copy file name to clipboardExpand all lines: docusaurus/docs/codacy-api/api-tokens.mdx
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,24 +8,24 @@ import ApiTokenWarning from './../_includes/ApiTokenWarning.mdx'
8
8
Codacy provides **account** and **repository**-level API tokens that allow you to:
9
9
10
10
-[Upload coverage data](../coverage-reporter/index.md) to Codacy
11
-
- Upload to Codacy the results of [running client-side analysis tools](../repositories-configure/local-analysis/client-side-tools.md)
12
-
-[Authenticate when using the Codacy API](using-the-codacy-api.md#authenticating-requests)
11
+
- Upload to Codacy the results of [running client-side analysis tools](../repositories-configure/local-analysis/client-side-tools)
12
+
-[Authenticate when using the Codacy API](using-the-codacy-api#authenticating-requests)
13
13
14
14
The sections below provide details about the two types of API tokens and instructions on how to generate and revoke them.
15
15
16
16
<ApiTokenWarning />
17
17
18
-
## Generating and revoking account API tokens ||account-api-tokens||
18
+
## Generating and revoking account API tokens \{#account-api-tokens\}
19
19
20
-
Account API tokens are defined at the **Codacy user account level**. Each account API token authorizes access to the same organizations, repositories, and operations as the [roles and permissions of the owner of the account](../organizations/roles-and-permissions-for-organizations.md).
20
+
Account API tokens are defined at the **Codacy user account level**. Each account API token authorizes access to the same organizations, repositories, and operations as the [roles and permissions of the owner of the account](../organizations/roles-and-permissions-for-organizations).
21
21
22
22
:::caution
23
-
**If you're using an account API token to upload coverage** be sure to [check the roles](../organizations/roles-and-permissions-for-organizations.md) that your Git provider account must have to authorize uploading coverage to Codacy.
23
+
**If you're using an account API token to upload coverage** be sure to [check the roles](../organizations/roles-and-permissions-for-organizations) that your Git provider account must have to authorize uploading coverage to Codacy.
24
24
25
25
Use a dedicated service account to integrate Codacy with your repositories. This prevents disruption of service if the user who created an account API token loses access to the repositories, which may happen when a user leaves the team or the organization.
26
26
:::
27
27
28
-
You can create new account API tokens programmatically [using the Codacy API](examples/creating-repository-api-tokens-programmatically.md) or using the Codacy UI:
28
+
You can create new account API tokens programmatically [using the Codacy API](examples/creating-repository-api-tokens-programmatically) or using the Codacy UI:
29
29
30
30
1. Open your account, tab **Access management**.
31
31
@@ -47,11 +47,11 @@ When you have tokens created, you can view them inside the tokens table. By hove
47
47
48
48
To delete an account API token, click the trash icon in the Actions column of the table. After this, all applications or services using that token to access the Codacy API will fail to authenticate and will receive the reply `{"error":"not found"}`.
49
49
50
-
## Generating and revoking repository API tokens ||repository-api-tokens"||
50
+
## Generating and revoking repository API tokens \{#repository-api-tokens\}
51
51
52
52
Repository API tokens are defined on **individual repositories**. Each repository API token only authorizes access to the corresponding repository.
53
53
54
-
You can create new repository API tokens programmatically [using the Codacy API](examples/creating-repository-api-tokens-programmatically.md) or using the Codacy UI:
54
+
You can create new repository API tokens programmatically [using the Codacy API](examples/creating-repository-api-tokens-programmatically) or using the Codacy UI:
55
55
56
56
1. Open your repository **Settings**, tab **Integrations**.
57
57
@@ -67,5 +67,5 @@ To revoke a repository API token, click the **X** next to the token. After this,
67
67
## See also
68
68
69
69
-[Adding coverage to your repository](../coverage-reporter/index.md)
Copy file name to clipboardExpand all lines: docusaurus/docs/codacy-api/examples/adding-people-to-codacy-programmatically.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ curl -X POST https://app.codacy.com/api/v3/organizations/<GIT_PROVIDER>/<ORGANIZ
16
16
17
17
Substitute the placeholders with your own values:
18
18
19
-
-**API_KEY:**[Account API token](../api-tokens.md#account-api-tokens) used to authenticate on the Codacy API.
19
+
-**API_KEY:**[Account API token](../api-tokens#account-api-tokens) used to authenticate on the Codacy API.
20
20
-**GIT_PROVIDER:** Git provider hosting of the organization, using one of the values in the table below. For example, `gh` for GitHub Cloud.
21
21
22
22
| Value | Git provider |
@@ -39,7 +39,7 @@ We provide an example Bash script that adds all emails in a text file to Codacy.
39
39
40
40
The example script:
41
41
42
-
1. Defines the [account API token](../api-tokens.md#account-api-tokens) used to authenticate on the Codacy API.
42
+
1. Defines the [account API token](../api-tokens#account-api-tokens) used to authenticate on the Codacy API.
43
43
1. Defines the path and filename of the file containing the email addresses list.
44
44
1. Uses `awk` and `sed` to read the email addresses list from a file.
45
45
1. Calls the endpoint [addPeopleToOrganization](https://app.codacy.com/api/api-docs#addpeopletoorganization) to add a list of email addresses to Codacy.
Copy file name to clipboardExpand all lines: docusaurus/docs/codacy-api/examples/adding-repositories-to-codacy-programmatically.mdx
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ curl -X POST https://app.codacy.com/api/v3/repositories \
21
21
22
22
Substitute the placeholders with your own values:
23
23
24
-
-**API_KEY:**[Account API token](../api-tokens.md#account-api-tokens) used to authenticate on the Codacy API.
24
+
-**API_KEY:**[Account API token](../api-tokens#account-api-tokens) used to authenticate on the Codacy API.
25
25
-**GIT_PROVIDER:** Git provider hosting of the repository, using one of the values in the table below. For example, `gh` for GitHub Cloud.
26
26
27
27
| Value | Git provider |
@@ -44,26 +44,27 @@ Substitute the placeholders with your own values:
44
44
We provide an example Bash script that adds all repositories in a GitHub Cloud organization to Codacy. We suggest that you adapt the script to your specific scenario.
45
45
46
46
:::caution
47
-
Since Codacy automatically analyzes new repositories, adding many repositories in a short time can cause delays in the analysis of other repositories depending on the size of the repositories, the sizing of the infrastructure, and the concurrent analysis configuration. For example:
47
+
Since Codacy automatically analyzes new repositories, adding many repositories in a short time can cause delays in the analysis of other repositories depending on the size of the repositories, the sizing of the infrastructure, and the concurrent analysis configuration. For example:
48
48
49
-
| Repositories added | Expected delay |
50
-
| ------------------ | -------------- |
51
-
| 1 to 10 | Small |
52
-
| 11 to 100 | Considerable |
53
-
| More than 100 | Extreme |
49
+
| Repositories added | Expected delay |
50
+
| ------------------ | -------------- |
51
+
| 1 to 10 | Small |
52
+
| 11 to 100 | Considerable |
53
+
| More than 100 | Extreme |
54
54
55
-
To avoid these delays, add repositories in small batches or space out adding new repositories over time.
55
+
To avoid these delays, add repositories in small batches or space out adding new repositories over time.
56
56
:::
57
57
58
58
The example script:
59
59
60
-
1. Defines a GitHub [personal access token](https://github.com/settings/tokens), the GitHub organization name, and the [account API token](../api-tokens.md#account-api-tokens) used to authenticate on the Codacy API.
60
+
1. Defines a GitHub [personal access token](https://github.com/settings/tokens), the GitHub organization name, and the [account API token](../api-tokens#account-api-tokens) used to authenticate on the Codacy API.
61
61
1. Calls the GitHub API to [obtain the list of all repositories](https://docs.github.com/en/rest/repos/repos#list-organization-repositories) in the defined organization.
62
62
1. Uses [jq](https://github.com/stedolan/jq) to return the value of `full_name` for each repository obtained in the JSON response. The `full_name` already includes the organization and repository names using the format `<organization>/<repository>`.
63
63
1. For each repository, calls the endpoint [<spanclass="skip-vale">addRepository</span>](https://app.codacy.com/api/api-docs#addrepository) to add a new repository specifying `gh` as the Git provider and the value of `full_name` as the full path of the repository.
64
64
1. Checks the HTTP status code obtained in the response and performs basic error handling.
65
65
1. Pauses a few seconds between requests to the Codacy API to avoid rate limiting.
To create new [repository API tokens](../api-tokens.md) for your Codacy repositories programmatically, use the Codacy API endpoint [createRepositoryApiToken](https://app.codacy.com/api/api-docs#createrepositoryapitoken). You can also list all repository API tokens for a repository using the endpoint [listRepositoryApiTokens](https://api.codacy.com/api/api-docs#listrepositoryapitokens).
8
+
To create new [repository API tokens](../api-tokens) for your Codacy repositories programmatically, use the Codacy API endpoint [createRepositoryApiToken](https://app.codacy.com/api/api-docs#createrepositoryapitoken). You can also list all repository API tokens for a repository using the endpoint [listRepositoryApiTokens](https://api.codacy.com/api/api-docs#listrepositoryapitokens).
9
9
10
10
For example, if you're [setting up coverage](../../coverage-reporter/index.md) for all your repositories and prefer not to use a single account API token that grants the same permissions as an administrator, you need to create an individual repository API token for each repository.
11
11
@@ -15,7 +15,7 @@ This example creates a new repository API token for a repository and outputs the
15
15
16
16
The example script:
17
17
18
-
1. Defines the [account API token](../api-tokens.md#account-api-tokens) used to authenticate on the Codacy API, the Git provider, the organization name, and the repository name passed as an argument to the script.
18
+
1. Defines the [account API token](../api-tokens#account-api-tokens) used to authenticate on the Codacy API, the Git provider, the organization name, and the repository name passed as an argument to the script.
19
19
1. Calls the endpoint [createRepositoryApiToken](https://app.codacy.com/api/api-docs#createrepositoryapitoken) to create a new repository API token and uses [jq](https://github.com/stedolan/jq) to obtain only the created token string.
20
20
21
21
```bash
@@ -95,7 +95,7 @@ This example lists all repository API tokens created for a repository.
95
95
96
96
The example script:
97
97
98
-
1. Defines the [account API token](../api-tokens.md#account-api-tokens) used to authenticate on the Codacy API, the Git provider, the organization name, and the repository name passed as an argument to the script.
98
+
1. Defines the [account API token](../api-tokens#account-api-tokens) used to authenticate on the Codacy API, the Git provider, the organization name, and the repository name passed as an argument to the script.
99
99
1. Calls the endpoint [listRepositoryApiTokens](https://api.codacy.com/api/api-docs#listrepositoryapitokens) to list the repository API tokens available on the repository and uses [jq](https://github.com/stedolan/jq) to obtain only the token strings, or exit with a non-zero status if the repository doesn't have any repository API tokens created yet.
Copy file name to clipboardExpand all lines: docusaurus/docs/codacy-api/examples/identifying-commits-without-coverage-data.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ This example checks whether the open pull requests in a repository have received
24
24
25
25
The example script:
26
26
27
-
1. Defines the [account API token](../api-tokens.md#account-api-tokens) used to authenticate on the Codacy API, the Git provider, the organization name, and the repository name passed as an argument to the script.
27
+
1. Defines the [account API token](../api-tokens#account-api-tokens) used to authenticate on the Codacy API, the Git provider, the organization name, and the repository name passed as an argument to the script.
28
28
1. Calls the Codacy API endpoint [listRepositoryPullRequests](https://api.codacy.com/api/api-docs#listrepositorypullrequests) to retrieve the list of open pull requests on the repository.
29
29
1. Uses [jq](https://github.com/stedolan/jq) to select only the numbers that identify the pull requests on the Git provider.
30
30
1. For each pull request, outputs the pull request number and calls the Codacy API endpoint [getPullRequestCoverageReports](https://api.codacy.com/api/api-docs#getpullrequestcoveragereports) to obtain the information about the coverage data received for the head and common ancestor commits of the pull request.
Copy file name to clipboardExpand all lines: docusaurus/docs/codacy-api/examples/obtaining-code-quality-metrics-for-files.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ This example exports the grade, total issues, complexity, coverage, and duplicat
16
16
17
17
The example script:
18
18
19
-
1. Defines the [account API token](../api-tokens.md#account-api-tokens) used to authenticate on the Codacy API.
19
+
1. Defines the [account API token](../api-tokens#account-api-tokens) used to authenticate on the Codacy API.
20
20
1. Calls the endpoint [<spanclass="skip-vale">listFiles</span>](https://app.codacy.com/api/api-docs#listfiles) to retrieve the code quality metrics, filtering the results by files that include `src/router/` in the path.
21
21
1. Uses [jq](https://github.com/stedolan/jq) to select only the necessary data fields and convert the results to the CSV format.
22
22
@@ -45,5 +45,5 @@ Example output:
45
45
46
46
## See also
47
47
48
-
-[Which metrics does Codacy calculate?](../../faq/code-analysis/which-metrics-does-codacy-calculate.md)
49
-
-[Files page](../../repositories/files.md)
48
+
-[Which metrics does Codacy calculate?](../../faq/code-analysis/which-metrics-does-codacy-calculate)
Copy file name to clipboardExpand all lines: docusaurus/docs/codacy-api/examples/obtaining-current-issues-in-repositories.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ This example exports the pattern ID, issue level, file path, and timestamp for a
15
15
16
16
The example script:
17
17
18
-
1. Defines the [account API token](../api-tokens.md#account-api-tokens) used to authenticate on the Codacy API.
18
+
1. Defines the [account API token](../api-tokens#account-api-tokens) used to authenticate on the Codacy API.
19
19
1. Calls the endpoint [searchRepositoryIssues](https://app.codacy.com/api/api-docs#searchrepositoryissues) to retrieve information about the issues, filtering the results by security issues with the relevant severity levels.
20
20
1. Uses [jq](https://github.com/stedolan/jq) to select only the necessary data fields and convert the results to the CSV format.
21
21
@@ -45,5 +45,5 @@ Example output:
45
45
46
46
## See also
47
47
48
-
-[Which metrics does Codacy calculate?](../../faq/code-analysis/which-metrics-does-codacy-calculate.md)
49
-
-[Issues page](../../repositories/issues.md)
48
+
-[Which metrics does Codacy calculate?](../../faq/code-analysis/which-metrics-does-codacy-calculate)
Copy file name to clipboardExpand all lines: docusaurus/docs/codacy-api/examples/triggering-dast-scans.mdx
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Thanks to the new app scanning capabilities available on the Security and risk m
8
8
:::caution
9
9
**App scanning is a business feature.** If you are a Codacy Pro customer, contact our customer success team to access a short trial.
10
10
11
-
**Check your [permissions](../../organizations/roles-and-permissions-for-organizations.md).** Only git provider admins and organization managers will be able to create new targets and trigger scans (in app and via the API).
11
+
**Check your [permissions](../../organizations/roles-and-permissions-for-organizations).** Only git provider admins and organization managers will be able to create new targets and trigger scans (in app and via the API).
12
12
:::
13
13
14
14
@@ -52,12 +52,12 @@ Replace the placeholders with your own values:
52
52
53
53
| Field | Required | Description |
54
54
|-------|----------|-------------|
55
-
|**API_KEY**| true |[Account API token](../api-tokens.md#account-api-tokens) used to authenticate on the Codacy API |
55
+
|**API_KEY**| true |[Account API token](../api-tokens#account-api-tokens) used to authenticate on the Codacy API |
56
56
|**GIT_PROVIDER**| true | Git provider hosting of the organization, using one of the values in the table below. <br/>**Options:**`gh` (GitHub Cloud), `ghe`(GitHub Enterprise), `gl` (Gitlab Cloud), `gle` (Gitlab Enterprise), `bb` (Bitbucket Cloud), `bbe` (Bitbucket Server) |
57
57
|**ORGANIZATION**| true | Name of the organization on the Git provider. You must have admin permissions over the organization on the Git provider.<br/>For example, `codacy`|
58
58
|**TARGET_URL**| true | URL of the Web app or API that will be scanned. <br/>Must start with `http://` or `https://`<br/>For example, `https://api.codacy.com/v1`|
59
59
|**TARGET_TYPE**| false | Type of target to be scanned <br/> **Options:**`webapp` (default), `openapi` or `graphql`|
60
-
|**API_DEFINITION_URL**| false * | The URL to a publicly accessible OpenAPI specification.<br/>***Required for OpenAPI targets**|
60
+
|**API_DEFINITION_URL**| false * | The URL to a publicly accessible OpenAPI specification.<br/>***Required for OpenAPI targets**|
61
61
|**HEADER_NAME**| false | Name of the authentication header. <br/>For example, `Authentication`|
62
62
|**HEADER_VALUE**| false | Value of the authentication header. <br/>For example, a token or API key|
63
63
@@ -79,12 +79,12 @@ curl -X POST https://app.codacy.com/api/v3/organizations/{GIT_PROVIDER}/{ORGANIZ
79
79
80
80
Replace the placeholders with your own values:
81
81
82
-
-**API_KEY:**[Account API token](../api-tokens.md#account-api-tokens) used to authenticate on the Codacy API.
82
+
-**API_KEY:**[Account API token](../api-tokens#account-api-tokens) used to authenticate on the Codacy API.
83
83
-**GIT_PROVIDER:** Git provider hosting of the organization (check the table on the example above). For example, `gh` for GitHub Cloud.
84
84
-**ORGANIZATION:** Name of the organization on the Git provider. For example, `codacy`. You must have admin permissions over the organization on the Git provider.
85
-
-**DAST_TARGET_ID:** Identifier of a DAST target to analyze (obtained in the [previous section](./triggering-dast-scans.md#creating-targets). For example, `457`. You must have admin permissions over the organization on the Git provider.
85
+
-**DAST_TARGET_ID:** Identifier of a DAST target to analyze (obtained in the [previous section](./triggering-dast-scans#creating-targets). For example, `457`. You must have admin permissions over the organization on the Git provider.
86
86
87
-
Scans occur asynchronously. To monitor an ongoing scan you can use the [target management page in Codacy](../../organizations/managing-security-and-risk.md#app-scanning). Once completed, you can access all scan results by navigating to the **Security dashboard**, selecting the **Findings tab** and filtering by **Scan types > DAST/App scanning**, or by clicking on a configured target to expand all of that target's results.
87
+
Scans occur asynchronously. To monitor an ongoing scan you can use the [target management page in Codacy](../../organizations/managing-security-and-risk#app-scanning). Once completed, you can access all scan results by navigating to the **Security dashboard**, selecting the **Findings tab** and filtering by **Scan types > DAST/App scanning**, or by clicking on a configured target to expand all of that target's results.
88
88
Additionaly, you can use the `SearchSRMItems` endpoint to filter findings by their DAST target URL with the following request:
89
89
```bash
90
90
curl -X POST https://app.codacy.com/api/v3/organizations/gh/codacy/security/items/search \
0 commit comments