All URIs are relative to https://api.bitbucket.org/2.0
Method | HTTP request | Description |
---|---|---|
bulkCreateOrUpdateAnnotations | POST /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations | |
createOrUpdateAnnotation | PUT /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId} | |
createOrUpdateReport | PUT /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId} | |
deleteAnnotation | DELETE /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId} | |
deleteReport | DELETE /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId} | |
getAnnotation | GET /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId} | |
getAnnotationsForReport | GET /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations | |
getReport | GET /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId} | |
getReportsForCommit | GET /repositories/{workspace}/{repo_slug}/commit/{commit}/reports |
List<ReportAnnotation> bulkCreateOrUpdateAnnotations(body, username, repoSlug, commit, reportId)
Bulk upload of annotations. Annotations are individual findings that have been identified as part of a report, for example, a line of code that represents a vulnerability. These annotations can be attached to a specific file and even a specific line in that file, however, that is optional. Annotations are not mandatory and a report can contain up to 1000 annotations. Add the annotations you want to upload as objects in a JSON array and make sure each annotation has the external_id field set to a unique value. If you want to use an existing id from your own system, we recommend prefixing it with your system's name to avoid collisions, for example, mySystem-annotation001. The external id can later be used to identify the report as an alternative to the generated UUID. You can upload up to 100 annotations per POST request. ### Sample cURL request: ``` curl –location 'https://api.bitbucket.org/2.0/repositories/<username>/<reposity-name>/commit/<commit-hash>/reports/mysystem-001/annotations' \ –header 'Content-Type: application/json' \ –data-raw '[ { \"external_id\": \"mysystem-annotation001\", \"title\": \"Security scan report\", \"annotation_type\": \"VULNERABILITY\", \"summary\": \"This line represents a security threat.\", \"severity\": \"HIGH\", \"path\": \"my-service/src/main/java/com/myCompany/mysystem/logic/Main.java\", \"line\": 42 }, { \"external_id\": \"mySystem-annotation002\", \"title\": \"Bug report\", \"annotation_type\": \"BUG\", \"result\": \"FAILED\", \"summary\": \"This line might introduce a bug.\", \"severity\": \"MEDIUM\", \"path\": \"my-service/src/main/java/com/myCompany/mysystem/logic/Helper.java\", \"line\": 13 } ]' ``` ### Possible field values: annotation_type: VULNERABILITY, CODE_SMELL, BUG result: PASSED, FAILED, IGNORED, SKIPPED severity: HIGH, MEDIUM, LOW, CRITICAL Please refer to the Code Insights documentation for more information.
// Import classes:
//import com.rappi.bitbucket.client.invoker.ApiException;
//import com.rappi.bitbucket.client.api.ReportsApi;
ReportsApi apiInstance = new ReportsApi();
List<ReportAnnotation> body = Arrays.asList(new ReportAnnotation()); // List<ReportAnnotation> | The annotations to create or update
String username = "username_example"; // String | The account.
String repoSlug = "repoSlug_example"; // String | The repository.
String commit = "commit_example"; // String | The commit for which to retrieve reports.
String reportId = "reportId_example"; // String | Uuid or external-if of the report for which to get annotations for.
try {
List<ReportAnnotation> result = apiInstance.bulkCreateOrUpdateAnnotations(body, username, repoSlug, commit, reportId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ReportsApi#bulkCreateOrUpdateAnnotations");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
body | List<ReportAnnotation> | The annotations to create or update | |
username | String | The account. | |
repoSlug | String | The repository. | |
commit | String | The commit for which to retrieve reports. | |
reportId | String | Uuid or external-if of the report for which to get annotations for. |
No authorization required
ReportAnnotation createOrUpdateAnnotation(body, username, repoSlug, commit, reportId, annotationId)
Creates or updates an individual annotation for the specified report. Annotations are individual findings that have been identified as part of a report, for example, a line of code that represents a vulnerability. These annotations can be attached to a specific file and even a specific line in that file, however, that is optional. Annotations are not mandatory and a report can contain up to 1000 annotations. Just as reports, annotation needs to be uploaded with a unique ID that can later be used to identify the report as an alternative to the generated UUID. If you want to use an existing id from your own system, we recommend prefixing it with your system's name to avoid collisions, for example, mySystem-annotation001. ### Sample cURL request: ``` curl –request PUT 'https://api.bitbucket.org/2.0/repositories/<username>/<reposity-name>/commit/<commit-hash>/reports/mySystem-001/annotations/mysystem-annotation001' \ –header 'Content-Type: application/json' \ –data-raw '{ \"title\": \"Security scan report\", \"annotation_type\": \"VULNERABILITY\", \"summary\": \"This line represents a security thread.\", \"severity\": \"HIGH\", \"path\": \"my-service/src/main/java/com/myCompany/mysystem/logic/Main.java\", \"line\": 42 }' ``` ### Possible field values: annotation_type: VULNERABILITY, CODE_SMELL, BUG result: PASSED, FAILED, IGNORED, SKIPPED severity: HIGH, MEDIUM, LOW, CRITICAL Please refer to the Code Insights documentation for more information.
// Import classes:
//import com.rappi.bitbucket.client.invoker.ApiException;
//import com.rappi.bitbucket.client.api.ReportsApi;
ReportsApi apiInstance = new ReportsApi();
ReportAnnotation body = new ReportAnnotation(); // ReportAnnotation | The annotation to create or update
String username = "username_example"; // String | The account.
String repoSlug = "repoSlug_example"; // String | The repository.
String commit = "commit_example"; // String | The commit the report belongs to.
String reportId = "reportId_example"; // String | Either the uuid or external-id of the report.
String annotationId = "annotationId_example"; // String | Either the uuid or external-id of the annotation.
try {
ReportAnnotation result = apiInstance.createOrUpdateAnnotation(body, username, repoSlug, commit, reportId, annotationId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ReportsApi#createOrUpdateAnnotation");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
body | ReportAnnotation | The annotation to create or update | |
username | String | The account. | |
repoSlug | String | The repository. | |
commit | String | The commit the report belongs to. | |
reportId | String | Either the uuid or external-id of the report. | |
annotationId | String | Either the uuid or external-id of the annotation. |
No authorization required
Report createOrUpdateReport(body, username, repoSlug, commit, reportId)
Creates or updates a report for the specified commit. To upload a report, make sure to generate an ID that is unique across all reports for that commit. If you want to use an existing id from your own system, we recommend prefixing it with your system's name to avoid collisions, for example, mySystem-001. ### Sample cURL request: ``` curl –request PUT 'https://api.bitbucket.org/2.0/repositories/<username>/<reposity-name>/commit/<commit-hash>/reports/mysystem-001' \ –header 'Content-Type: application/json' \ –data-raw '{ \"title\": \"Security scan report\", \"details\": \"This pull request introduces 10 new dependency vulnerabilities.\", \"report_type\": \"SECURITY\", \"reporter\": \"mySystem\", \"link\": \"http://www.mysystem.com/reports/001\", \"result\": \"FAILED\", \"data\": [ { \"title\": \"Duration (seconds)\", \"type\": \"DURATION\", \"value\": 14 }, { \"title\": \"Safe to merge?\", \"type\": \"BOOLEAN\", \"value\": false } ] }' ``` ### Possible field values: report_type: SECURITY, COVERAGE, TEST, BUG result: PASSED, FAILED, PENDING data.type: BOOLEAN, DATE, DURATION, LINK, NUMBER, PERCENTAGE, TEXT Please refer to the Code Insights documentation for more information.
// Import classes:
//import com.rappi.bitbucket.client.invoker.ApiException;
//import com.rappi.bitbucket.client.api.ReportsApi;
ReportsApi apiInstance = new ReportsApi();
Report body = new Report(); // Report | The report to create or update
String username = "username_example"; // String | The account.
String repoSlug = "repoSlug_example"; // String | The repository.
String commit = "commit_example"; // String | The commit the report belongs to.
String reportId = "reportId_example"; // String | Either the uuid or external-id of the report.
try {
Report result = apiInstance.createOrUpdateReport(body, username, repoSlug, commit, reportId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ReportsApi#createOrUpdateReport");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
body | Report | The report to create or update | |
username | String | The account. | |
repoSlug | String | The repository. | |
commit | String | The commit the report belongs to. | |
reportId | String | Either the uuid or external-id of the report. |
No authorization required
deleteAnnotation(username, repoSlug, commit, reportId, annotationId)
Deletes a single Annotation matching the provided ID.
// Import classes:
//import com.rappi.bitbucket.client.invoker.ApiException;
//import com.rappi.bitbucket.client.api.ReportsApi;
ReportsApi apiInstance = new ReportsApi();
String username = "username_example"; // String | The account.
String repoSlug = "repoSlug_example"; // String | The repository.
String commit = "commit_example"; // String | The commit the annotation belongs to.
String reportId = "reportId_example"; // String | Either the uuid or external-id of the annotation.
String annotationId = "annotationId_example"; // String | Either the uuid or external-id of the annotation.
try {
apiInstance.deleteAnnotation(username, repoSlug, commit, reportId, annotationId);
} catch (ApiException e) {
System.err.println("Exception when calling ReportsApi#deleteAnnotation");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
username | String | The account. | |
repoSlug | String | The repository. | |
commit | String | The commit the annotation belongs to. | |
reportId | String | Either the uuid or external-id of the annotation. | |
annotationId | String | Either the uuid or external-id of the annotation. |
null (empty response body)
No authorization required
deleteReport(username, repoSlug, commit, reportId)
Deletes a single Report matching the provided ID.
// Import classes:
//import com.rappi.bitbucket.client.invoker.ApiException;
//import com.rappi.bitbucket.client.api.ReportsApi;
ReportsApi apiInstance = new ReportsApi();
String username = "username_example"; // String | The account.
String repoSlug = "repoSlug_example"; // String | The repository.
String commit = "commit_example"; // String | The commit the report belongs to.
String reportId = "reportId_example"; // String | Either the uuid or external-id of the report.
try {
apiInstance.deleteReport(username, repoSlug, commit, reportId);
} catch (ApiException e) {
System.err.println("Exception when calling ReportsApi#deleteReport");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
username | String | The account. | |
repoSlug | String | The repository. | |
commit | String | The commit the report belongs to. | |
reportId | String | Either the uuid or external-id of the report. |
null (empty response body)
No authorization required
ReportAnnotation getAnnotation(username, repoSlug, commit, reportId, annotationId)
Returns a single Annotation matching the provided ID.
// Import classes:
//import com.rappi.bitbucket.client.invoker.ApiException;
//import com.rappi.bitbucket.client.api.ReportsApi;
ReportsApi apiInstance = new ReportsApi();
String username = "username_example"; // String | The account.
String repoSlug = "repoSlug_example"; // String | The repository.
String commit = "commit_example"; // String | The commit the report belongs to.
String reportId = "reportId_example"; // String | Either the uuid or external-id of the report.
String annotationId = "annotationId_example"; // String | Either the uuid or external-id of the annotation.
try {
ReportAnnotation result = apiInstance.getAnnotation(username, repoSlug, commit, reportId, annotationId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ReportsApi#getAnnotation");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
username | String | The account. | |
repoSlug | String | The repository. | |
commit | String | The commit the report belongs to. | |
reportId | String | Either the uuid or external-id of the report. | |
annotationId | String | Either the uuid or external-id of the annotation. |
No authorization required
PaginatedAnnotations getAnnotationsForReport(username, repoSlug, commit, reportId)
Returns a paginated list of Annotations for a specified report.
// Import classes:
//import com.rappi.bitbucket.client.invoker.ApiException;
//import com.rappi.bitbucket.client.api.ReportsApi;
ReportsApi apiInstance = new ReportsApi();
String username = "username_example"; // String | The account.
String repoSlug = "repoSlug_example"; // String | The repository.
String commit = "commit_example"; // String | The commit for which to retrieve reports.
String reportId = "reportId_example"; // String | Uuid or external-if of the report for which to get annotations for.
try {
PaginatedAnnotations result = apiInstance.getAnnotationsForReport(username, repoSlug, commit, reportId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ReportsApi#getAnnotationsForReport");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
username | String | The account. | |
repoSlug | String | The repository. | |
commit | String | The commit for which to retrieve reports. | |
reportId | String | Uuid or external-if of the report for which to get annotations for. |
No authorization required
Report getReport(username, repoSlug, commit, reportId)
Returns a single Report matching the provided ID.
// Import classes:
//import com.rappi.bitbucket.client.invoker.ApiException;
//import com.rappi.bitbucket.client.api.ReportsApi;
ReportsApi apiInstance = new ReportsApi();
String username = "username_example"; // String | The account.
String repoSlug = "repoSlug_example"; // String | The repository.
String commit = "commit_example"; // String | The commit the report belongs to.
String reportId = "reportId_example"; // String | Either the uuid or external-id of the report.
try {
Report result = apiInstance.getReport(username, repoSlug, commit, reportId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ReportsApi#getReport");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
username | String | The account. | |
repoSlug | String | The repository. | |
commit | String | The commit the report belongs to. | |
reportId | String | Either the uuid or external-id of the report. |
No authorization required
PaginatedReports getReportsForCommit(username, repoSlug, commit)
Returns a paginated list of Reports linked to this commit.
// Import classes:
//import com.rappi.bitbucket.client.invoker.ApiException;
//import com.rappi.bitbucket.client.api.ReportsApi;
ReportsApi apiInstance = new ReportsApi();
String username = "username_example"; // String | The account.
String repoSlug = "repoSlug_example"; // String | The repository.
String commit = "commit_example"; // String | The commit for which to retrieve reports.
try {
PaginatedReports result = apiInstance.getReportsForCommit(username, repoSlug, commit);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ReportsApi#getReportsForCommit");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
username | String | The account. | |
repoSlug | String | The repository. | |
commit | String | The commit for which to retrieve reports. |
No authorization required