• Authentication
  • Builds and Deployments
  • Capabilities
  • Dashboard
  • Deprecated
  • Jira Integration
  • Markup
  • Mirroring (Mirror)
  • Mirroring (Upstream)
  • Permission Management
  • Project
  • Pull Requests
  • Repository
  • Security
  • Ssh
  • System Maintenance
  • Other operations
Server
Bitbucket Data Center / / Modules

Builds and Deployments

Postman Collection
OpenAPI
Operations
POST/build-status/latest/commits/statsGET/build-status/latest/commits/stats/{commitId}GET/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/conditionsPUT/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id}DEL/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id}POST/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/conditionGET/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/annotationsGET/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reportsGET/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}PUT/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}DEL/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}GET/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotationsPOST/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotationsDEL/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotationsPUT/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations/{externalId}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/buildsPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/buildsDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/buildsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deploymentsPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deploymentsDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments
POST

Get build status for multiple commits

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.

Request

Request bodyapplication/json

full SHA1 of each commit

array<string>

Responses

The number of successful/failed/in-progress builds for each commit (with the caveat that the commits without any builds associated with them will not be present in the response)

application/json

RestMultipleBuildStats

POST/build-status/latest/commits/stats
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" ]'
GET

Get build status statistics for commit

Gets statistics regarding the builds associated with a commit

Request

Path parameters

commitId

string

Required

Query parameters

includeUnique

boolean

Responses

The number of successful/failed/in-progress builds for the commit

application/json

RestBuildStats
GET/build-status/latest/commits/stats/{commitId}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/build-status/latest/commits/stats/{commitId}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 { "cancelled": 2154, "successful": 2154, "inProgress": 2154, "unknown": 2154, "failed": 2154 }
GET

Get required builds merge checks

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.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

start

number

limit

number

Responses

The required build merge checks associated with the provided repository.

application/json

object
GET/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/conditions
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/conditions' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 { "values": [ { "buildParentKeys": [ "build-key-1", "build-key-2" ], "refMatcher": { "displayId": "main", "id": "refs/heads/main", "type": { "name": "Branch", "id": "ANY_REF" } }, "exemptRefMatcher": { "displayId": "main", "id": "refs/heads/main", "type": { "name": "Branch", "id": "ANY_REF" } }, "id": 15 } ], "size": 1, "nextPageStart": 2154, "isLastPage": true, "start": 2154, "limit": 25 }
PUT

Update a required builds merge check

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:

  • buildParentKeys: A non-empty list of build parent keys that require green builds for this merge check to pass
  • refMatcher.id: The value to match refs against in the target branch
  • refMatcher.type.id: The type of ref matcher, one of: "ANY_REF", "BRANCH", "PATTERN", "MODEL_CATEGORY" or "MODEL_BRANCH"

These fields are optional:

  • exemptRefMatcher.id The value to exempt refs in the source branch from this check
  • exemptRefMatcher.type.id: The type of exempt ref matcher, one of: "ANY_REF", "BRANCH", "PATTERN", "MODEL_CATEGORY" or "MODEL_BRANCH"

Request

Path parameters

projectKey

string

Required
id

integer

Required
repositorySlug

string

Required

Request body*/*

The request specifying the required build parent keys, ref matcher and exemption matcher

buildParentKeys

array<string>

Required
exemptRefMatcher

RestRefMatcher

refMatcher

object

Required

Responses

The details needed to update a required build merge check.

application/json

RestRequiredBuildCondition
PUT/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id}
1 2 3 curl --request PUT \ --url 'http://{baseurl}/rest/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 { "buildParentKeys": [ "build-key-1", "build-key-2" ], "refMatcher": { "displayId": "main", "id": "refs/heads/main", "type": { "name": "Branch", "id": "ANY_REF" } }, "exemptRefMatcher": { "displayId": "main", "id": "refs/heads/main", "type": { "name": "Branch", "id": "ANY_REF" } }, "id": 15 }
DEL

Delete a required builds merge check

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.

Request

Path parameters

projectKey

string

Required
id

integer

Required
repositorySlug

string

Required

Responses

An empty response indicating the merge check was successfully deleted, or was never present.

DEL/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id}'
POST

Create a required builds merge check

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:

  • buildParentKeys: A non-empty list of build parent keys that require green builds for this merge check to pass
  • refMatcher.id: The value to match refs against in the target branch
  • refMatcher.type.id: The type of ref matcher, one of: "ANY_REF", "BRANCH", "PATTERN", "MODEL_CATEGORY" or "MODEL_BRANCH"

These fields are optional:

  • exemptRefMatcher.id The value to exempt refs in the source branch from this check
  • exemptRefMatcher.type.id: The type of exempt ref matcher, one of: "ANY_REF", "BRANCH", "PATTERN", "MODEL_CATEGORY" or "MODEL_BRANCH"

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request body*/*

