Get annotations for the given commit ID, filtered by any query parameters given.
string
Requiredstring
Requiredstring
Requiredstring
string
string
string
string
The requested annotations.
1
2
3
curl --request GET \
--url 'http://{baseurl}/rest/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/annotations' \
--header 'Accept: application/json;charset=UTF-8'
Retrieve all reports for the given commit.
string
Requiredstring
Requiredstring
Requirednumber
number
A page of reports
1
2
3
curl --request GET \
--url 'http://{baseurl}/rest/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports' \
--header 'Accept: application/json;charset=UTF-8'
Retrieve the specified report.
string
Requiredstring
Requiredstring
Requiredstring
RequiredThe specified report.
1
2
3
curl --request GET \
--url 'http://{baseurl}/rest/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}' \
--header 'Accept: application/json;charset=UTF-8'
Create a new insight report, or replace the existing one if a report already exists for the given repository, commit, and report key. A request to replace an existing report will be rejected if the authenticated user was not the creator of the specified report.
The report key should be a unique string chosen by the reporter and should be unique enough not to potentially clash with report keys from other reporters. We recommend using reverse DNS namespacing or a similar standard to ensure that collision is avoided.
Parameter | Description | Required? | Restrictions | Type |
---|---|---|---|---|
title | A short string representing the name of the report | Yes | Max length: 450 characters (but we recommend that it is shorter so that the display is nicer) | String |
details | A string to describe the purpose of the report. This string may contain escaped newlines and if it does it will display the content accordingly. | No | Max length: 2000 characters | String |
result | Indicates whether the report is in a passed or failed state | No | One of: PASS, FAIL | String |
data | An array of data fields (described below) to display information on the report | No | Maximum 6 data fields | Array |
reporter | A string to describe the tool or company who created the report | No | Max length: 450 characters | String |
link | A URL linking to the results of the report in an external tool. | No | Must be a valid http or https URL | String |
logoUrl | A URL to the report logo. If none is provided, the default insights logo will be used. | No | Must be a valid http or https URL | String |
Parameter | Description | Type |
---|---|---|
title | A string describing what this data field represents | String |
type | The type of data contained in the value field. If not provided, then the value will be detected as a boolean, number or string. One of: BOOLEAN, DATE, DURATION, LINK, NUMBER, PERCENTAGE, TEXT | String |
value | A value based on the type provided. Either a raw value (string, number or boolean) or a map. See below. |
Type Field | Value Field Type | Value Field Display |
---|---|---|
None/Omitted | Number, String or Boolean (not an array or object) | Plain text |
BOOLEAN | Boolean | The value will be read as a JSON boolean and displayed as 'Yes' or 'No'. |
DATE | Number | The value will be read as a JSON number in the form of a Unix timestamp (milliseconds) and will be displayed as a relative date if the date is less than one week ago, otherwise it will be displayed as an absolute date. |
DURATION | Number | The value will be read as a JSON number in milliseconds and will be displayed in a human readable duration format. |
LINK | Object: {"linktext": "Link text here", "href": "https://link.to.annotation/in/external/tool"} | The value will be read as a JSON object containing the fields "linktext" and "href" and will be displayed as a clickable link on the report. |
NUMBER | Number | The value will be read as a JSON number and large numbers will be displayed in a human readable format (e.g. 14.3k). |
PERCENTAGE | Number (between 0 and 100) | The value will be read as a JSON number between 0 and 100 and will be displayed with a percentage sign. |
TEXT | String | The value will be read as a JSON string and will be displayed as-is |
string
Requiredstring
Requiredstring
Requiredstring
RequiredThe request object containing the details of the report to create (see example).
string
integer
array<RestInsightReportData>
Requiredstring
string
string
string
string
string
RequiredThe created report.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
curl --request PUT \
--url 'http://{baseurl}/rest/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}' \
--header 'Accept: application/json;charset=UTF-8' \
--header 'Content-Type: application/json' \
--data '{
"coverageProviderKey": "<string>",
"createdDate": 1630041546433,
"data": [
{
"title": "data.title",
"type": "NUMBER",
"value": {}
}
],
"details": "This is the details of the report, it can be a longer string describing the report.",
"link": "http://insight.example.com",
"logoUrl": "http://insight.example.com/logo",
"reporter": "Reporter/tool that produced this report",
"result": "PASS",
"title": "report.title"
}'
Delete a report for the given commit. Also deletes any annotations associated with this report.
string
Requiredstring
Requiredstring
Requiredstring
RequiredThe report and associated annotations were successfully deleted.
1
2
curl --request DELETE \
--url 'http://{baseurl}/rest/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}'
Retrieve the specified report's annotations.
string
Requiredstring
Requiredstring
Requiredstring
RequiredThe specified annotations.
1
2
3
curl --request GET \
--url 'http://{baseurl}/rest/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations' \
--header 'Accept: application/json;charset=UTF-8'
Add annotations to the given report. The request should be a JSON object mapping the string "annotations" to an array of maps containing the annotation data, as described below. See also the example request.
A few things to note:- Annotations are an extension of a report, so a report must first exist in order to post annotations. Annotations are posted separately from the report, and can be posted in bulk using this endpoint.
Parameter | Description | Required? | Restrictions | Type |
---|---|---|---|---|
path | The path of the file on which this annotation should be placed. This is the path of the filerelative to the git repository. If no path is provided, then it will appear in the overview modalon all pull requests where the tip of the branch is the given commit, regardless of which files weremodified. | No | String | |
line | The line number that the annotation should belong to. If no line number is provided, then it willdefault to 0 and in a pull request it will appear at the top of the file specified by the path field. | No | Non-negative integer | Integer |
message | The message to display to users | Yes | The maximum length accepted is 2000 characters, however the user interface may truncate this valuefor display purposes. We recommend that the message is short and succinct, with further detailsavailable to the user if needed on the page linked to by the the annotation link. | String |
severity | The severity of the annotation | Yes | One of: LOW, MEDIUM, HIGH | String |
link | An http or https URL representing the location of the annotation in the external tool | No | String | |
type | The type of annotation posted | No | One of: VULNERABILITY, CODE_SMELL, BUG | String |
externalId | If the caller requires a link to get or modify this annotation, then an ID must be provided. It isnot used or required by Bitbucket, but only by the annotation creator for updating or deleting thisspecific annotation. | No | A string value shorter than 450 characters | String |
string
Requiredstring
Requiredstring
Requiredstring
RequiredThe annotations to add.
array<RestSingleAddInsightAnnotationRequest>
An empty response indicating that the request succeeded.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
curl --request POST \
--url 'http://{baseurl}/rest/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations' \
--header 'Content-Type: application/json' \
--data '{
"annotations": [
{
"externalId": "message-1",
"line": 4,
"link": "https://link.to.tool/that/produced/annotation/message-1",
"message": "This is a bug here because reasons",
"path": "path/to/file/in/repo",
"severity": "MEDIUM",
"type": "CODE_SMELL"
}
]
}'
Delete annotations for a given report that match the given external IDs, or all annotations if no external IDs are provided.
string
Requiredstring
Requiredstring
Requiredstring
Requiredstring
The annotations were successfully deleted.
1
2
curl --request DELETE \
--url 'http://{baseurl}/rest/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations'
Create an annotation with the given external ID, or replace it if it already exists. A request to replace an existing annotation will be rejected if the authenticated user was not the creator of the specified report.
string
Requiredstring
Requiredstring
Requiredstring
Requiredstring
RequiredThe new annotation that is to replace the existing one.
string
integer
string
string
Requiredstring
string
Requiredstring
No content, indicating that the request succeeded.
1
2
3
4
5
6
7
8
9
10
11
12
curl --request PUT \
--url 'http://{baseurl}/rest/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations/{externalId}' \
--header 'Content-Type: application/json' \
--data '{
"externalId": "message-1",
"line": 4,
"link": "https://link.to.tool/that/produced/annotation/message-1",
"message": "This is a bug here because reasons",
"path": "path/to/file/in/repo",
"severity": "MEDIUM",
"type": "CODE_SMELL"
}'
Produces a list of the build statistics for multiple commits. Commits without any builds associated with them will not be returned.
For example if the commit e00cf62997a027bbf785614a93e2e55bb331d268
does not have any build statuses associated with it, it will not be present in the response.
full SHA1 of each commit
array<string>
The number of successful/failed/in-progress/cancelled/unknown builds for each commit (with the caveat that the commits without any builds associated with them will not be present in the response)
RestMultipleBuildStats
1
2
3
4
5
6
7
curl --request POST \
--url 'http://{baseurl}/rest/build-status/latest/commits/stats' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '[
"db0dd118fa6ccdf1d593fef00df839dd27702df7"
]'
Gets statistics regarding the builds associated with a commit
string
Requiredboolean
The number of successful/failed/in-progress/cancelled/unknown builds for the commit
1
2
3
curl --request GET \
--url 'http://{baseurl}/rest/build-status/latest/commits/stats/{commitId}' \
--header 'Accept: application/json'
1
2
3
4
5
6
7
{
"cancelled": 2154,
"failed": 2154,
"inProgress": 2154,
"successful": 2154,
"unknown": 2154
}
Create a required build merge check for the given repository.
The authenticated user must have REPO_ADMIN permission for the target repository to register a required build merge check.
The contents of the required build merge check request are:
These fields are required:
These fields are optional:
string
Requiredstring
RequiredThe request specifying the required build parent keys, ref matcher and exemption matcher
array<string>
RequiredRestRefMatcher
object
RequiredA response containing the newly created required build merge check.
1
2
3
curl --request POST \
--url 'http://{baseurl}/rest/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition' \
--header 'Accept: application/json;charset=UTF-8'
Update the required builds merge check for the given ID.
The authenticated user must have REPO_ADMIN permission for the target repository to update a required build merge check.
The contents of the required build merge check request are:
These fields are required:
These fields are optional:
string
Requiredinteger
Requiredstring
RequiredThe request specifying the required build parent keys, ref matcher and exemption matcher
array<string>
RequiredRestRefMatcher
object
RequiredThe details needed to update a required build merge check.
1
2
3
curl --request PUT \
--url 'http://{baseurl}/rest/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id}' \
--header 'Accept: application/json;charset=UTF-8'
Deletes a required build existing merge check, given it's ID.
The authenticated user must have REPO_ADMIN permission for the target repository to delete a required build merge check.
string
Requiredinteger
Requiredstring
RequiredAn empty response indicating the merge check was successfully deleted, or was never present.
1
2
curl --request DELETE \
--url 'http://{baseurl}/rest/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id}'
Returns a page of required build merge checks that have been configured for this repository.
The authenticated user must have REPO_READ permission for the target repository to request a page of required build merge checks.
string
Requiredstring
Requirednumber
number
The required build merge checks associated with the provided repository.
1
2
3
curl --request GET \
--url 'http://{baseurl}/rest/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/conditions' \
--header 'Accept: application/json;charset=UTF-8'
Get a specific build status.
The authenticated user must have REPO_READ permission for the provided repository.The request can also be made with anonymous 2-legged OAuth.
Since 7.14
string
Requiredstring
Requiredstring
Requiredstring
RequiredThe build status associated with the provided commit and key
1
2
3
curl --request GET \
--url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds?key={key}' \
--header 'Accept: application/json;charset=UTF-8'
Store a build status.
The authenticated user must have REPO_READ permission for the repository that this build status is for. The request can also be made with anonymous 2-legged OAuth.
string
Requiredstring
Requiredstring
RequiredThe contents of the build status request are: These fields are required:
These fields are optional:
string
string
integer
string
Requiredinteger
string
string
string
string
Requiredobject
The build status was posted
1
2
curl --request POST \
--url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds'
Delete a specific build status.
The authenticated user must have REPO_ADMIN permission for the provided repository.
string
Requiredstring
Requiredstring
Requiredstring
RequiredThe build status associated with the provided commit and key has been deleted
1
2
curl --request DELETE \
--url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds?key={key}'
Get the deployment matching the specified Repository, key, environmentKey and deploymentSequenceNumber.
The user must have REPO_READ.
string
Requiredstring
Requiredstring
Requiredstring
string
string
The deployment
1
2
3
curl --request GET \
--url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments' \
--header 'Accept: application/json;charset=UTF-8'
Create or update a deployment.
The authenticated user must have REPO_READ permission for the repository.
string
Requiredstring
Requiredstring
Requiredthe details of the deployment to create, as detailed by the request body
integer
Requiredstring
Requiredstring
RequiredRestDeploymentEnvironment
Requiredstring
Requiredinteger
string
Requiredstring
RequiredThe deployment was created
1
2
3
curl --request POST \
--url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments' \
--header 'Accept: application/json;charset=UTF-8'
Delete the deployment matching the specified Repository, key, environmentKey and deploymentSequenceNumber.
The user must have REPO_ADMIN.
string
Requiredstring
Requiredstring
Requiredstring
string
string
the request has been processed
1
2
curl --request DELETE \
--url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments'
Rate this page: