Create or update a report
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
Data field formats
| 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: {"text": "Link text here", "href": "https://link.to.annotation/in/external/tool"} |
The value will be read as a JSON object containing the fields “text” 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 |
Please refer to the Code Insights documentation for more information.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example {workspace UUID}.
The repository.
The commit the report belongs to.
Either the uuid or external-id of the report.
Request Body required
Section titled “ Request Body required ”The report to create or update
object
The UUID that can be used to identify the report.
The title of the report.
A string to describe the purpose of the report.
ID of the report provided by the report creator. It can be used to identify the report as an alternative to it’s generated uuid. It is not used by Bitbucket, but only by the report creator for updating or deleting this specific report. Needs to be unique.
A string to describe the tool or company who created the report.
A URL linking to the results of the report in an external tool.
If enabled, a remote link is created in Jira for the work item associated with the commit the report belongs to.
A URL to the report logo. If none is provided, the default insights logo will be used.
The type of the report.
The state of the report. May be set to PENDING and later updated.
An array of data fields to display information on the report. Maximum 10.
A key-value element that will be displayed along with the report.
object
The type of data contained in the value field. If not provided, then the value will be detected as a boolean, number or string.
A string describing what this data field represents.
The value of the data element.
object
The timestamp when the report was created.
The timestamp when the report was updated.
Responses
Section titled “ Responses ”OK
object
The UUID that can be used to identify the report.
The title of the report.
A string to describe the purpose of the report.
ID of the report provided by the report creator. It can be used to identify the report as an alternative to it’s generated uuid. It is not used by Bitbucket, but only by the report creator for updating or deleting this specific report. Needs to be unique.
A string to describe the tool or company who created the report.
A URL linking to the results of the report in an external tool.
If enabled, a remote link is created in Jira for the work item associated with the commit the report belongs to.
A URL to the report logo. If none is provided, the default insights logo will be used.
The type of the report.
The state of the report. May be set to PENDING and later updated.
An array of data fields to display information on the report. Maximum 10.
A key-value element that will be displayed along with the report.
object
The type of data contained in the value field. If not provided, then the value will be detected as a boolean, number or string.
A string describing what this data field represents.
The value of the data element.
object
The timestamp when the report was created.
The timestamp when the report was updated.
Example
{ "report_type": "SECURITY", "result": "PASSED", "data": [ { "type": "BOOLEAN" } ]}The provided Report object is malformed or incomplete.
Base type for most resource objects. It defines the common type element that identifies an object’s type. It also identifies the element as Swagger’s discriminator.
object
object
Optional structured data that is endpoint-specific.
object
Example generated
{ "type": "example", "error": { "message": "example", "detail": "example", "data": {} }}