The request specifying the required build parent keys, ref matcher and exemption matcher

buildParentKeys

array<string>

Required
exemptRefMatcher

RestRefMatcher

refMatcher

object

Required

Responses

A response containing the newly created required build merge check.

application/json

RestRequiredBuildCondition
POST/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition
1 2 3 curl --request POST \ --url 'http://{baseurl}/rest/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 { "buildParentKeys": [ "build-key-1", "build-key-2" ], "refMatcher": { "displayId": "main", "id": "refs/heads/main", "type": { "name": "Branch", "id": "ANY_REF" } }, "exemptRefMatcher": { "displayId": "main", "id": "refs/heads/main", "type": { "name": "Branch", "id": "ANY_REF" } }, "id": 15 }
GET

Get Code Insights annotations for a commit

Get annotations for the given commit ID, filtered by any query parameters given.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

severity

string

path

string

externalId

string

type

string

key

string

Responses

The requested annotations.

application/json

RestInsightAnnotationsResponse
GET/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/annotations
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/annotations' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 { "annotations": [ { "externalId": "external.id", "line": 5, "link": "http://example.com/my/file/analysis?line=5", "reportKey": "report.key", "severity": "HIGH", "message": "This is an annotation message", "type": "BUG", "path": "src/some/structure/file.ext" } ] }
GET

Get all Code Insights reports for a commit

Retrieve all reports for the given commit.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

start

number

limit

number

Responses

A page of reports

application/json

object
GET/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 { "values": [ { "reporter": "Reporter/tool that produced this report", "createdDate": 1630041546433, "data": [ { "title": "data.title", "value": {}, "type": "NUMBER" } ], "title": "report.title", "logoUrl": "http://integration.example.com/logo", "details": "This is the details of the report, it can be a longer string describing the report", "link": "http://integration.example.com", "result": "PASS", "key": "report.key" } ], "size": 1, "nextPageStart": 2154, "isLastPage": true, "start": 2154, "limit": 25 }
GET

Get a Code Insights report

Retrieve the specified report.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required
key

string

Required

Responses

The specified report.

application/json

RestInsightReport
GET/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 { "reporter": "Reporter/tool that produced this report", "createdDate": 1630041546433, "data": [ { "title": "data.title", "value": {}, "type": "NUMBER" } ], "title": "report.title", "logoUrl": "http://integration.example.com/logo", "details": "This is the details of the report, it can be a longer string describing the report", "link": "http://integration.example.com", "result": "PASS", "key": "report.key" }
PUT

Create a Code Insights report

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.

Report parameters

ParameterDescriptionRequired?RestrictionsType
titleA short string representing the name of the reportYesMax 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. NoMax length: 2000 charactersString
resultIndicates whether the report is in a passed or failed stateNoOne of: PASS, FAILString
dataAn array of data fields (described below) to display information on the reportNoMaximum 6 data fieldsArray
reporterA string to describe the tool or company who created the reportNoMax length: 450 charactersString
linkA URL linking to the results of the report in an external tool.NoMust be a valid http or https URLString
logoUrlA URL to the report logo. If none is provided, the default insights logo will be used.NoMust be a valid http or https URLString

Data parameters

The data field on the report is an array with at most 6 data fields (JSON maps) containing information that is to be displayed on the report (see the request example).
ParameterDescriptionType
titleA string describing what this data field representsString
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 FieldValue Field TypeValue Field Display
None/OmittedNumber, String or Boolean (not an array or object)Plain text
BOOLEANBooleanThe value will be read as a JSON boolean and displayed as 'Yes' or 'No'.
DATENumber 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.
DURATIONNumber The value will be read as a JSON number in milliseconds and will be displayed in a human readable duration format.
LINKObject: {"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.
NUMBERNumber The value will be read as a JSON number and large numbers will be displayed in a human readable format (e.g. 14.3k).
PERCENTAGENumber (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.
TEXTStringThe value will be read as a JSON string and will be displayed as-is

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required
key

string

Required

Request bodyapplication/json

The request object containing the details of the report to create (see example).

coverageProviderKey

string

createdDate

integer

data

array<RestInsightReportData>

Required
details

string

link

string

logoUrl

string

reporter

string

result

string

title

string

Required

Responses

The created report.

application/json

RestInsightReport
PUT/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}
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' \ --header 'Content-Type: application/json' \ --data '{ "coverageProviderKey": "<string>", "createdDate": 1630041546433, "data": [ { "title": "data.title", "value": {}, "type": "NUMBER" } ], "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" }'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 { "reporter": "Reporter/tool that produced this report", "createdDate": 1630041546433, "data": [ { "title": "data.title", "value": {}, "type": "NUMBER" } ], "title": "report.title", "logoUrl": "http://integration.example.com/logo", "details": "This is the details of the report, it can be a longer string describing the report", "link": "http://integration.example.com", "result": "PASS", "key": "report.key" }
DEL

Delete a Code Insights report

Delete a report for the given commit. Also deletes any annotations associated with this report.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required
key

string

Required

Responses

The report and associated annotations were successfully deleted.

DEL/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}'
GET

Get Code Insights annotations for a report

Retrieve the specified report's annotations.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required
key

string

Required

Responses

The specified annotations.

application/json

RestInsightAnnotationsResponse
GET/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/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'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 { "annotations": [ { "externalId": "external.id", "line": 5, "link": "http://example.com/my/file/analysis?line=5", "reportKey": "report.key", "severity": "HIGH", "message": "This is an annotation message", "type": "BUG", "path": "src/some/structure/file.ext" } ] }
POST

Add Code Insights annotations

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.

  • Only the annotations that are on lines changed in the unified diff will be displayed. This means it is likely not all annotations posted will be displayed on the pull request It also means that if the user is viewing a side-by-side diff, commit diff or iterative review diff they will not be able to view the annotations.
  • A report cannot have more than 1000 annotations by default, however this property is congurable at an instance level. If the request would result in more than the maximum number of annotations being stored then the entire request is rejected and no new annotations are stored.
  • There is no de-duplication of annotations on Bitbucket so be sure that reruns of builds will first delete the report and annotations before creating them.

Annotation parameters

ParameterDescriptionRequired?RestrictionsType
pathThe 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.NoString
lineThe 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.NoNon-negative integerInteger
messageThe message to display to usersYesThe 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
severityThe severity of the annotationYesOne of: LOW, MEDIUM, HIGHString
linkAn http or https URL representing the location of the annotation in the external toolNoString
typeThe type of annotation postedNoOne of: VULNERABILITY, CODE_SMELL, BUGString
externalIdIf 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.NoA string value shorter than 450 charactersString

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required
key

string

Required

Request bodyapplication/json

The annotations to add.

annotations

array<RestSingleAddInsightAnnotationRequest>

Responses

An empty response indicating that the request succeeded.

POST/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations
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" } ] }'
DEL

Delete Code Insights annotations

Delete annotations for a given report that match the given external IDs, or all annotations if no external IDs are provided.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required
key

string

Required

Query parameters

externalId

string

Responses

The annotations were successfully deleted.

DEL/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations'
PUT

Create or replace a Code Insights annotation

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.

Request

Path parameters

projectKey

string

Required
externalId

string

Required
commitId

string

Required
repositorySlug

string

Required
key

string

Required

Request bodyapplication/json

The new annotation that is to replace the existing one.

externalId

string

line

integer

link

string

message

string

Required
path

string

severity

string

Required
type

string

Responses

No content, indicating that the request succeeded.

PUT/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations/{externalId}
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" }'
GET

Get a specific build status

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

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

key

string

Responses

The build status associated with the provided commit and key

application/json

RestBuildStatus
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 { "createdDate": 1587533099278, "updatedDate": 1587533699278, "testResults": { "successful": 134, "skipped": 5, "failed": 1 }, "url": "https://bamboo.example.com/browse/TEST-REP3", "description": "A description of the build goes here", "buildNumber": "3", "name": "Database Matrix Tests", "key": "TEST-REP3", "parent": "TEST-REP", "state": "CANCELLED", "ref": "refs/heads/master", "duration": 2154 }
POST

Store a build status

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.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Request body*/*

The contents of the build status request are: These fields are required:

  • key: The string referring to this branch plan/job
  • state: The build status state, one of: "SUCCESSFUL", "FAILED", "INPROGRESS"
  • url: URL referring to the build result page in the CI tool.

These fields are optional:

  • buildNumber (optional): A unique identifier for this particular run of a plan<
  • dateAdded (optional): milliseconds since epoch. If not provided current date is used.
  • description (optional): Describes the build result
  • duration (optional): Duration of a completed build in milliseconds.
  • name (optional): A short string that describes the build plan
  • parent (optional): The identifier for the plan or job that ran the branch plan that produced this build status.
  • ref (optional): The fully qualified git reference e.g. refs/heads/master.
  • testResults (optional): A summary of the passed, failed and skipped tests.
buildNumber

string

description

string

duration

integer

key

string

Required
lastUpdated

integer

name

string

parent

string

ref

string

state

string

Required
testResults

object

Responses

The build status was posted

POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds
1 2 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds'
DEL

Delete a specific build status

Delete a specific build status.

The authenticated user must have REPO_ADMIN permission for the provided repository.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

key

string

Responses

The build status associated with the provided commit and key has been deleted

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds'
GET

Get a deployment

Get the deployment matching the specified Repository, key, environmentKey and deploymentSequenceNumber.

The user must have REPO_READ.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

deploymentSequenceNumber

string

key

string

environmentKey

string

Responses

The deployment

application/json

RestDeployment
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 { "deploymentSequenceNumber": 5, "toCommit": { "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" }, "fromCommit": { "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" }, "environment": { "url": "https://foo-bar.production/us-east", "key": "us-east-mirror", "type": "production", "displayName": "US East Mirror" }, "url": "http://example.ci.org/projects/PROJ/deploy/mirror-deploy/100", "description": "Production and mirror environments", "lastUpdated": 1449075920, "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "scope": "REPOSITORY", "project": { "scope": "PROJECT", "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "description": "My repo description", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "project": { "scope": "PROJECT", "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "description": "My repo description", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "key": "PROD-MIR", "state": "PENDING", "displayName": "US East Mirror" }
POST

Create or update a deployment

Create or update a deployment.

The authenticated user must have REPO_READ permission for the repository.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Request body*/*

the details of the deployment to create, as detailed by the request body

deploymentSequenceNumber

integer

Required
description

string

Required
displayName

string

Required
environment

RestDeploymentEnvironment

Required
key

string

Required
lastUpdated

integer

state

string

Required
url

string

Required

Responses

The deployment was created

application/json

RestDeployment
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments
1 2 3 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 { "deploymentSequenceNumber": 5, "toCommit": { "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" }, "fromCommit": { "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" }, "environment": { "url": "https://foo-bar.production/us-east", "key": "us-east-mirror", "type": "production", "displayName": "US East Mirror" }, "url": "http://example.ci.org/projects/PROJ/deploy/mirror-deploy/100", "description": "Production and mirror environments", "lastUpdated": 1449075920, "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "scope": "REPOSITORY", "project": { "scope": "PROJECT", "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "description": "My repo description", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "project": { "scope": "PROJECT", "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "description": "My repo description", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "key": "PROD-MIR", "state": "PENDING", "displayName": "US East Mirror" }
DEL

Delete a deployment

Delete the deployment matching the specified Repository, key, environmentKey and deploymentSequenceNumber.

The user must have REPO_ADMIN.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

deploymentSequenceNumber

string

key

string

environmentKey

string

Responses

the request has been processed

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments'

Rate this page: