This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to:
Because the REST API is based on open standards, you can use any web development language or command line tool capable of generating an HTTP request to access the API. See the developer documentation for a basic usage example.
If you're already working with the Atlassian SDK, the REST API Browser is a great tool for exploring and experimenting with the Bitbucket REST API.
Bitbucket's REST APIs provide access to resources (data entities) via URI paths. To use a REST API, your application will make an HTTP request and parse the response. The Bitbucket REST API uses JSON as its communication format, and the standard HTTP methods like GET, PUT, POST and DELETE. URIs for Bitbucket's REST API resource have the following structure:
http://host:port/context/rest/api-name/api-version/path/to/resource
For example, the following URI would retrieve a page of the latest commits to the jira repository in the JIRA project on https://stash.atlassian.com.
https://stash.atlassian.com/rest/api/1.0/projects/JIRA/repos/jira/commits
See the API descriptions below for a full list of available resources.
Alternatively we also publish a list of resources in WADL format. It is available here.
Bitbucket uses paging to conserve server resources and limit response size for resources that return potentially large
collections of items. A request to a paged API will result in a values
array wrapped in a JSON object
with some paging metadata, like this:
{ "size": 3, "limit": 3, "isLastPage": false, "values": [ { /* result 0 */ }, { /* result 1 */ }, { /* result 2 */ } ], "start": 0, "filter": null, "nextPageStart": 3 }
Clients can use the limit
and start
query parameters to retrieve the desired number of
results.
The limit
parameter indicates how many results to return per page. Most APIs default to returning
25
if the limit is left unspecified. This number can be increased, but note that a resource-specific
hard limit will apply. These hard limits can be configured by server administrators, so it's always best practice to
check the limit
attribute on the response to see what limit has been applied.
The request to get a larger page should look like this:
http://host:port/context/rest/api-name/api-version/path/to/resource?limit={desired size of page}
For example:
https://stash.atlassian.com/rest/api/1.0/projects/JIRA/repos/jira/commits?limit=1000
The start
parameter indicates which item should be used as the first item in the page of results. All
paged responses contain an isLastPage
attribute indicating whether another page of items exists.
Important: If more than one page exists (i.e. the response contains
"isLastPage": false
), the response object will also contain a nextPageStart
attribute
which must be used by the client as the start
parameter on the next request.
Identifiers of adjacent objects in a page may not be contiguous, so the start of the next page is not
necessarily the start of the last page plus the last page's size. A client should always use
nextPageStart
to avoid unexpected results from a paged API.
The request to get a subsequent page should look like this:
http://host:port/context/rest/api-name/api-version/path/to/resource?start={nextPageStart from previous response}
For example:
https://stash.atlassian.com/rest/api/1.0/projects/JIRA/repos/jira/commits?start=25
Any authentication that works against Bitbucket will work against the REST API. The preferred authentication methods are HTTP Basic (when using SSL) and OAuth. Other supported methods include: HTTP Cookies and Trusted Applications.
You can find OAuth code samples in several programming languages at bitbucket.org/atlassian_tutorial/atlassian-oauth-examples.
The log-in page uses cookie-based authentication, so if you are using Bitbucket in a browser you can call REST from JavaScript on the page and rely on the authentication that the browser has established.
If a request fails due to client error, the resource will return an HTTP response code in the 40x range. These can be broadly categorised into:
HTTP Code | Description |
---|---|
400 (Bad Request) |
One or more of the required parameters or attributes:
|
401 (Unauthorized) |
Either:
|
403 (Forbidden) | Actions are usually "forbidden" if they involve breaching the licensed user limit of the server, or degrading the authenticated user's permission level. See the individual resource documentation for more details. |
404 (Not Found) | The entity you are attempting to access, or the project or repository containing it, does not exist. |
405 (Method Not Allowed) | The request HTTP method is not appropriate for the targeted resource. For example an HTTP GET to a resource that only accepts an HTTP POST will result in a 405. |
409 (Conflict) |
The attempted update failed due to some conflict with an existing resource. For example:
|
415 (Unsupported Media Type) |
The request entity has a Content-Type that the server does not support. Almost all of the
Bitbucket REST API accepts application/json format, but check the individual resource
documentation for more details. Additionally, double-check that you are setting the
Content-Type header correctly on your request (e.g. using
-H "Content-Type: application/json" in cURL).
|
For 400 HTTP codes the response will typically contain one or more validation error messages, for example:
{ "errors": [ { "context": "name", "message": "The name should be between 1 and 255 characters.", "exceptionName": null }, { "context": "email", "message": "The email should be a valid email address.", "exceptionName": null } ] }
The context
attribute indicates which parameter or request entity attribute failed validation. Note
that the context
may be null.
For 401, 403, 404 and 409 HTTP codes, the response will contain one or more descriptive error messages:
{ "errors": [ { "context": null, "message": "A detailed error message.", "exceptionName": null } ] }
A 500 (Server Error) HTTP code indicates an incorrect resource url or an unexpected server error. Double-check the URL you are trying to access, then report the issue to your server administrator or Atlassian Support if problems persist.
Bitbucket allows users to manage their own repositories, called personal repositories. These are repositories associated with the user and to which they always have REPO_ADMIN permission.
Accessing personal repositories via REST is achieved through the normal project-centric REST URLs using the user's slug prefixed by tilde as the project key. E.g. to list personal repositories for a user with slug "johnsmith" you would make a GET to:
http://example.com/rest/api/1.0/projects/~johnsmith/repos
In addition to this, Bitbucket allows access to these repositories through an alternate set of user-centric REST URLs beginning with:
http://example.com/rest/api/1.0/users/~{userSlug}/reposE.g. to list the forks of the repository with slug "nodejs" in the personal project of user with slug "johnsmith" using the regular REST URL you would make a GET to:
http://example.com/rest/api/1.0/projects/~johnsmith/repos/nodejs/forksUsing the alternate URL, you would make a GET to:
http://example.com/rest/api/1.0/users/johnsmith/repos/nodejs/forks
Provides REST resources
Update a user's details.
The authenticated user must have the ADMIN permission to call this resource.
Example request representations:
{"name":"jcitizen","displayName":"Jane Citizen","email":"jane@example.com"}
Example response representations:
{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL","directoryName":"Bitbucket Internal Directory","deletable":true,"lastAuthenticationTimestamp":1368145580548,"mutableDetails":true,"mutableGroups":true}
The updated user.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The authenticated user does not have the ADMIN permission or has a lower permission level than the user being deleted.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user does not exist.
Creates a new user from the assembled query parameters.
The default group can be used to control initial permissions for new users, such as granting users the ability to login or providing read access to certain projects or repositories. If the user is not added to the default group, they may not be able to login after their account is created until explicit permissions are configured.
The authenticated user must have the ADMIN permission to call this resource.
parameter | value | description |
---|---|---|
name | the username for the new user | |
password | the password for the new user | |
displayName | the display name for the new user | |
emailAddress | the e-mail address for the new user | |
addToDefaultGroup | Default: true |
|
notify | if present and not |
Example response representations:
The user was successfully created.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The authenticated user is not an administrator.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
Adding the user to the default group would exceed the server's license limit.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
Another user with the same name already exists.
Deletes the specified user, removing them from the system. This also removes any permissions that may have been granted to the user.
A user may not delete themselves, and a user with ADMIN permissions may not delete a user with SYS_ADMINpermissions.
The authenticated user must have the ADMIN permission to call this resource.
parameter | value | description |
---|---|---|
name | the username identifying the user to delete |
Example response representations:
{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL","directoryName":"Bitbucket Internal Directory","deletable":true,"lastAuthenticationTimestamp":1368145580548,"mutableDetails":true,"mutableGroups":true}
The deleted user.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The authenticated user does not have the ADMIN permission.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as the authenticated user has a lower permission level than the user being deleted.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as a user can not delete themselves.
This is a paged API.
Retrieve a page of users.
The authenticated user must have the LICENSED_USER permission to call this resource.
parameter | value | description |
---|---|---|
filter | if specified only users with usernames, display name or email addresses containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL","directoryName":"Bitbucket Internal Directory","deletable":true,"lastAuthenticationTimestamp":1368145580548,"mutableDetails":true,"mutableGroups":true}],"start":0}
A page of users.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not a licensed user.
Update a user's password.
The authenticated user must have the ADMIN permission to call this resource, and may not update the password of a user with greater permissions than themselves.
Example request representations:
{"password":"secret","passwordConfirm":"secret","name":"jcitizen"}
Example response representations:
The user's password was successfully updated.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The authenticated user does not have the ADMIN permission or has a lower permission level than the user being deleted.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user does not exist.
Rename a user.
The authenticated user must have the ADMIN permission to call this resource.
Example request representations:
{"name":"jcitizen","newName":"jcitizen-new"}
Example response representations:
{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL","directoryName":"Bitbucket Internal Directory","deletable":true,"lastAuthenticationTimestamp":1368145580548,"mutableDetails":true,"mutableGroups":true}
The renamed user.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The authenticated user does not have the ADMIN permission or has a lower permission level than the user being deleted.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user does not exist.
Clears any CAPTCHA challenge that may constrain the user with the supplied username when they authenticate. Additionally any counter or metric that contributed towards the user being issued the CAPTCHA challenge (for instance too many consecutive failed logins) will also be reset.
The authenticated user must have the ADMIN permission to call this resource, and may not clear the CAPTCHA of a user with greater permissions than themselves.
parameter | value | description |
---|---|---|
name |
Example response representations:
The CAPTCHA was successfully cleared.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The authenticated user does not have the ADMIN permission.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as the authenticated user has a lower permission level than the group being deleted.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user does not exist.
Deletes the specified group, removing them from the system. This also removes any permissions that may have been granted to the group.
A user may not delete the last group that is granting them administrative permissions, or a group with greater permissions than themselves.
The authenticated user must have the ADMIN permission to call this resource.
parameter | value | description |
---|---|---|
name | the name identifying the group to delete |
Example response representations:
{"name":"group-a","deletable":true}
The deleted group.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The authenticated user does not have the ADMIN permission.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as the authenticated user has a lower permission level than the group being deleted.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified group does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would lower the authenticated user's permission level.
This is a paged API.
Retrieve a page of groups.
The authenticated user must have LICENSED_USER permission or higher to call this resource.
parameter | value | description |
---|---|---|
filter | if specified only group names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"name":"group-a","deletable":true}],"start":0}
A page of groups.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not a licensed user.
Create a new group.
The authenticated user must have ADMIN permission or higher to call this resource.
parameter | value | description |
---|---|---|
name | Name of the group. |
Example response representations:
{"name":"group-a","deletable":true}
The newly created group.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not an administrator.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
A group with this name already exists.
Deprecated since 2.10. Use /rest/users/add-groups instead.
Add a user to a group.
In the request entity, the context attribute is the group and the itemName is the user.
The authenticated user must have the ADMIN permission to call this resource.
Example request representations:
{"context":"group_a","itemName":"user_a"}
Example response representations:
The user was added to the group
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The authenticated user does not have the ADMIN permission.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would exceed the server's licensing limit, or the groups permissions exceed the authenticated user's permission level.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user or group does not exist.
Deprecated since 2.10. Use /rest/users/add-groups instead.
Add a user to a group. This is very similar to groups/add-user
, but with the context and
itemName attributes of the supplied request entity reversed. On the face of it this may appear
redundant, but it facilitates a specific UI component in Stash.
In the request entity, the context attribute is the user and the itemName is the group.
The authenticated user must have the ADMIN permission to call this resource.
Example request representations:
{"context":"user_a","itemName":"group_a"}
Example response representations:
The user was added to the group
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The authenticated user does not have the ADMIN permission.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would exceed the server's licensing limit, or the groups permissions exceed the authenticated user's permission level.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user or group does not exist.
Add multiple users to a group.
The authenticated user must have the ADMIN permission to call this resource.
Example request representations:
{"group":"group","users":["user1","user2"]}
Example response representations:
>All
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The authenticated user does not have the ADMIN permission.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would exceed the server's licensing limit, or the group's permissions exceed the authenticated user's permission level.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified group or users do not exist.
Add a user to one or more groups.
The authenticated user must have the ADMIN permission to call this resource.
Example request representations:
{"user":"user","groups":["group_a","group_b"]}
Example response representations:
The user was added to all the groups
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The authenticated user does not have the ADMIN permission.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would exceed the server's licensing limit, or the groups permissions exceed the authenticated user's permission level.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user or groups do not exist.
Deprecated since 2.10. Use /rest/users/remove-groups instead.
Remove a user from a group.
The authenticated user must have the ADMIN permission to call this resource.
In the request entity, the context attribute is the group and the itemName is the user.
Example request representations:
{"context":"group_a","itemName":"user_a"}
Example response representations:
The user was removed from the group.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The authenticated user does not have the ADMIN permission.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as the group has a higher permission level than the context user.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user or group does not exist.
Remove a user from a group. This is very similar to groups/remove-user
, but with the context
and itemName attributes of the supplied request entity reversed. On the face of it this may appear
redundant, but it facilitates a specific UI component in Stash.
In the request entity, the context attribute is the user and the itemName is the group.
The authenticated user must have the ADMIN permission to call this resource.
Example request representations:
{"context":"user_a","itemName":"group_a"}
Example response representations:
The user was removed from the group.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The authenticated user does not have the ADMIN permission.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as the group has a higher permission level than the context user.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user or group does not exist.
This is a paged API.
Retrieves a list of users that are members of a specified group.
The authenticated user must have the LICENSED_USER permission to call this resource.
parameter | value | description |
---|---|---|
context | the group which should be used to locate members | |
filter | Default: | if specified only users with usernames, display names or email addresses containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL","directoryName":"Bitbucket Internal Directory","deletable":true,"lastAuthenticationTimestamp":1368145580548,"mutableDetails":true,"mutableGroups":true}],"start":0}
A page of users.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not a licensed user.
This is a paged API.
Retrieves a list of users that are not members of a specified group.
The authenticated user must have the LICENSED_USER permission to call this resource.
parameter | value | description |
---|---|---|
context | the group which should be used to locate non-members | |
filter | Default: | if specified only users with usernames, display names or email addresses containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL","directoryName":"Bitbucket Internal Directory","deletable":true,"lastAuthenticationTimestamp":1368145580548,"mutableDetails":true,"mutableGroups":true}],"start":0}
A page of users.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not a licensed user.
This is a paged API.
Retrieves a list of groups the specified user is a member of.
The authenticated user must have the LICENSED_USER permission to call this resource.
parameter | value | description |
---|---|---|
context | the user which should be used to locate groups | |
filter | Default: | if specified only groups with names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"name":"group-a","deletable":true}],"start":0}
A page of groups.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not a licensed user.
This is a paged API.
Retrieves a list of groups the specified user is not a member of.
The authenticated user must have the LICENSED_USER permission to call this resource.
parameter | value | description |
---|---|---|
context | the user which should be used to locate groups | |
filter | Default: | if specified only groups with names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"name":"group-a","deletable":true}],"start":0}
A page of groups.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not a licensed user.
Gets information about the nodes that currently make up the stash cluster.
The authenticated user must have the SYS_ADMIN permission to call this resource.
Example response representations:
{"localNode":{"id":"d4fde8b1-2504-4998-a0ba-14fbe98edd4d","name":"foo","address":{"hostName":"foo","port":5000},"local":true},"nodes":[{"id":"73518909-8e86-445b-8345-fcbf2e0934b6","name":"bar","address":{"hostName":"bar","port":5001},"local":true},{"id":"d4fde8b1-2504-4998-a0ba-14fbe98edd4d","name":"foo","address":{"hostName":"foo","port":5000},"local":true}],"running":true}
Information about the cluster
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to retrieve the cluster information.
A REST endpoint for retrieving or updating the license.
Retrieves details about the current license, as well as the current status of the system with regards to the installed license. The status includes the current number of users applied toward the license limit, as well as any status messages about the license (warnings about expiry or user counts exceeding license limits).
The authenticated user must have ADMIN permission. Unauthenticated users, and non-administrators, are not permitted to access license details.
Example response representations:
{"creationDate":1331038800000,"purchaseDate":1331038800000,"expiryDate":1372493732817,"numberOfDaysBeforeExpiry":0,"maintenanceExpiryDate":1372493732817,"numberOfDaysBeforeMaintenanceExpiry":0,"gracePeriodEndDate":1372493732817,"numberOfDaysBeforeGracePeriodExpiry":0,"maximumNumberOfUsers":12,"unlimitedNumberOfUsers":false,"serverId":"<server ID embedded in license>","supportEntitlementNumber":"<support entitlement number embedded in license>","license":"<encoded license text>","status":{"serverId":"<actual server ID>","currentNumberOfUsers":2}}
The currently-installed license.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the license, or the request is anonymous.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
No license has been installed.
Decodes the provided encoded license and sets it as the active license. If no license was provided, a 400 is returned. If the license cannot be decoded, or cannot be applied, a 409 is returned. Some possible reasons a license may not be applied include:
Warning: It is possible to downgrade the license during update, applying a license with a lower number of permitted users. If the number of currently-licensed users exceeds the limits of the new license, pushing will be disabled until the licensed user count is brought into compliance with the new license.
The authenticated user must have SYS_ADMIN permission. ADMIN users may view the current license details, but they may not update the license.
Example request representations:
{"license":"<encoded license text>"}
Example response representations:
{"creationDate":1331038800000,"purchaseDate":1331038800000,"expiryDate":1372493732817,"numberOfDaysBeforeExpiry":0,"maintenanceExpiryDate":1372493732817,"numberOfDaysBeforeMaintenanceExpiry":0,"gracePeriodEndDate":1372493732817,"numberOfDaysBeforeGracePeriodExpiry":0,"maximumNumberOfUsers":12,"unlimitedNumberOfUsers":false,"serverId":"<server ID embedded in license>","supportEntitlementNumber":"<support entitlement number embedded in license>","license":"<encoded license text>","status":{"serverId":"<actual server ID>","currentNumberOfUsers":2}}
The newly-installed license.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
No encoded license was provided in the JSON body for the POST.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to update the license.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The encoded license could not be decoded, or it is not valid for use on this server. For example, it may be for a different product, or it may have already expired.
Deletes the current mail configuration.
The authenticated user must have the SYS_ADMIN permission to call this resource.
Example response representations:
The mail configuration was successfully deleted.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to delete the mail server configuration.
Retrieves the current mail configuration. The authenticated user must have the SYS_ADMIN permission to call this resource.
Example response representations:
{"hostname":"smtp.example.com","port":465,"protocol":"SMTP","use-start-tls":true,"require-start-tls":false,"username":"user","sender-address":"stash-no-reply@company.com"}
The mail configuration.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to retrieve the mail configuration.
The mail server hasn't been configured
Updates the mail configuration The authenticated user must have the SYS_ADMIN permission to call this resource.
Example request representations:
Example response representations:
{"hostname":"smtp.example.com","port":465,"protocol":"SMTP","use-start-tls":true,"require-start-tls":false,"username":"user","sender-address":"stash-no-reply@company.com"}
The updated mail configuration.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The mail configuration was not updated due to a validation error.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to update the mail configuration.
Clears the server email address.
The authenticated user must have the ADMIN permission to call this resource.
Example response representations:
The server email address was successfully cleared.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to clear the server email address.
Updates the server email address The authenticated user must have the ADMIN permission to call this resource.
Example request representations:
Example response representations:
"stash-no-reply@company.com"
The updated server email address.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The server email address was not updated due to a validation error.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to update the server email address.
Retrieves the server email address
Example response representations:
"stash-no-reply@company.com"
The server email address
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to retrieve the server email address.
The server email address is not set
This is a paged API.
Retrieve a page of users that have been granted at least one global permission.
The authenticated user must have ADMIN permission or higher to call this resource.
parameter | value | description |
---|---|---|
filter | Default: | if specified only user names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"permission":"ADMIN"}],"start":0}
A page of users and their highest global permissions.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not an administrator.
Revoke all global permissions for a user.
The authenticated user must have:
parameter | value | description |
---|---|---|
name | the name of the user |
Example response representations:
All global permissions were revoked from the user.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not an administrator.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would reduce the currently authenticated user's permission level or the currently authenticated user has a lower permission level than the user they are attempting to modify.
Promote or demote the global permission level of a user. Available global permissions are:
The authenticated user must have:
parameter | value | description |
---|---|---|
name | the names of the users | |
permission | the permission to grant |
Example response representations:
The requested permission was granted.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed or the specified permission does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not an administrator or doesn't have the specified permission they are attempting to grant.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would exceed the server's license limits.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would reduce the currently authenticated user's permission level or the currently authenticated user has a lower permission level than the user they are attempting to modify.
Revoke all global permissions for a group.
The authenticated user must have:
parameter | value | description |
---|---|---|
name | the name of the group |
Example response representations:
All global permissions were revoked from the group.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not an administrator.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified group does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would reduce the currently authenticated user's permission level or the currently authenticated user has a lower permission level than the group they are attempting to modify.
This is a paged API.
Retrieve a page of groups that have been granted at least one global permission.
The authenticated user must have ADMIN permission or higher to call this resource.
parameter | value | description |
---|---|---|
filter | Default: | if specified only group names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"group":{"name":"group_a"},"permission":"ADMIN"}],"start":0}
A page of groups and their highest global permissions.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not an administrator.
Promote or demote a user's global permission level. Available global permissions are:
The authenticated user must have:
parameter | value | description |
---|---|---|
permission | the permission to grant | |
name | the names of the groups |
Example response representations:
The specified permission was granted to the specified user.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed or the specified permission does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not an administrator or doesn't have the specified permission they are attempting to grant.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would exceed the server's license limits.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified group does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would reduce the currently authenticated user's permission level or the currently authenticated user has a lower permission level than the group they are attempting to modify.
This is a paged API.
Retrieve a page of users that have no granted global permissions.
The authenticated user must have ADMIN permission or higher to call this resource.
parameter | value | description |
---|---|---|
filter | Default: | if specified only user names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"}],"start":0}
A page of users that have not been granted any global permissions.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not an administrator.
This is a paged API.
Retrieve a page of groups that have no granted global permissions.
The authenticated user must have ADMIN permission or higher to call this resource.
parameter | value | description |
---|---|---|
filter | Default: | if specified only group names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"name":"group-a","deletable":true}],"start":0}
A page of groups that have not been granted any global permissions.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not an administrator.
parameter | value | description |
---|---|---|
scmId | the id of the scm to get strategies for |
This is a paged API.
Retrieve the merge strategies available for this instance.
The user must be authenticated to call this resource.
Example response representations:
{"defaultStrategy":{"description":"Always create a merge commit","enabled":true,"flag":"--no-ff","id":"no-ff","name":"Merge commit"},"strategies":[{"description":"Always create a merge commit","enabled":true,"flag":"--no-ff","id":"no-ff","name":"Merge commit"}],"type":"repository"}
The merge configuration of this instance.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to see the request repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request repository does not exist.
Update the pull request merge strategies for the context repository.
The authenticated user must have ADMIN permission for the context repository to call this resource.
Only the strategies provided will be enabled, only one may be set to default
An explicitly set pull request merge strategy configuration can be deleted by POSTing a document with an empty "mergeConfig" attribute. i.e:
{ "mergeConfig": { } }Upon completion of this request, the effective configuration will be the default configuration.
Example request representations:
{"defaultStrategy":{"id":"no-ff"},"strategies":[{"id":"no-ff"}]}
Example response representations:
{"defaultStrategy":{"description":"Always create a merge commit","enabled":true,"flag":"--no-ff","id":"no-ff","name":"Merge commit"},"strategies":[{"description":"Always create a merge commit","enabled":true,"flag":"--no-ff","id":"no-ff","name":"Merge commit"}],"type":"repository"}
The repository pull request merge strategies for the context repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository pull request merge strategies were not updated due to a validation error.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to administrate the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
Retrieve version information and other application properties.
No authentication is required to call this resource.
Example response representations:
{"version":"2.1.0","buildNumber":"20130123103656677","buildDate":"1358897885952000","displayName":"Example.com Bitbucket"}
The application properties.
This is a paged API.
Retrieve a page of pull requests where the current authenticated user is involved as either a reviewer, author
or a participant. The request may be filtered by pull request state, role or participant status.
parameter | value | description |
---|---|---|
state | (optional, defaults to returning pull requests in any state). If a state is supplied only pull requests in the specified state will be returned. Either OPEN, DECLINED or MERGED. Omit this parameter to return pull request in any state. | |
role | (optional, defaults to returning pull requests for any role). If a role is supplied only pull requests where the authenticated user is a participant in the given role will be returned. Either REVIEWER, AUTHOR or PARTICIPANT. | |
participantStatus | (optional, defaults to returning pull requests with any participant status). A comma separated list of participant status. That is, one or more of UNAPPROVED, NEEDS_WORK, or APPROVED. | |
order | (optional, defaults to NEWEST) the order to return pull requests in, either OLDEST (as in: "oldest first"), NEWEST, PARTICIPANT_STATUS, or CLOSED_DATE. Where CLOSED_DATE is specified and the result set includes pull requests that are not in the closed state, these pull requests will appear first in the result set, followed by most recently closed pull requests. | |
closedSince | (optional, defaults to returning pull requests regardless of closed since date). Permits returning only pull requests with a closed timestamp set more recently that (now - closedSince). Units are in seconds. So for example if closed since 86400 is set only pull requests closed in the previous 24 hours will be returned. |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"id":101,"version":1,"title":"Talking Nerdy","description":"It’s a kludge, but put the tuple from the database in the cache.","state":"OPEN","open":true,"closed":false,"createdDate":1359075920,"updatedDate":1359085920,"fromRef":{"id":"refs/heads/feature-ABC-123","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"toRef":{"id":"refs/heads/master","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"locked":false,"author":{"user":{"name":"tom","emailAddress":"tom@example.com","id":115026,"displayName":"Tom","active":true,"slug":"tom","type":"NORMAL"},"role":"AUTHOR","approved":true,"status":"APPROVED"},"reviewers":[{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"lastReviewedCommit":"7549846524f8aed2bd1c0249993ae1bf9d3c9998","role":"REVIEWER","approved":true,"status":"APPROVED"}],"participants":[{"user":{"name":"dick","emailAddress":"dick@example.com","id":3083181,"displayName":"Dick","active":true,"slug":"dick","type":"NORMAL"},"role":"PARTICIPANT","approved":false,"status":"UNAPPROVED"},{"user":{"name":"harry","emailAddress":"harry@example.com","id":99049120,"displayName":"Harry","active":true,"slug":"harry","type":"NORMAL"},"role":"PARTICIPANT","approved":true,"status":"APPROVED"}],"links":{"self":[{"href":"http://link/to/pullrequest"}]}}],"start":0}
A page of pull requests that match the search criteria.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The current user is not authenticated
This is a paged API.
Retrieves a page of suggestions for pull requests that the currently authenticated user may wish to
raise. Such suggestions are based on ref changes occurring and so contain the ref change that
prompted the suggestion plus the time the change event occurred. Changes will be returned in
descending order based on the time the change that prompted the suggestion occurred.
Note that although the response is a page object, the interface does not support paging, however a limit can be applied to the size of the returned page.
parameter | value | description |
---|---|---|
changesSince | Default: 172800 | restrict pull request suggestions to be based on events that occurred since some time in the past. This is expressed in seconds since "now". So to return suggestions based only on activity within the past 48 hours, pass a value of 172800. |
limit | Default: 3 | restricts the result set to return at most this many suggestions. |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"changeTime":1359075920,"refChange":{"ref":{"id":"refs/heads/master","displayId":"master","type":"BRANCH"},"refId":"refs/heads/master","fromHash":"6053a1eaa1c009dd11092d09a72f3c41af1b59ad","toHash":"d6edcbf924697ab811a867421dab60d954ccad99","type":"UPDATE"},"repository":{"slug":"my-repo","id":1,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}},"public":true,"links":{"clone":[{"href":"ssh://git@<baseURL>/PRJ/my-repo.git","name":"ssh"},{"href":"https://<baseURL>/scm/PRJ/my-repo.git","name":"http"}],"self":[{"href":"http://link/to/repository"}]}},"fromRef":{"id":"refs/heads/mybranch","displayId":"mybranch","type":"BRANCH"},"toRef":{"id":"refs/heads/mybranch","displayId":"mybranch","type":"BRANCH"}}],"start":0}
A page of pull requests that match the search criteria.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The current user is not authenticated
This is a paged API.
Retrieve a page of group names.
The authenticated user must have PROJECT_ADMIN permission or higher to call this resource.
parameter | value | description |
---|---|---|
filter | if specified only group names containing the supplied string will be returned |
Example response representations:
{"size":2,"limit":25,"isLastPage":true,"values":["group_a","group_b"],"start":0}
A page of group names.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not a project administrator.
parameter | value | description |
---|---|---|
hookKey | the complete module key of the hook module |
Retrieve the avatar for the project matching the supplied moduleKey.
parameter | value | description |
---|---|---|
version | optional version used for HTTP caching only - any non-blank version will result in a large max-age Cache-Control header. Note that this does not affect the Last-Modified header. |
Example response representations:
The avatar of the project matching the supplied projectKey.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the project.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified project does not exist.
parameter | value | description |
---|---|---|
levelName | the level to set the logger to. Either TRACE, DEBUG, INFO, WARN or ERROR | |
loggerName | the name of the logger. |
Set the current log level for a given logger.
The authenticated user must have ADMIN permission or higher to call this resource.
Example response representations:
The log level was successfully changed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The log level was invalid.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to set the log level.
parameter | value | description |
---|---|---|
loggerName | the name of the logger. |
Retrieve the current log level for a given logger.
The authenticated user must have ADMIN permission or higher to call this resource.
Example response representations:
{"logLevel":"DEBUG"}
The log level of the logger.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to retrieve the log level.
Retrieve the current log level for the root logger.
The authenticated user must have ADMIN permission or higher to call this resource.
Example response representations:
{"logLevel":"DEBUG"}
The log level of the logger.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to retrieve the log level.
parameter | value | description |
---|---|---|
levelName | the level to set the logger to. Either TRACE, DEBUG, INFO, WARN or ERROR |
Set the current log level for the root logger.
The authenticated user must have ADMIN permission or higher to call this resource.
Example response representations:
The log level was successfully changed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The log level was invalid.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to retrieve the log level.
Preview the generated html for given markdown contents.
Only authenticated users may call this resource.
parameter | value | description |
---|---|---|
urlMode | (Optional) The UrlMode used when building the url. One of: ABSOLUTE, RELATIVE and CONFIGURED By default this is RELATIVE. | |
hardwrap | (Optional) Whether the markup implementation should convert newlines to breaks. By default this is false which reflects the standard markdown specification. | |
htmlEscape | (Optional) true if HTML should be escaped in the input markup, false otherwise. |
Example request representations:
# Hello World!
Example response representations:
{
"html" : "<h1>Hello World!</h1>"
}
The rendered markdown.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The markdown was invalid.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions preview rendered markdown.
This is a paged API.
Retrieve a page of recently accessed repositories for the currently authenticated user.
Repositories are ordered from most recently to least recently accessed.
Only authenticated users may call this resource.
parameter | value | description |
---|---|---|
permission | (optional) if specified, it must be a valid repository permission level name and will limit
the resulting repository list to ones that the requesting user has the specified permission
level to. If not specified, the default |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"slug":"my-repo","id":1,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}},"public":true,"links":{"clone":[{"href":"ssh://git@<baseURL>/PRJ/my-repo.git","name":"ssh"},{"href":"https://<baseURL>/scm/PRJ/my-repo.git","name":"http"}],"self":[{"href":"http://link/to/repository"}]}}],"start":0}
A page of recently accessed repositories.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The permission level is unknown or not related to repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request is unauthenticated.
This is a paged API.
Retrieve a page of projects.
Only projects for which the authenticated user has the PROJECT_VIEW permission will be returned.
parameter | value | description |
---|---|---|
name | ||
permission |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}}],"start":0}
A page of projects.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The permission level is unknown or not related to projects.
Create a new project.
To include a custom avatar for the project, the project definition should contain an additional attribute with
the key avatar
and the value a data URI containing Base64-encoded image data. The URI should be in
the following format:
data:(content type, e.g. image/png);base64,(data)If the data is not Base64-encoded, or if a character set is defined in the URI, or the URI is otherwise invalid, project creation will fail.
The authenticated user must have PROJECT_CREATE permission to call this resource.
Example request representations:
{"key":"PRJ","name":"My Cool Project","description":"The description for my cool project.","avatar":"data:image/png;base64,<base64-encoded-image-data>"}
Example response representations:
{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}}
The newly created project.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The project was not created due to a validation error.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to create a project.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The project key or name is already in use.
Delete the project matching the supplied projectKey.
The authenticated user must have PROJECT_ADMIN permission for the specified project to call this resource.
Example response representations:
The project matching the supplied projectKey was deleted.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to delete the project.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified project does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The project can not be deleted as it contains repositories.
Update the project matching the projectKey supplied in the resource path.
To include a custom avatar for the updated project, the project definition should contain an additional attribute
with the key avatar
and the value a data URI containing Base64-encoded image data. The URI should be
in the following format:
data:(content type, e.g. image/png);base64,(data)
If the data is not Base64-encoded, or if a character set is defined in the URI, or the URI is otherwise invalid,
project creation will fail.
The authenticated user must have PROJECT_ADMIN permission for the specified project to call this resource.
Example request representations:
{"key":"PRJ","name":"My Cool Project","description":"The description for my cool project.","avatar":"data:image/png;base64,<base64-encoded-image-data>"}
Example response representations:
{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}}
The updated project. The project's key was not updated.
{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}}
The updated project. The project's key was updated.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The project was not updated due to a validation error.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to update the project.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified project does not exist.
Retrieve the project matching the supplied projectKey.
The authenticated user must have PROJECT_VIEW permission for the specified project to call this resource.
Example response representations:
{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}}
The project matching the supplied projectKey.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the project.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified project does not exist.
Retrieve the avatar for the project matching the supplied projectKey.
The authenticated user must have PROJECT_VIEW permission for the specified project to call this resource.
parameter | value | description |
---|---|---|
s | Default: 0 | The desired size of the image. The server will return an image as close as possible to the specified size. |
Example response representations:
The avatar of the project matching the supplied projectKey.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the project.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified project does not exist.
Update the avatar for the project matching the supplied projectKey.
This resource accepts POST multipart form data, containing a single image in a form-field named 'avatar'.
There are configurable server limits on both the dimensions (1024x1024 pixels by default) and uploaded file size (1MB by default). Several different image formats are supported, but PNG and JPEG are preferred due to the file size limit.
This resource has Cross-Site Request Forgery (XSRF) protection. To allow the request to
pass the XSRF check the caller needs to send an X-Atlassian-Token
HTTP header with the
value no-check
.
An example curl request to upload an image name 'avatar.png' would be:
curl -X POST -u username:password -H "X-Atlassian-Token: no-check" http://example.com/rest/api/1.0/projects/STASH/avatar.png -F avatar=@avatar.png
The authenticated user must have PROJECT_ADMIN permission for the specified project to call this resource.
Example response representations:
The avatar was uploaded successfully.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to update the project.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified project does not exist.
This is a paged API.
Retrieve a page of users that have been granted at least one permission for the specified project.
The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.
parameter | value | description |
---|---|---|
filter | if specified only group names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"permission":"ADMIN"}],"start":0}
A page of users and their highest permissions for the specified project.
The currently authenticated user is not a project administrator for the specified project.
The specified project does not exist.
Revoke all permissions for the specified project for a user.
The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.
In addition, a user may not revoke their own project permissions if they do not have a higher global permission.
parameter | value | description |
---|---|---|
name | the name of the user |
Example response representations:
All project permissions were revoked from the user for the specified project.
The currently authenticated user is not an administrator of the specified project.
The specified project or group does not exist.
The action was disallowed as it would reduce the currently authenticated user's permission level.
Promote or demote a user's permission level for the specified project.
The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource. In addition, a user may not reduce their own permission level unless they have a global permission that already implies that permission.
parameter | value | description |
---|---|---|
name | the names of the users | |
permission | the permission to grant. See the [permissions documentation](https://confluence.atlassian.com/display/BitbucketServer/Using+project+permissions) for a detailed explanation of what each permission entails. Available project permissions are:
|
Example response representations:
The requested permission was granted.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed or the specified permission does not exist.
The currently authenticated user is not an administrator for the specified project.
The action was disallowed as it would reduce the currently authenticated user's permission level.
The specified project or user does not exist.
This is a paged API.
Retrieve a page of licensed users that have no granted permissions for the specified project.
The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.
parameter | value | description |
---|---|---|
filter | if specified only group names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"name":"group-a","deletable":true}],"start":0}
A page of users that have not been granted any permissions for the specified project.
The currently authenticated user is not a project administrator for the specified project.
The specified project does not exist.
Revoke all permissions for the specified project for a group.
The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.
In addition, a user may not revoke a group's permissions if it will reduce their own permission level.
parameter | value | description |
---|---|---|
name | the name of the group |
Example response representations:
All project permissions were revoked from the group for the specified project.
The currently authenticated user is not an administrator of the specified project.
The specified project or group does not exist.
The action was disallowed as it would reduce the currently authenticated user's permission level.
This is a paged API.
Retrieve a page of groups that have been granted at least one permission for the specified project.
The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.
parameter | value | description |
---|---|---|
filter | if specified only group names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"group":{"name":"group_a"},"permission":"ADMIN"}],"start":0}
A page of groups and their highest permissions for the specified project.
The currently authenticated user is not a project administrator for the specified project.
The specified project does not exist.
Promote or demote a group's permission level for the specified project.
The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource. In addition, a user may not demote a group's permission level if their own permission level would be reduced as a result.
parameter | value | description |
---|---|---|
permission | The permission to grant. See the [permissions documentation](https://confluence.atlassian.com/display/BitbucketServer/Using+project+permissions) for a detailed explanation of what each permission entails. Available project permissions are:
| |
name | the names of the groups |
Example response representations:
The requested permission was granted.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed or the specified permission does not exist.
The currently authenticated user is not an administrator for the specified project.
The action was disallowed as it would reduce the currently authenticated user's permission level.
The specified project or group does not exist.
This is a paged API.
Retrieve a page of groups that have no granted permissions for the specified project.
The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.
parameter | value | description |
---|---|---|
filter | if specified only group names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"name":"group-a","deletable":true}],"start":0}
A page of groups that have not been granted any permissions for the specified project.
The currently authenticated user is not a project administrator for the specified project.
The specified project does not exist.
parameter | value | description |
---|---|---|
permission | the permission to grant Available project permissions are:
|
Check whether the specified permission is the default permission (granted to all users) for a project.
The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.
Example response representations:
{"permitted":true}
A simple entity indicating whether the specified permission is the default permission for this project.
The request was malformed or the specified permission does not exist.
The currently authenticated user is not an administrator of the specified project.
The specified project does not exist.
Grant or revoke a project permission to all users, i.e. set the default permission.
The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.
parameter | value | description |
---|---|---|
allow | true to grant the specified permission to all users, or false to revoke it |
Example response representations:
The requested permission was successfully granted or revoked.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed or the specified permission does not exist.
The currently authenticated user is not an administrator of the specified project.
The specified project does not exist.
parameter | value | description |
---|---|---|
projectKey | the parent project key |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Create a new repository. Requires an existing project in which this repository will be created.
The only parameters which will be used are name and scmId.
The authenticated user must have PROJECT_ADMIN permission for the context project to call this resource.
Example request representations:
{"name":"My repo","scmId":"git","forkable":true}
Example response representations:
{"slug":"my-repo","id":1,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}},"public":true,"links":{"clone":[{"href":"ssh://git@<baseURL>/PRJ/my-repo.git","name":"ssh"},{"href":"https://<baseURL>/scm/PRJ/my-repo.git","name":"http"}],"self":[{"href":"http://link/to/repository"}]}}
The newly created repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository was not created due to a validation error.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to create a repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
A repository with same name already exists.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve repositories from the project corresponding to the supplied projectKey.
The authenticated user must have REPO_READ permission for the specified project to call this resource.
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"slug":"my-repo","id":1,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}},"public":true,"links":{"clone":[{"href":"ssh://git@<baseURL>/PRJ/my-repo.git","name":"ssh"},{"href":"https://<baseURL>/scm/PRJ/my-repo.git","name":"http"}],"self":[{"href":"http://link/to/repository"}]}}],"start":0}
The repositories matching the supplied projectKey.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to see the specified project.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified project does not exist.
parameter | value | description |
---|---|---|
projectKey | the parent project key | |
projectKey | the parent project key | |
repositorySlug | the repository slug |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Schedule the repository matching the supplied projectKey and repositorySlug to
be deleted. If the request repository is not present
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
Example response representations:
{"context":null,"message":"Repository scheduled for deletion.","exceptionName":null}
The repository has been scheduled for deletion.
No repository matching the supplied projectKey and repositorySlug was found.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to delete the repository.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Create a new repository forked from an existing repository.
The JSON body for this {@code POST} is not required to contain any properties. Even the name may be omitted. The following properties will be used, if provided:
The authenticated user must have REPO_READ permission for the specified repository and PROJECT_ADMIN on the target project to call this resource. Note that users always have PROJECT_ADMIN permission on their personal projects.
Example request representations:
{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}
Example response representations:
{"slug":"my-repo","id":2,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"origin":{"slug":"my-repo","id":1,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}},"public":true,"links":{"clone":[{"href":"ssh://git@<baseURL>/PRJ/my-repo.git","name":"ssh"},{"href":"https://<baseURL>/scm/PRJ/my-repo.git","name":"http"}],"self":[{"href":"http://link/to/repository"}]}},"project":{"key":"~JDOE","id":2,"name":"John Doe","type":"PERSONAL","links":{"self":[{"href":"http://link/to/project"}]}},"links":{"clone":[{"href":"https://<baseURL>/scm/JDOE/my-repo.git","name":"http"},{"href":"ssh://git@<baseURL>/JDOE/my-repo.git","name":"ssh"}],"self":[{"href":"http://link/to/repository"}]}}
The newly created fork.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
A validation error prevented the fork from being created. Possible validation errors include: The name or slug for the fork collides with another repository in the target project; an SCM type was specified in the JSON body; a project was specified in the JSON body without a "key" property.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to create a fork.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist, or, if a target project was specified, the target project does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve the repository matching the supplied projectKey and repositorySlug.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
Example response representations:
{"slug":"my-repo","id":1,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}},"public":true,"links":{"clone":[{"href":"ssh://git@<baseURL>/PRJ/my-repo.git","name":"ssh"},{"href":"https://<baseURL>/scm/PRJ/my-repo.git","name":"http"}],"self":[{"href":"http://link/to/repository"}]}}
The repository which matches the supplied projectKey and repositorySlug.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to see the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Update the repository matching the repositorySlug supplied in the resource path.
The repository's slug is derived from its name. If the name changes the slug may also change.
This API can be used to move the repository to a different project by setting the new project in the request, example: {@code {"project":{"key":"NEW_KEY"}}} .
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
Example request representations:
{"name":"My repo","forkable":false,"project":{"key":"PRJ"},"public":true}
Example response representations:
{"slug":"my-repo","id":1,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}},"public":true,"links":{"clone":[{"href":"ssh://git@<baseURL>/PRJ/my-repo.git","name":"ssh"},{"href":"https://<baseURL>/scm/PRJ/my-repo.git","name":"http"}],"self":[{"href":"http://link/to/repository"}]}}
The updated repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository was not updated due to a validation error.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to update a repository
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
A repository with same name as the target already exists
parameter | value | description |
---|---|---|
projectKey | the parent project key |
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve repositories which have been forked from this one. Unlike {@link #getRelatedRepositories(Repository,
PageRequest) related repositories}, this only looks at a given repository's direct forks. If those forks have
themselves been the origin of more forks, such "grandchildren" repositories will not be retrieved.
Only repositories to which the authenticated user has REPO_READ permission will be included, even if other repositories have been forked from this one.
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"slug":"my-repo","id":2,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"origin":{"slug":"my-repo","id":1,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}},"public":true,"links":{"clone":[{"href":"ssh://git@<baseURL>/PRJ/my-repo.git","name":"ssh"},{"href":"https://<baseURL>/scm/PRJ/my-repo.git","name":"http"}],"self":[{"href":"http://link/to/repository"}]}},"project":{"key":"~JDOE","id":2,"name":"John Doe","type":"PERSONAL","links":{"self":[{"href":"http://link/to/project"}]}},"links":{"clone":[{"href":"https://<baseURL>/scm/JDOE/my-repo.git","name":"http"},{"href":"ssh://git@<baseURL>/JDOE/my-repo.git","name":"ssh"}],"self":[{"href":"http://link/to/repository"}]}}],"start":0}
A page of repositories related to the request repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to see the request repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request repository does not exist.
parameter | value | description |
---|---|---|
projectKey | the parent project key |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
If a create or fork operation fails, calling this method will clean up the broken repository and try again. The
repository must be in an INITIALISATION_FAILED state.
The authenticated user must have PROJECT_ADMIN permission for the specified project to call this resource.
Example response representations:
{"slug":"my-repo","id":1,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}},"public":true,"links":{"clone":[{"href":"ssh://git@<baseURL>/PRJ/my-repo.git","name":"ssh"},{"href":"https://<baseURL>/scm/PRJ/my-repo.git","name":"http"}],"self":[{"href":"http://link/to/repository"}]}}
The newly created repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository was not created due to a validation error.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to create a repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
parameter | value | description |
---|---|---|
projectKey | the parent project key |
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve repositories which are related to this one. Related repositories are from the same
{@link Repository#getHierarchyId() hierarchy} as this repository.
Only repositories to which the authenticated user has REPO_READ permission will be included, even if more repositories are part of this repository's hierarchy.
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"slug":"my-repo","id":2,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"origin":{"slug":"my-repo","id":1,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}},"public":true,"links":{"clone":[{"href":"ssh://git@<baseURL>/PRJ/my-repo.git","name":"ssh"},{"href":"https://<baseURL>/scm/PRJ/my-repo.git","name":"http"}],"self":[{"href":"http://link/to/repository"}]}},"project":{"key":"~JDOE","id":2,"name":"John Doe","type":"PERSONAL","links":{"self":[{"href":"http://link/to/project"}]}},"links":{"clone":[{"href":"https://<baseURL>/scm/JDOE/my-repo.git","name":"http"},{"href":"ssh://git@<baseURL>/JDOE/my-repo.git","name":"ssh"}],"self":[{"href":"http://link/to/repository"}]}}],"start":0}
A page of repositories related to the request repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to see the request repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request repository does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Streams an archive of the repository's contents at the requested commit. If no at=
commit is
requested, an archive of the default branch is streamed.
The filename=
query parameter may be used to specify the exact filename to include in the
"Content-Disposition"
header. If an explicit filename is not provided, one will be automatically
generated based on what is being archived. Its format depends on the at=
value:
at=
commit:
<slug>-<default-branch-name>@<commit>.<format>
;
e.g. example-master@43c2f8a0fe8.zipat=sha
: <slug>-<at>.<format>
; e.g.
example-09bcbb00100cfbb5310fb6834a1d5ce6cac253e9.tar.gzat=branchOrTag
: <slug>-<branchOrTag>@<commit>.<format>
;
e.g. example-feature@bbb225f16e1.tar
refs/heads/master
, the short name
(master
) will be included in the filenamerelease/4.6
),
they will be converted to hyphens in the filename (release-4.5
)
Archives may be requested in the following formats by adding the format=
query parameter:
zip
: A zip file using standard compression (Default)tar
: An uncompressed tarballtar.gz
or tgz
: A GZip-compressed tarballpath=
query parameter to specify paths to
include. path=
may be specified multiple times to include multiple paths.
The prefix=
query parameter may be used to define a directory (or multiple directories) where
the archive's contents should be placed. If the prefix does not end with /
, one will be added
automatically. The prefix is always treated as a directory; it is not possible to use it to prepend
characters to the entries in the archive.
Archives of public repositories may be streamed by any authenticated or anonymous user. Streaming archives for non-public repositories requires an authenticated user with at least REPO_READ permission.
parameter | value | description |
---|---|---|
at | the commit to stream an archive of; if not supplied, an archive of the default branch is streamed | |
filename | a filename to include the "Content-Disposition" header | |
format | the format to stream the archive in; must be one of: zip, tar, tar.gz or tgz | |
path | paths to include in the streamed archive; may be repeated to include multiple paths | |
prefix | a prefix to apply to all entries in the streamed archive; if the supplied prefix does not end
with a trailing |
Example response representations:
An archive or the requested commit, in zip, tar or gzipped-tar format.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The requested format
is not supported.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist or does not contain the at
commit.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Creates a branch using the information provided in the {@link RestCreateBranchRequest request}
The authenticated user must have REPO_WRITE permission for the context repository to call this resource.
Example request representations:
{"name":"my-branch","startPoint":"8d351a10fb428c0c1239530256e21cf24f136e73","message":"This is my branch"}
Example response representations:
{"id":"refs/heads/master","displayId":"master","type":"BRANCH","latestCommit":"8d51122def5632836d1cb1026e879069e10a1e13","latestChangeset":"8d51122def5632836d1cb1026e879069e10a1e13","isDefault":true}
The created branch
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to write to the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve the branches matching the supplied filterText param.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
base | base branch or tag to compare each branch to (for the metadata providers that uses that information) | |
details | whether to retrieve plugin-provided metadata about each branch | |
filterText | the text to match on | |
orderBy | ordering of refs either ALPHABETICAL (by name) or MODIFICATION (last updated) |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"id":"refs/heads/master","displayId":"master","type":"BRANCH","latestCommit":"8d51122def5632836d1cb1026e879069e10a1e13","latestChangeset":"8d51122def5632836d1cb1026e879069e10a1e13","isDefault":true}],"start":0}
The branches matching the supplied filterText.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to read the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Get the default branch of the repository.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
Example response representations:
{"id":"refs/heads/master","displayId":"master","type":"BRANCH","latestCommit":"8d51122def5632836d1cb1026e879069e10a1e13","latestChangeset":"8d51122def5632836d1cb1026e879069e10a1e13","isDefault":true}
The configured default branch for the repository.
The repository is empty, and has no default branch.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to read the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist, or its configured default branch does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Update the default branch of a repository.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
Example request representations:
{"id":"refs/heads/master"}
Example response representations:
The operation was successful
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to update the repository
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of content for a file path at a specified revision.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
at | Default: | the commit ID or ref to retrieve the content for. |
type | Default: false | if true only the type will be returned for the file path instead of the contents. |
blame | if present the blame will be returned for the file as well. | |
noContent | if present and used with blame only the blame is retrieved instead of the contents. |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"start":0,"lines":[{"text":"print('hello world')"}]}
A page of contents from a file.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The path or until parameters were not supplied.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist.
parameter | value | description |
---|---|---|
path | Default: | the file path to retrieve content from |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Update the content of path
, on the given repository
and branch
.
This resource accepts PUT multipart form data, containing the file in a form-field named content
.
An example curl request to update 'README.md' would be:
curl -X PUT -u username:password -F content=@README.md -F 'message=Updated using file-edit REST API' -F branch=master -F sourceCommitId=5636641a50b http://example.com/rest/api/latest/projects/PROJECT_1/repos/repo_1/browse/README.md
path
should be modified or createdpath
The file can be updated or created on a new branch. In this case, the sourceBranch
parameter should
be provided to identify the starting point for the new branch and the branch
parameter identifies
the branch to create the new commit on.
Example response representations:
{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0123a","author":{"name":"charlie","emailAddress":"charlie@example.com"},"authorTimestamp":1515624793772,"committer":{"name":"charlie","emailAddress":"charlie@example.com"},"committerTimestamp":1515624793772,"message":"WIP on feature 1","parents":[{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0"}]}
The newly created commit
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The branch or content parameters were not supplied.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user does not have write permission for the given repository
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The file already exists when trying to create a file, or the given content does not modify the file, or the file has changed since the given sourceCommitId
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of content for a file path at a specified revision.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
at | Default: | the commit ID or ref to retrieve the content for. |
type | Default: false | if true only the type will be returned for the file path instead of the contents. |
blame | if present the blame will be returned for the file as well. | |
noContent | if present and used with blame only the blame is retrieved instead of the contents. |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"start":0,"lines":[{"text":"print('hello world')"}]}
A page of contents from a file.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The path or until parameters were not supplied.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of changes made in a specified commit.
Note: The implementation will apply a hard cap ({@code page.max.changes}) and it is not possible to request subsequent content when that cap is exceeded.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
since | the commit to which | |
until | the commit to retrieve changes for |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"contentId":"abcdef0123abcdef4567abcdef8987abcdef6543","fromContentId":"bcdef0123abcdef4567abcdef8987abcdef6543a","path":{"components":["new","path","to","file.txt"],"parent":"new/path/to","name":"file.txt","extension":"txt","toString":"new/path/to/file.txt"},"executable":false,"percentUnchanged":98,"type":"MOVE","nodeType":"FILE","srcPath":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"srcExecutable":false,"links":{"self":[{"href":"http://link/to/restchange"}]}}],"start":0}
A page of changes
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The until parameter was not supplied
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository or the since or until parameters supplied does not exist.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of commits from a given starting commit or "between" two commits. If no explicit commit is
specified, the tip of the repository's default branch is assumed. commits may be identified by branch or tag
name or by ID. A path may be supplied to restrict the returned commits to only those which affect that path.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
followRenames | Default: false | if |
ignoreMissing | Default: false |
|
merges | if present, controls how merge commits should be filtered. Can be either | |
path | an optional path to filter commits by | |
since | the commit ID or ref (exclusively) to retrieve commits after | |
until | the commit ID (SHA1) or ref (inclusively) to retrieve commits before | |
withCounts | Default: false | optionally include the total number of commits and total number of unique authors |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"id":"def0123abcdef4567abcdef8987abcdef6543abc","displayId":"def0123abcd","author":{"name":"charlie","emailAddress":"charlie@example.com"},"authorTimestamp":1515624793772,"committer":{"name":"charlie","emailAddress":"charlie@example.com"},"committerTimestamp":1515624793772,"message":"More work on feature 1","parents":[{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0"}]}],"start":0,"authorCount":1,"totalCount":1}
A page of commits.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
One of the supplied commit IDs or refs was invalid.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist.
parameter | value | description |
---|---|---|
commitId | the commit ID to retrieve |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a single commit identified by its ID>. In general, that ID is a SHA1. From 2.11, ref names
like "refs/heads/master" are no longer accepted by this resource.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
path | an optional path to filter the commit by. If supplied the details returned may not be for the specified commit. Instead, starting from the specified commit, they will be the details for the first commit affecting the specified path. |
Example response representations:
{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0123a","author":{"name":"charlie","emailAddress":"charlie@example.com"},"authorTimestamp":1515624793772,"committer":{"name":"charlie","emailAddress":"charlie@example.com"},"committerTimestamp":1515624793772,"message":"WIP on feature 1","parents":[{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0"}]}
A commit.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The supplied commit ID was invalid.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist.
parameter | value | description |
---|---|---|
commitId | the commit to retrieve changes for |
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of changes made in a specified commit.
Note: The implementation will apply a hard cap ({@code page.max.changes}) and it is not possible to request subsequent content when that cap is exceeded.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
since | the commit to which | |
withComments | Default: true | {@code true} to apply comment counts in the changes (the default); otherwise, {@code false} to stream changes without comment counts |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"contentId":"abcdef0123abcdef4567abcdef8987abcdef6543","fromContentId":"bcdef0123abcdef4567abcdef8987abcdef6543a","path":{"components":["new","path","to","file.txt"],"parent":"new/path/to","name":"file.txt","extension":"txt","toString":"new/path/to/file.txt"},"executable":false,"percentUnchanged":98,"type":"MOVE","nodeType":"FILE","srcPath":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"srcExecutable":false,"links":{"self":[{"href":"http://link/to/restchange"}]}}],"start":0}
A page of changes
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The until parameter was not supplied
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository or the since or until parameters supplied does not exist.
parameter | value | description |
---|---|---|
commitId | the commit to which the comments must be anchored |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Add a new comment.
Comments can be added in a few places by setting different attributes:
General commit comment:
{ "text": "An insightful general comment on a commit." }Reply to a comment:
{ "text": "A measured reply.", "parent": { "id": 1 } }General file comment:
{ "text": "An insightful general comment on a file.", "anchor": { "diffType": "COMMIT", "fromHash": "6df3858eeb9a53a911cd17e66a9174d44ffb02cd", "path": "path/to/file", "srcPath": "path/to/file", "toHash": "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b" } }File line comment:
{ "text": "A pithy comment on a particular line within a file.", "anchor": { "diffType": "COMMIT", "line": 1, "lineType": "CONTEXT", "fileType": "FROM", "fromHash": "6df3858eeb9a53a911cd17e66a9174d44ffb02cd", "path": "path/to/file", "srcPath": "path/to/file", "toHash": "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b" } }Note: general file comments are an experimental feature and may change in the near future!
For file and line comments, 'path' refers to the path of the file to which the comment should be applied and 'srcPath' refers to the path the that file used to have (only required for copies and moves). Also, fromHash and toHash refer to the sinceId / untilId (respectively) used to produce the diff on which the comment was added. Finally diffType refers to the type of diff the comment was added on.
For line comments, 'line' refers to the line in the diff that the comment should apply to. 'lineType' refers to the type of diff hunk, which can be:
The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.
parameter | value | description |
---|---|---|
since | For a merge commit, a parent can be provided to specify which diff the comments should be on. For a commit range, a {@code sinceId} can be provided to specify where the comments should be anchored from. |
Example request representations:
{"text":"An insightful comment.","parent":{"id":1},"anchor":{"line":1,"lineType":"CONTEXT","fileType":"FROM","path":"path/to/file","srcPath":"path/to/file"}}
Example response representations:
{"properties":{"key":"value"},"id":1,"version":1,"text":"A measured reply.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792962,"updatedDate":1515624792962,"comments":[{"properties":{"key":"value"},"id":1,"version":1,"text":"An insightful comment.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}
The newly created comment.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The comment was not created due to a validation error.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the commit, create a comment or watch the commit.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
Unable to find the supplied project, repository, commit or parent comment. The missing entity will be specified in the error details.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieves the commit discussion comments that match the specified search criteria.
It is possible to retrieve commit discussion comments that are anchored to a range of commits by providing the {@code sinceId} that the comments anchored from.
The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.
parameter | value | description |
---|---|---|
path | the path to the file on which comments were made | |
since | For a merge commit, a parent can be provided to specify which diff the comments are on. For a commit range, a {@code sinceId} can be provided to specify where the comments are anchored from. |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"id":101,"version":1,"title":"Talking Nerdy","description":"It’s a kludge, but put the tuple from the database in the cache.","state":"OPEN","open":true,"closed":false,"createdDate":1359075920,"updatedDate":1359085920,"fromRef":{"id":"refs/heads/feature-ABC-123","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"toRef":{"id":"refs/heads/master","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"locked":false,"author":{"user":{"name":"tom","emailAddress":"tom@example.com","id":115026,"displayName":"Tom","active":true,"slug":"tom","type":"NORMAL"},"role":"AUTHOR","approved":true,"status":"APPROVED"},"reviewers":[{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"lastReviewedCommit":"7549846524f8aed2bd1c0249993ae1bf9d3c9998","role":"REVIEWER","approved":true,"status":"APPROVED"}],"participants":[{"user":{"name":"dick","emailAddress":"dick@example.com","id":3083181,"displayName":"Dick","active":true,"slug":"dick","type":"NORMAL"},"role":"PARTICIPANT","approved":false,"status":"UNAPPROVED"},{"user":{"name":"harry","emailAddress":"harry@example.com","id":99049120,"displayName":"Harry","active":true,"slug":"harry","type":"NORMAL"},"role":"PARTICIPANT","approved":true,"status":"APPROVED"}],"links":{"self":[{"href":"http://link/to/pullrequest"}]}}],"start":0}
A page of comments that match the search criteria
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the comment
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
Unable to find the supplied project, repository, or commit. The missing entity will be specified in the error details.
parameter | value | description |
---|---|---|
commitId | the commit to which the comments must be anchored | |
commentId | the ID of the comment to retrieve | |
commitId | the full {@link Commit#getId() ID} of the commit within the repository |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Delete a commit comment. Anyone can delete their own comment. Only users with REPO_ADMIN
and above may delete comments created by other users. Comments which have replies may not be deleted,
regardless of the user's granted permissions.
The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.
parameter | value | description |
---|---|---|
version | Default: -1 | The expected version of the comment. This must match the server's version of the comment or the delete will fail. To determine the current version of the comment, the comment should be fetched from the server prior to the delete. Look for the 'version' attribute in the returned JSON structure. |
Example response representations:
The operation was successful
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to delete the comment.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
Unable to find the supplied project, repository or commit. The missing entity will be specified in the error details.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The comment has replies or the version supplied does not match the comment's current version.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Update the text of a comment. Only the user who created a comment may update it.
Note: the supplied supplied JSON object must contain a version
that must match
the server's version of the comment or the update will fail. To determine the current version of the comment,
the comment should be fetched from the server prior to the update. Look for the 'version' attribute in the
returned JSON structure.
The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.
Example request representations:
{"version":0,"text":"A pithy comment."}
Example response representations:
{"properties":{"key":"value"},"id":1,"version":1,"text":"A measured reply.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792962,"updatedDate":1515624792962,"comments":[{"properties":{"key":"value"},"id":1,"version":1,"text":"An insightful comment.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}
The newly updated comment.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The comment was not updated due to a validation error.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the commit, update the comment or watch the commit.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
Unable to find the supplied project, repository, commit or comment. The missing entity will be specified in the error details.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The comment version supplied does not match the current version.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieves a commit discussion comment.
The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.
Example response representations:
{"properties":{"key":"value"},"id":1,"version":1,"text":"A measured reply.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792962,"updatedDate":1515624792962,"comments":[{"properties":{"key":"value"},"id":1,"version":1,"text":"An insightful comment.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}
The requested comment.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the comment
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
Unable to find the supplied project, repository, commit or comment. The missing entity will be specified in the error details.
parameter | value | description |
---|---|---|
commitId |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve the diff between two provided revisions.
Note: This resource is currently not paged. The server will internally apply a hard cap to the streamed lines, and it is not possible to request subsequent pages if that cap is exceeded. In the event that the cap is reached, the diff will be cut short and one or more {@code truncated} flags will be set to {@code true} on the {@code "segments"}, {@code "hunks"} and {@code "diffs"} properties, as well as the top-level object, in the returned JSON response.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
autoSrcPath | Default: false | {@code true} to automatically try to find the source path when it's not provided, {@code false} otherwise. Requires the {@code path} to be provided. |
contextLines | Default: -1 | the number of context lines to include around added/removed lines in the diff |
since | the base revision to diff from. If omitted the parent revision of the until revision is used | |
srcPath | the source path for the file, if it was copied, moved or renamed | |
whitespace | optional whitespace flag which can be set to {@code ignore-all} | |
withComments | Default: true | {@code true} to embed comments in the diff (the default); otherwise {@code false} to stream the diff without comments |
Example response representations:
{"diffs":[{"source":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"destination":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"hunks":[{"sourceLine":1,"sourceSpan":1,"destinationLine":1,"destinationSpan":2,"segments":[{"type":"REMOVED","lines":[{"destination":1,"source":1,"line":"import sys","truncated":false}],"truncated":false},{"type":"ADDED","lines":[{"destination":1,"source":2,"line":"import re","truncated":false},{"destination":2,"source":3,"line":"import os","truncated":false}],"truncated":false}],"truncated":false}],"truncated":"true","contextLines":"10","fromHash":"a0f224fd7bd5f28ea5a752d41b9c9f6372fc6d9e","toHash":"dc93f22caadcde35daf5cc2cd65d2738c87e31ca","whiteSpace":"SHOW"}],"truncated":"true","contextLines":"10","fromHash":"a0f224fd7bd5f28ea5a752d41b9c9f6372fc6d9e","toHash":"dc93f22caadcde35daf5cc2cd65d2738c87e31ca","whiteSpace":"SHOW"}
A diff between two revisions.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The until parameter was not supplied.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist.
parameter | value | description |
---|---|---|
commitId | ||
path | the path to the file which should be diffed (optional) | |
commitId |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve the diff between two provided revisions.
Note: This resource is currently not paged. The server will internally apply a hard cap to the streamed lines, and it is not possible to request subsequent pages if that cap is exceeded. In the event that the cap is reached, the diff will be cut short and one or more {@code truncated} flags will be set to {@code true} on the {@code "segments"}, {@code "hunks"} and {@code "diffs"} properties, as well as the top-level object, in the returned JSON response.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
autoSrcPath | Default: false | {@code true} to automatically try to find the source path when it's not provided, {@code false} otherwise. Requires the {@code path} to be provided. |
contextLines | Default: -1 | the number of context lines to include around added/removed lines in the diff |
since | the base revision to diff from. If omitted the parent revision of the until revision is used | |
srcPath | the source path for the file, if it was copied, moved or renamed | |
whitespace | optional whitespace flag which can be set to {@code ignore-all} | |
withComments | Default: true | {@code true} to embed comments in the diff (the default); otherwise {@code false} to stream the diff without comments |
Example response representations:
{"diffs":[{"source":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"destination":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"hunks":[{"sourceLine":1,"sourceSpan":1,"destinationLine":1,"destinationSpan":2,"segments":[{"type":"REMOVED","lines":[{"destination":1,"source":1,"line":"import sys","truncated":false}],"truncated":false},{"type":"ADDED","lines":[{"destination":1,"source":2,"line":"import re","truncated":false},{"destination":2,"source":3,"line":"import os","truncated":false}],"truncated":false}],"truncated":false}],"truncated":"true","contextLines":"10","fromHash":"a0f224fd7bd5f28ea5a752d41b9c9f6372fc6d9e","toHash":"dc93f22caadcde35daf5cc2cd65d2738c87e31ca","whiteSpace":"SHOW"}],"truncated":"true","contextLines":"10","fromHash":"a0f224fd7bd5f28ea5a752d41b9c9f6372fc6d9e","toHash":"dc93f22caadcde35daf5cc2cd65d2738c87e31ca","whiteSpace":"SHOW"}
A diff between two revisions.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The until parameter was not supplied.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist.
parameter | value | description |
---|---|---|
commitId | the full {@link Commit#getId() ID} of the commit within the repository |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Removes the authenticated user as a watcher for the specified commit.
The authenticated user must have REPO_READ permission for the repository containing the commit to call this resource.
Example response representations:
The user is no longer watching the commit.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified project, repository or commit does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Adds the authenticated user as a watcher for the specified commit.
The authenticated user must have REPO_READ permission for the repository containing the commit to call this resource.
Example response representations:
The user is now watching the commit.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified project, repository or commit does not exist.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Gets the file changes available in the {@code from} commit but not in the {@code to} commit.
If either the {@code from} or {@code to} commit are not specified, they will be replaced by the default branch of their containing repository.
parameter | value | description |
---|---|---|
from | the source commit (can be a partial/full commit ID or qualified/unqualified ref name) | |
to | the target commit (can be a partial/full commit ID or qualified/unqualified ref name) | |
fromRepo | Default: | an optional parameter specifying the source repository containing the source commit if that commit is not present in the current repository; the repository can be specified by either its ID fromRepo=42 or by its project key plus its repo slug separated by a slash: fromRepo=projectKey/repoSlug |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"contentId":"abcdef0123abcdef4567abcdef8987abcdef6543","fromContentId":"bcdef0123abcdef4567abcdef8987abcdef6543a","path":{"components":["new","path","to","file.txt"],"parent":"new/path/to","name":"file.txt","extension":"txt","toString":"new/path/to/file.txt"},"executable":false,"percentUnchanged":98,"type":"MOVE","nodeType":"FILE","srcPath":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"srcExecutable":false,"links":{"self":[{"href":"http://link/to/restchange"}]}}],"start":0}
A page of changes.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The source or target commit does not exist.
parameter | value | description |
---|---|---|
path | the path to the file to diff (optional) |
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Gets a diff of the changes available in the {@code from} commit but not in the {@code to} commit.
If either the {@code from} or {@code to} commit are not specified, they will be replaced by the default branch of their containing repository.
parameter | value | description |
---|---|---|
from | the source commit (can be a partial/full commit ID or qualified/unqualified ref name) | |
to | the target commit (can be a partial/full commit ID or qualified/unqualified ref name) | |
fromRepo | Default: | an optional parameter specifying the source repository containing the source commit if that commit is not present in the current repository; the repository can be specified by either its ID fromRepo=42 or by its project key plus its repo slug separated by a slash: fromRepo=projectKey/repoSlug |
srcPath | ||
contextLines | Default: -1 | an optional number of context lines to include around each added or removed lines in the diff |
whitespace | an optional whitespace flag which can be set to |
Example response representations:
{"diffs":[{"source":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"destination":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"hunks":[{"sourceLine":1,"sourceSpan":1,"destinationLine":1,"destinationSpan":2,"segments":[{"type":"REMOVED","lines":[{"destination":1,"source":1,"line":"import sys","truncated":false}],"truncated":false},{"type":"ADDED","lines":[{"destination":1,"source":2,"line":"import re","truncated":false},{"destination":2,"source":3,"line":"import os","truncated":false}],"truncated":false}],"truncated":false}],"truncated":"true","contextLines":"10","fromHash":"a0f224fd7bd5f28ea5a752d41b9c9f6372fc6d9e","toHash":"dc93f22caadcde35daf5cc2cd65d2738c87e31ca","whiteSpace":"SHOW"}],"truncated":"true","contextLines":"10","fromHash":"a0f224fd7bd5f28ea5a752d41b9c9f6372fc6d9e","toHash":"dc93f22caadcde35daf5cc2cd65d2738c87e31ca","whiteSpace":"SHOW"}
The diff of the changes.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The source or target commit does not exist.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Gets the commits accessible from the {@code from} commit but not in the {@code to} commit.
If either the {@code from} or {@code to} commit are not specified, they will be replaced by the default branch of their containing repository.
parameter | value | description |
---|---|---|
from | the source commit (can be a partial/full commit ID or qualified/unqualified ref name) | |
to | the target commit (can be a partial/full commit ID or qualified/unqualified ref name) | |
fromRepo | Default: | an optional parameter specifying the source repository containing the source commit if that commit is not present in the current repository; the repository can be specified by either its ID fromRepo=42 or by its project key plus its repo slug separated by a slash: fromRepo=projectKey/repoSlug |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"id":"def0123abcdef4567abcdef8987abcdef6543abc","displayId":"def0123abcd","author":{"name":"charlie","emailAddress":"charlie@example.com"},"authorTimestamp":1515624793772,"committer":{"name":"charlie","emailAddress":"charlie@example.com"},"committerTimestamp":1515624793772,"message":"More work on feature 1","parents":[{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0"}]}],"start":0,"authorCount":1,"totalCount":1}
A page of commits.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The source or target commit does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve the diff for a specified file path between two provided revisions.
Note: This resource is currently not paged. The server will internally apply a hard cap
to the streamed lines, and it is not possible to request subsequent pages if that cap is exceeded. In the event
that the cap is reached, the diff will be cut short and one or more truncated
flags will be set to
true
on the segments, hunks and diffs substructures in the returned JSON response.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
contextLines | Default: -1 | the number of context lines to include around added/removed lines in the diff |
since | the base revision to diff from. If omitted the parent revision of the until revision is used | |
srcPath | the source path for the file, if it was copied, moved or renamed | |
until | the target revision to diff to (required) | |
whitespace | optional whitespace flag which can be set to |
Example response representations:
{"diffs":[{"source":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"destination":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"hunks":[{"sourceLine":1,"sourceSpan":1,"destinationLine":1,"destinationSpan":2,"segments":[{"type":"REMOVED","lines":[{"destination":1,"source":1,"line":"import sys","truncated":false}],"truncated":false},{"type":"ADDED","lines":[{"destination":1,"source":2,"line":"import re","truncated":false},{"destination":2,"source":3,"line":"import os","truncated":false}],"truncated":false}],"truncated":false}],"truncated":"true","contextLines":"10","fromHash":"a0f224fd7bd5f28ea5a752d41b9c9f6372fc6d9e","toHash":"dc93f22caadcde35daf5cc2cd65d2738c87e31ca","whiteSpace":"SHOW"}],"truncated":"true","contextLines":"10","fromHash":"a0f224fd7bd5f28ea5a752d41b9c9f6372fc6d9e","toHash":"dc93f22caadcde35daf5cc2cd65d2738c87e31ca","whiteSpace":"SHOW"}
A diff of a file path.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The path or until parameters were not supplied.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist.
parameter | value | description |
---|---|---|
path | the path to the file which should be diffed (required) |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve the diff for a specified file path between two provided revisions.
Note: This resource is currently not paged. The server will internally apply a hard cap
to the streamed lines, and it is not possible to request subsequent pages if that cap is exceeded. In the event
that the cap is reached, the diff will be cut short and one or more truncated
flags will be set to
true
on the segments, hunks and diffs substructures in the returned JSON response.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
contextLines | Default: -1 | the number of context lines to include around added/removed lines in the diff |
since | the base revision to diff from. If omitted the parent revision of the until revision is used | |
srcPath | the source path for the file, if it was copied, moved or renamed | |
until | the target revision to diff to (required) | |
whitespace | optional whitespace flag which can be set to |
Example response representations:
{"diffs":[{"source":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"destination":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"hunks":[{"sourceLine":1,"sourceSpan":1,"destinationLine":1,"destinationSpan":2,"segments":[{"type":"REMOVED","lines":[{"destination":1,"source":1,"line":"import sys","truncated":false}],"truncated":false},{"type":"ADDED","lines":[{"destination":1,"source":2,"line":"import re","truncated":false},{"destination":2,"source":3,"line":"import os","truncated":false}],"truncated":false}],"truncated":false}],"truncated":"true","contextLines":"10","fromHash":"a0f224fd7bd5f28ea5a752d41b9c9f6372fc6d9e","toHash":"dc93f22caadcde35daf5cc2cd65d2738c87e31ca","whiteSpace":"SHOW"}],"truncated":"true","contextLines":"10","fromHash":"a0f224fd7bd5f28ea5a752d41b9c9f6372fc6d9e","toHash":"dc93f22caadcde35daf5cc2cd65d2738c87e31ca","whiteSpace":"SHOW"}
A diff of a file path.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The path or until parameters were not supplied.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of files from particular directory of a repository. The search is done recursively, so all files
from any sub-directory of the specified directory will be returned.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
at | the commit ID or ref (e.g. a branch or tag) to list the files at. If not specified the default branch will be used instead. |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":["path/to/file.txt"],"start":0}
A page of files.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The path requested is not a directory at the supplied commit.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The path requested does not exist at the supplied commit.
parameter | value | description |
---|---|---|
path | Default: | the directory to list files for. |
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of files from particular directory of a repository. The search is done recursively, so all files
from any sub-directory of the specified directory will be returned.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
at | the commit ID or ref (e.g. a branch or tag) to list the files at. If not specified the default branch will be used instead. |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":["path/to/file.txt"],"start":0}
A page of files.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The path requested is not a directory at the supplied commit.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The path requested does not exist at the supplied commit.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Streams files in the requested path
with the last commit to modify each file. Commit modifications
are traversed starting from the at
commit or, if not specified, from the tip of the default branch.
Unless the repository is public, the authenticated user must have REPO_READ access to call this resource.
parameter | value | description |
---|---|---|
at | the commit to use as the starting point when listing files and calculating modifications |
Example response representations:
{"files":{"pom.xml":{"id":"def0123abcdef4567abcdef8987abcdef6543abc","displayId":"def0123abcd","author":{"name":"charlie","emailAddress":"charlie@example.com"},"authorTimestamp":1515624793772,"committer":{"name":"charlie","emailAddress":"charlie@example.com"},"committerTimestamp":1515624793772,"message":"More work on feature 1","parents":[{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0"}]},"README.md":{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0123a","author":{"name":"charlie","emailAddress":"charlie@example.com"},"authorTimestamp":1515624793772,"committer":{"name":"charlie","emailAddress":"charlie@example.com"},"committerTimestamp":1515624793772,"message":"WIP on feature 1","parents":[{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0"}]}},"latestCommit":{"id":"def0123abcdef4567abcdef8987abcdef6543abc","displayId":"def0123abcd","author":{"name":"charlie","emailAddress":"charlie@example.com"},"authorTimestamp":1515624793772,"committer":{"name":"charlie","emailAddress":"charlie@example.com"},"committerTimestamp":1515624793772,"message":"More work on feature 1","parents":[{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0"}]}}
A map of files to the last commit that modified them, and the latest commit to update the requested path.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
No at
commit was specified. When streaming modifications, an
explicit starting commit must be supplied.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist or does not contain the at
commit,
or the at
commit does not contain the requested path.
parameter | value | description |
---|---|---|
path | the path within the repository whose files should be streamed |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Streams files in the requested path
with the last commit to modify each file. Commit modifications
are traversed starting from the at
commit or, if not specified, from the tip of the default branch.
Unless the repository is public, the authenticated user must have REPO_READ access to call this resource.
parameter | value | description |
---|---|---|
at | the commit to use as the starting point when listing files and calculating modifications |
Example response representations:
{"files":{"pom.xml":{"id":"def0123abcdef4567abcdef8987abcdef6543abc","displayId":"def0123abcd","author":{"name":"charlie","emailAddress":"charlie@example.com"},"authorTimestamp":1515624793772,"committer":{"name":"charlie","emailAddress":"charlie@example.com"},"committerTimestamp":1515624793772,"message":"More work on feature 1","parents":[{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0"}]},"README.md":{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0123a","author":{"name":"charlie","emailAddress":"charlie@example.com"},"authorTimestamp":1515624793772,"committer":{"name":"charlie","emailAddress":"charlie@example.com"},"committerTimestamp":1515624793772,"message":"WIP on feature 1","parents":[{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0"}]}},"latestCommit":{"id":"def0123abcdef4567abcdef8987abcdef6543abc","displayId":"def0123abcd","author":{"name":"charlie","emailAddress":"charlie@example.com"},"authorTimestamp":1515624793772,"committer":{"name":"charlie","emailAddress":"charlie@example.com"},"committerTimestamp":1515624793772,"message":"More work on feature 1","parents":[{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0"}]}}
A map of files to the last commit that modified them, and the latest commit to update the requested path.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
No at
commit was specified. When streaming modifications, an
explicit starting commit must be supplied.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist or does not contain the at
commit,
or the at
commit does not contain the requested path.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of participant users for all the pull requests to or from the specified repository.
Optionally clients can specify following filters.
parameter | value | description |
---|---|---|
direction | Default: incoming | (optional, defaults to INCOMING) the direction relative to the specified repository. Either INCOMING or OUTGOING. |
filter | (optional) return only users, whose username, name or email address contain the {@code filter} value | |
role | (optional) The role associated with the pull request participant. This must be one of {@code AUTHOR}, {@code REVIEWER}, or{@code PARTICIPANT} |
Example response representations:
{"name":"charlie","emailAddress":"charlie@example.com"}
A page of users that match the search criteria.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of users that have been granted at least one permission for the specified repository.
The authenticated user must have REPO_ADMIN permission for the specified repository or a higher project or global permission to call this resource.
parameter | value | description |
---|---|---|
filter | if specified only group names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"permission":"ADMIN"}],"start":0}
A page of users and their highest permissions for the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not a repository administrator for the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Promote or demote a user's permission level for the specified repository. Available repository permissions are:
The authenticated user must have REPO_ADMIN permission for the specified repository or a higher project or global permission to call this resource. In addition, a user may not reduce their own permission level unless they have a project or global permission that already implies that permission.
parameter | value | description |
---|---|---|
name | the names of the users | |
permission | the permission to grant |
Example response representations:
The requested permission was granted.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed or the specified permission does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not an administrator for the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would reduce the currently authenticated user's permission level.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or user does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Revoke all permissions for the specified repository for a user.
The authenticated user must have REPO_ADMIN permission for the specified repository or a higher project or global permission to call this resource.
In addition, a user may not revoke their own repository permissions if they do not have a higher project or global permission.
parameter | value | description |
---|---|---|
name | the name of the user |
Example response representations:
All repository permissions were revoked from the user for the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not an administrator of the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or group does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would reduce the currently authenticated user's permission level.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of licensed users that have no granted permissions for the specified repository.
The authenticated user must have REPO_ADMIN permission for the specified repository or a higher project or global permission to call this resource.
parameter | value | description |
---|---|---|
filter | if specified only group names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"name":"group-a","deletable":true}],"start":0}
A page of users that have not been granted any permissions for the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not a repository administrator for the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Promote or demote a group's permission level for the specified repository. Available repository permissions are:
The authenticated user must have REPO_ADMIN permission for the specified repository or a higher project or global permission to call this resource. In addition, a user may not demote a group's permission level if their own permission level would be reduced as a result.
parameter | value | description |
---|---|---|
permission | the permission to grant | |
name | the names of the groups |
Example response representations:
The requested permission was granted.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed or the specified permission does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not an administrator for the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would reduce the currently authenticated user's permission level.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or group does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Revoke all permissions for the specified repository for a group.
The authenticated user must have REPO_ADMIN permission for the specified repository or a higher project or global permission to call this resource.
In addition, a user may not revoke a group's permissions if it will reduce their own permission level.
parameter | value | description |
---|---|---|
name | the name of the group |
Example response representations:
All repository permissions were revoked from the group for the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not an administrator of the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or group does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The action was disallowed as it would reduce the currently authenticated user's permission level.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of groups that have been granted at least one permission for the specified repository.
The authenticated user must have REPO_ADMIN permission for the specified repository or a higher project or global permission to call this resource.
parameter | value | description |
---|---|---|
filter | if specified only group names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"group":{"name":"group_a"},"permission":"ADMIN"}],"start":0}
A page of groups and their highest permissions for the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not a repository administrator for the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of groups that have no granted permissions for the specified repository.
The authenticated user must have REPO_ADMIN permission for the specified repository or a higher project or global permission to call this resource.
parameter | value | description |
---|---|---|
filter | if specified only group names containing the supplied string will be returned |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"name":"group-a","deletable":true}],"start":0}
A page of groups that have not been granted any permissions for the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not a repository administrator for the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of pull requests to or from the specified repository.
The authenticated user must have REPO_READ permission for the specified repository to call this resource. Optionally clients can specify PR participant filters. Each filter has a mandatory {@code username.N} parameter, and the optional {@code role.N} and {@code approved.N} parameters.
parameter | value | description |
---|---|---|
direction | Default: incoming | (optional, defaults to INCOMING) the direction relative to the specified repository. Either INCOMING or OUTGOING. |
at | (optional) a fully-qualified branch ID to find pull requests to or from, such as {@code refs/heads/master} | |
state | (optional, defaults to OPEN). Supply ALL to return pull request in any state. If a state is supplied only pull requests in the specified state will be returned. Either OPEN, DECLINED or MERGED. | |
order | (optional, defaults to NEWEST) the order to return pull requests in, either OLDEST (as in: "oldest first") or NEWEST. | |
withAttributes | Default: true | (optional) defaults to true, whether to return additional pull request attributes |
withProperties | Default: true | (optional) defaults to true, whether to return additional pull request properties |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"id":101,"version":1,"title":"Talking Nerdy","description":"It’s a kludge, but put the tuple from the database in the cache.","state":"OPEN","open":true,"closed":false,"createdDate":1359075920,"updatedDate":1359085920,"fromRef":{"id":"refs/heads/feature-ABC-123","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"toRef":{"id":"refs/heads/master","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"locked":false,"author":{"user":{"name":"tom","emailAddress":"tom@example.com","id":115026,"displayName":"Tom","active":true,"slug":"tom","type":"NORMAL"},"role":"AUTHOR","approved":true,"status":"APPROVED"},"reviewers":[{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"lastReviewedCommit":"7549846524f8aed2bd1c0249993ae1bf9d3c9998","role":"REVIEWER","approved":true,"status":"APPROVED"}],"participants":[{"user":{"name":"dick","emailAddress":"dick@example.com","id":3083181,"displayName":"Dick","active":true,"slug":"dick","type":"NORMAL"},"role":"PARTICIPANT","approved":false,"status":"UNAPPROVED"},{"user":{"name":"harry","emailAddress":"harry@example.com","id":99049120,"displayName":"Harry","active":true,"slug":"harry","type":"NORMAL"},"role":"PARTICIPANT","approved":true,"status":"APPROVED"}],"links":{"self":[{"href":"http://link/to/pullrequest"}]}}],"start":0}
A page of pull requests that match the search criteria.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the specified pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Create a new pull request between two branches. The branches may be in the same repository, or different ones.
When using different repositories, they must still be in the same {@link Repository#getHierarchyId() hierarchy}.
The authenticated user must have REPO_READ permission for the "from" and "to"repositories to call this resource.
Example request representations:
{"title":"Talking Nerdy","description":"It’s a kludge, but put the tuple from the database in the cache.","state":"OPEN","open":true,"closed":false,"fromRef":{"id":"refs/heads/feature-ABC-123","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"toRef":{"id":"refs/heads/master","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"locked":false,"reviewers":[{"user":{"name":"charlie"}}]}
Example response representations:
{"id":101,"version":1,"title":"Talking Nerdy","description":"It’s a kludge, but put the tuple from the database in the cache.","state":"OPEN","open":true,"closed":false,"createdDate":1359075920,"updatedDate":1359075920,"fromRef":{"id":"refs/heads/feature","displayId":"feature-ABC-123","latestCommit":"babecafebabecafebabecafebabecafebabecafe","repository":{"slug":"my-repo","id":1,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}},"public":true,"links":{"clone":[{"href":"ssh://git@<baseURL>/PRJ/my-repo.git","name":"ssh"},{"href":"https://<baseURL>/scm/PRJ/my-repo.git","name":"http"}],"self":[{"href":"http://link/to/repository"}]}}},"toRef":{"id":"refs/heads/master","displayId":"master","latestCommit":"cafebabecafebabecafebabecafebabecafebabe","repository":{"slug":"my-repo","id":1,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}},"public":true,"links":{"clone":[{"href":"ssh://git@<baseURL>/PRJ/my-repo.git","name":"ssh"},{"href":"https://<baseURL>/scm/PRJ/my-repo.git","name":"http"}],"self":[{"href":"http://link/to/repository"}]}}},"locked":false,"author":{"user":{"name":"alice","emailAddress":"alice@example.com","id":92903040,"displayName":"Alice","active":true,"slug":"alice","type":"NORMAL"},"role":"PARTICIPANT","approved":false,"status":"UNAPPROVED"},"reviewers":[{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"lastReviewedCommit":"7549846524f8aed2bd1c0249993ae1bf9d3c9998","role":"REVIEWER","approved":false,"status":"UNAPPROVED"}],"participants":[],"links":{"self":[{"href":"http://link/to/pullrequest"}]}}
The newly created pull request.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The pull request entity supplied in the request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to create a pull request between the two specified repositories.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
One of the specified repositories or branches does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
One of the following error cases occurred (check the error message for more details):
parameter | value | description |
---|---|---|
pullRequestId | the ID of the pull request within the repository |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a pull request.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
Example response representations:
{"id":101,"version":1,"title":"Talking Nerdy","description":"It’s a kludge, but put the tuple from the database in the cache.","state":"OPEN","open":true,"closed":false,"createdDate":1359075920,"updatedDate":1359085920,"fromRef":{"id":"refs/heads/feature-ABC-123","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"toRef":{"id":"refs/heads/master","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"locked":false,"author":{"user":{"name":"tom","emailAddress":"tom@example.com","id":115026,"displayName":"Tom","active":true,"slug":"tom","type":"NORMAL"},"role":"AUTHOR","approved":true,"status":"APPROVED"},"reviewers":[{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"lastReviewedCommit":"7549846524f8aed2bd1c0249993ae1bf9d3c9998","role":"REVIEWER","approved":true,"status":"APPROVED"}],"participants":[{"user":{"name":"dick","emailAddress":"dick@example.com","id":3083181,"displayName":"Dick","active":true,"slug":"dick","type":"NORMAL"},"role":"PARTICIPANT","approved":false,"status":"UNAPPROVED"},{"user":{"name":"harry","emailAddress":"harry@example.com","id":99049120,"displayName":"Harry","active":true,"slug":"harry","type":"NORMAL"},"role":"PARTICIPANT","approved":true,"status":"APPROVED"}],"links":{"self":[{"href":"http://link/to/pullrequest"}]}}
The specified pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the specified pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Update the title, description, reviewers or destination branch of an existing pull request.
Note: the reviewers list may be updated using this resource. However the author and participants list may not.
The authenticated user must either:
Example request representations:
{"id":101,"version":2,"title":"Talking Nerdy","description":"It’s a hack, but force AO to eagerly initialize to avoid deadlocks.","reviewers":[{"user":{"name":"charlie"}}]}
Example response representations:
{"id":101,"version":1,"title":"Talking Nerdy","description":"It’s a kludge, but put the tuple from the database in the cache.","state":"OPEN","open":true,"closed":false,"createdDate":1359075920,"updatedDate":1359085920,"fromRef":{"id":"refs/heads/feature-ABC-123","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"toRef":{"id":"refs/heads/master","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"locked":false,"author":{"user":{"name":"tom","emailAddress":"tom@example.com","id":115026,"displayName":"Tom","active":true,"slug":"tom","type":"NORMAL"},"role":"AUTHOR","approved":true,"status":"APPROVED"},"reviewers":[{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"lastReviewedCommit":"7549846524f8aed2bd1c0249993ae1bf9d3c9998","role":"REVIEWER","approved":true,"status":"APPROVED"}],"participants":[{"user":{"name":"dick","emailAddress":"dick@example.com","id":3083181,"displayName":"Dick","active":true,"slug":"dick","type":"NORMAL"},"role":"PARTICIPANT","approved":false,"status":"UNAPPROVED"},{"user":{"name":"harry","emailAddress":"harry@example.com","id":99049120,"displayName":"Harry","active":true,"slug":"harry","type":"NORMAL"},"role":"PARTICIPANT","approved":true,"status":"APPROVED"}],"links":{"self":[{"href":"http://link/to/pullrequest"}]}}
The updated pull request.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
One of the following error cases occurred (check the error message for more details):
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to update the specified pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
One of the specified repositories or branches does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
One of the following error cases occurred (check the error message for more details):
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Deletes a pull request.
To call this resource, users must be authenticated and have permission to view the pull request. Additionally, they must:
{ "version": 1 }
Example request representations:
{"version":1}
Example response representations:
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the specified pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
parameter | value | description |
---|---|---|
pullRequestId | the id of the pull request within the repository |
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of activity associated with a pull request.
Activity items include comments, approvals, rescopes (i.e. adding and removing of commits), merges and more.
Different types of activity items may be introduced in newer versions of Stash or by user installed plugins, so clients should be flexible enough to handle unexpected entity shapes in the returned page.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
parameter | value | description |
---|---|---|
fromId | (optional) the id of the activity item to use as the first item in the returned page | |
fromType | (required if fromId is present) the type of the activity item specified by fromId (either COMMENT or ACTIVITY) |
Example response representations:
{"size":3,"limit":25,"isLastPage":true,"values":[{"id":101,"createdDate":1359065920,"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"action":"COMMENTED","commentAction":"ADDED","comment":{"properties":{"key":"value"},"id":1,"version":1,"text":"A measured reply.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792962,"updatedDate":1515624792962,"comments":[{"properties":{"key":"value"},"id":1,"version":1,"text":"An insightful comment.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}},"commentAnchor":{"line":1,"lineType":"CONTEXT","fileType":"FROM","path":"path/to/file","srcPath":"path/to/file"}},{"id":101,"createdDate":1359065920,"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"action":"RESCOPED","fromHash":"abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde","previousFromHash":"bcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdea","previousToHash":"cdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeab","toHash":"ddeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabc","added":{"commits":[{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0123a","author":{"name":"charlie","emailAddress":"charlie@example.com"},"authorTimestamp":1515624793772,"committer":{"name":"charlie","emailAddress":"charlie@example.com"},"committerTimestamp":1515624793772,"message":"WIP on feature 1","parents":[{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0"}]}],"total":1},"removed":{"commits":[{"id":"def0123abcdef4567abcdef8987abcdef6543abc","displayId":"def0123abcd","author":{"name":"charlie","emailAddress":"charlie@example.com"},"authorTimestamp":1515624793772,"committer":{"name":"charlie","emailAddress":"charlie@example.com"},"committerTimestamp":1515624793772,"message":"More work on feature 1","parents":[{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0"}]}],"total":1}},{"id":101,"createdDate":1359085920,"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"action":"MERGED"}],"start":0}
A page of activity relating to the specified pull request.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the specified pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
parameter | value | description |
---|---|---|
pullRequestId |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Decline a pull request.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
parameter | value | description |
---|---|---|
version | Default: -1 | the current version of the pull request. If the server's version isn't the same as the specified version the operation will fail. To determine the current version of the pull request it should be fetched from the server prior to this operation. Look for the 'version' attribute in the returned JSON structure. |
Example response representations:
The pull request was declined.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The pull request is not OPEN or has been updated since the version specified by the request.
parameter | value | description |
---|---|---|
pullRequestId | the ID of the pull request within the repository |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Test whether a pull request can be merged.
A pull request may not be merged if:
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
Example response representations:
{"canMerge":false,"conflicted":true,"outcome":"CONFLICTED","vetoes":[{"summaryMessage":"You may not merge after 6pm on a Friday.","detailedMessage":"It is likely that your Blood Alcohol Content (BAC) exceeds the threshold for making sensible decisions regarding pull requests. Please try again on Monday."}]}
The mergeability status of the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the specified pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified pull request is not open.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Merge the specified pull request.
The authenticated user must have REPO_WRITE permission for the repository that this pull request targets to call this resource.
parameter | value | description |
---|---|---|
version | Default: -1 | the current version of the pull request. If the server's version isn't the same as the specified version the operation will fail. To determine the current version of the pull request it should be fetched from the server prior to this operation. Look for the 'version' attribute in the returned JSON structure. |
Example response representations:
{"id":101,"version":1,"title":"Talking Nerdy","description":"It’s a kludge, but put the tuple from the database in the cache.","state":"MERGED","open":false,"closed":true,"createdDate":1359075920,"updatedDate":1359115920,"closedDate":1359115920,"fromRef":{"id":"refs/heads/feature-ABC-123","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"toRef":{"id":"refs/heads/master","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"locked":false,"author":{"user":{"name":"tom","emailAddress":"tom@example.com","id":115026,"displayName":"Tom","active":true,"slug":"tom","type":"NORMAL"},"role":"AUTHOR","approved":true,"status":"APPROVED"},"reviewers":[{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"lastReviewedCommit":"7549846524f8aed2bd1c0249993ae1bf9d3c9998","role":"REVIEWER","approved":true,"status":"APPROVED"}],"participants":[{"user":{"name":"dick","emailAddress":"dick@example.com","id":3083181,"displayName":"Dick","active":true,"slug":"dick","type":"NORMAL"},"role":"PARTICIPANT","approved":true,"status":"APPROVED"},{"user":{"name":"harry","emailAddress":"harry@example.com","id":99049120,"displayName":"Harry","active":true,"slug":"harry","type":"NORMAL"},"role":"PARTICIPANT","approved":true,"status":"APPROVED"}],"properties":{"commentCount":3},"links":{"self":[{"href":"http://link/to/pullrequest"}]}}
The merged pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to merge the specified pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
One of the following error cases occurred (check the error message for more details):
parameter | value | description |
---|---|---|
pullRequestId | the id of the pull request within the repository |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Re-open a declined pull request.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
parameter | value | description |
---|---|---|
version | Default: -1 | the current version of the pull request. If the server's version isn't the same as the specified version the operation will fail. To determine the current version of the pull request it should be fetched from the server prior to this operation. Look for the 'version' attribute in the returned JSON structure. |
Example response representations:
{"id":101,"version":1,"title":"Talking Nerdy","description":"It’s a kludge, but put the tuple from the database in the cache.","state":"OPEN","open":true,"closed":false,"createdDate":1359075920,"updatedDate":1359085920,"fromRef":{"id":"refs/heads/feature-ABC-123","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"toRef":{"id":"refs/heads/master","repository":{"slug":"my-repo","name":null,"project":{"key":"PRJ"}}},"locked":false,"author":{"user":{"name":"tom","emailAddress":"tom@example.com","id":115026,"displayName":"Tom","active":true,"slug":"tom","type":"NORMAL"},"role":"AUTHOR","approved":true,"status":"APPROVED"},"reviewers":[{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"lastReviewedCommit":"7549846524f8aed2bd1c0249993ae1bf9d3c9998","role":"REVIEWER","approved":true,"status":"APPROVED"}],"participants":[{"user":{"name":"dick","emailAddress":"dick@example.com","id":3083181,"displayName":"Dick","active":true,"slug":"dick","type":"NORMAL"},"role":"PARTICIPANT","approved":false,"status":"UNAPPROVED"},{"user":{"name":"harry","emailAddress":"harry@example.com","id":99049120,"displayName":"Harry","active":true,"slug":"harry","type":"NORMAL"},"role":"PARTICIPANT","approved":true,"status":"APPROVED"}],"links":{"self":[{"href":"http://link/to/pullrequest"}]}}
The merged pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to reopen the specified pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
One of the following error cases occurred (check the error message for more details):
parameter | value | description |
---|---|---|
pullRequestId | the id of the pull request within the repository |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Approve a pull request as the current user. Implicitly adds the user as a participant if they are not already.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
Deprecated since 4.2. Use /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug} instead
Example response representations:
{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"lastReviewedCommit":"7549846524f8aed2bd1c0249993ae1bf9d3c9998","role":"REVIEWER","approved":true,"status":"APPROVED"}
Details of the new participant
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The pull request is not open.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Remove approval from a pull request as the current user. This does not remove the user as a participant.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
Deprecated since 4.2. Use /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug} instead
Example response representations:
{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"lastReviewedCommit":"7549846524f8aed2bd1c0249993ae1bf9d3c9998","role":"REVIEWER","approved":false,"status":"UNAPPROVED"}
Details of the updated participant
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist or the current user is not a participant on the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The pull request is not open.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Gets changes for the specified PullRequest.
If the {@code changeScope} query parameter is set to {@code unreviewed}, the application will attempt to stream unreviewed changes based on the {@code lastReviewedCommit} of the current user, which are the changes between the {@code lastReviewedCommit} and the latest commit of the source branch. The current user is considered to not have any unreviewed changes for the pull request when the {@code lastReviewedCommit} is either {@code null} (everything is unreviewed, so all changes are streamed), equal to the latest commit of the source branch (everything is reviewed), or no longer on the source branch (the source branch has been rebased). In these cases, the application will fall back to streaming all changes (the default), which is the effective diff for the pull request. The type of changes streamed can be determined by the {@code changeScope} parameter included in the properties map of the response.
Note: This resource is currently not paged. The server will return at most one page. The server will truncate the number of changes to either the request's page limit or an internal maximum, whichever is smaller. The start parameter of the page request is also ignored.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
parameter | value | description |
---|---|---|
changeScope | Default: ALL | {@code UNREVIEWED} to stream the unreviewed changes for the current user (if they exist); {@code RANGE} to stream changes between two arbitrary commits (requires {@code sinceId} and {@code untilId}); otherwise {@code ALL} to stream all changes (the default) |
sinceId | the since commit hash to stream changes for a {@code RANGE} arbitrary change scope | |
untilId | the until commit hash to stream changes for a {@code RANGE} arbitrary change scope | |
withComments | Default: true | {@code true} to apply comment counts in the changes (the default); otherwise, {@code false} to stream changes without comment counts |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"contentId":"5c279d6c7a3a053a145905aa9682ce02c16449e9","fromContentId":"7b86ad1a05b4259b8fa54497a8be0bd359a405bd","path":{"components":["path","to","unreviewed","file.txt"],"parent":"path/to/unreviewed","name":"file.txt","extension":"txt","toString":"path/to/unreviewed/file.txt"},"executable":false,"percentUnchanged":98,"type":"MOVE","nodeType":"FILE","srcPath":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"srcExecutable":false,"links":{"self":[null]},"properties":{"unreviewedCommits":1}}],"start":0}
A page of unreviewed Changes for the current user from the supplied pull request, including the unreviewedCommits in the properties map.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository or pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository or pull request does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Add a new comment.
Comments can be added in a few places by setting different attributes:
General pull request comment:
{ "text": "An insightful general comment on a pull request." }Reply to a comment:
{ "text": "A measured reply.", "parent": { "id": 1 } }General file comment:
{ "text": "An insightful general comment on a file.", "anchor": { "diffType": "RANGE", "fromHash": "6df3858eeb9a53a911cd17e66a9174d44ffb02cd", "path": "path/to/file", "srcPath": "path/to/file", "toHash": "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b" } }File line comment:
{ "text": "A pithy comment on a particular line within a file.", "anchor": { "diffType": "COMMIT", "line": 1, "lineType": "CONTEXT", "fileType": "FROM", "fromHash": "6df3858eeb9a53a911cd17e66a9174d44ffb02cd", "path": "path/to/file", "srcPath": "path/to/file", "toHash": "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b" } }
For file and line comments, 'path' refers to the path of the file to which the comment should be applied and 'srcPath' refers to the path the that file used to have (only required for copies and moves). Also, fromHash and toHash refer to the sinceId / untilId (respectively) used to produce the diff on which the comment was added. Finally diffType refers to the type of diff the comment was added on. For backwards compatibility purposes if no diffType is provided and no fromHash/toHash pair is provided the diffType will be resolved to 'EFFECTIVE'. In any other cases the diffType is REQUIRED.
For line comments, 'line' refers to the line in the diff that the comment should apply to. 'lineType' refers to the type of diff hunk, which can be:
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
Example request representations:
{"text":"An insightful comment.","parent":{"id":1},"anchor":{"line":1,"lineType":"CONTEXT","fileType":"FROM","path":"path/to/file","srcPath":"path/to/file"}}
Example response representations:
{"properties":{"key":"value"},"id":1,"version":1,"text":"A measured reply.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792962,"updatedDate":1515624792962,"comments":[{"properties":{"key":"value"},"id":1,"version":1,"text":"An insightful comment.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}
The newly created comment.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The comment was not created due to a validation error.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the pull request, create a comment or watch the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
Unable to find the supplied project, repository, pull request or parent comment
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Gets comments for the specified PullRequest.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
parameter | value | description |
---|---|---|
anchorState | Default: ACTIVE | {@code ACTIVE} to stream the active comments; {@code ORPHANED} to stream the orphaned comments; {@code ALL} to stream both the active and the orphaned comments; |
diffType | {@code EFFECTIVE} to stream the comments related to the effective diff of the pull request; {@code RANGE} to stream comments related to a commit range between two arbitrary commits (requires {@code fromHash} and {@code toHash}); {@code COMMIT} to stream comments related to a commit between two arbitrary commits (requires {@code fromHash} and {@code toHash}) | |
fromHash | the from commit hash to stream comments for a {@code RANGE} or {@code COMMIT} arbitrary change scope | |
path | the path to stream comments for a given path | |
toHash | the to commit hash to stream comments for a {@code RANGE} or {@code COMMIT} arbitrary change scope |
Example response representations:
{"properties":{"key":"value"},"id":1,"version":1,"text":"A measured reply.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792962,"updatedDate":1515624792962,"comments":[{"properties":{"key":"value"},"id":1,"version":1,"text":"An insightful comment.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}
A page of Comments from the supplied pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository or pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository or pull request does not exist.
parameter | value | description |
---|---|---|
commentId | the id of the comment to retrieve |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Delete a pull request comment. Anyone can delete their own comment. Only users with REPO_ADMIN
and above may delete comments created by other users.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
parameter | value | description |
---|---|---|
version | Default: -1 | The expected version of the comment. This must match the server's version of the comment or the delete will fail. To determine the current version of the comment, the comment should be fetched from the server prior to the delete. Look for the 'version' attribute in the returned JSON structure. |
Example response representations:
The operation was successful
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to delete the comment.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
Unable to find the supplied project, repository or pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The comment has replies or the version supplied does not match the current version.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Update the text of a comment. Only the user who created a comment may update it.
Note: the supplied supplied JSON object must contain a version
that must match the
server's version of the comment or the update will fail. To determine the current version of
the comment, the comment should be fetched from the server prior to the update. Look for the
'version' attribute in the returned JSON structure.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
Example request representations:
{"version":0,"text":"A pithy comment."}
Example response representations:
{"properties":{"key":"value"},"id":1,"version":1,"text":"A measured reply.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792962,"updatedDate":1515624792962,"comments":[{"properties":{"key":"value"},"id":1,"version":1,"text":"An insightful comment.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}
The newly updated comment.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The comment was not updated due to a validation error.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the pull request, update a comment or watch the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
Unable to find the supplied project, repository, pull request or comment
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The comment version supplied does not match the current version.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieves a pull request comment.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
Example response representations:
{"properties":{"key":"value"},"id":1,"version":1,"text":"A measured reply.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792962,"updatedDate":1515624792962,"comments":[{"properties":{"key":"value"},"id":1,"version":1,"text":"An insightful comment.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}
The requested comment.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the comment
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
Unable to find the supplied project, repository, pull request or comment
parameter | value | description |
---|---|---|
pullRequestId |
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve commits for the specified pull request.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
parameter | value | description |
---|---|---|
withCounts | if set to true, the service will add "authorCount" and "totalCount" at the end of the page. "authorCount" is the number of different authors and "totalCount" is the total number of commits. |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"id":"def0123abcdef4567abcdef8987abcdef6543abc","displayId":"def0123abcd","author":{"name":"charlie","emailAddress":"charlie@example.com"},"authorTimestamp":1515624793772,"committer":{"name":"charlie","emailAddress":"charlie@example.com"},"committerTimestamp":1515624793772,"message":"More work on feature 1","parents":[{"id":"abcdef0123abcdef4567abcdef8987abcdef6543","displayId":"abcdef0"}]}],"start":0,"authorCount":1,"totalCount":1}
a page of commits from the supplied pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository or pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository or pull request does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Streams a diff within a pull request.
If the specified file has been copied, moved or renamed, the srcPath
must also be specified to
produce the correct diff.
Note: This RESTful endpoint is currently not paged. The server will internally apply a hard cap to the streamed lines, and it is not possible to request subsequent pages if that cap is exceeded.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
parameter | value | description |
---|---|---|
contextLines | Default: -1 | the number of context lines to include around added/removed lines in the diff |
diffType | Default: EFFECTIVE | the type of diff being requested. When {@code withComments} is {@code true} this works as a hint to the system to attach the correct set of comments to the diff |
sinceId | the since commit hash to stream a diff between two arbitrary hashes | |
srcPath | the previous path to the file, if the file has been copied, moved or renamed | |
untilId | the until commit hash to stream a diff between two arbitrary hashes | |
whitespace | optional whitespace flag which can be set to | |
withComments | Default: true |
|
Example response representations:
{"diffs":[{"source":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"destination":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"hunks":[{"sourceLine":1,"sourceSpan":1,"destinationLine":1,"destinationSpan":2,"segments":[{"type":"REMOVED","lines":[{"destination":1,"source":1,"line":"import sys","truncated":false}],"truncated":false},{"type":"ADDED","lines":[{"destination":1,"source":2,"line":"import re","truncated":false,"conflictMarker":"OURS","commentIds":[1]},{"destination":2,"source":3,"line":"import os","truncated":false}],"truncated":false}],"truncated":false}],"lineComments":[{"properties":{"key":"value"},"id":1,"version":1,"text":"An insightful comment.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}],"truncated":"true","contextLines":"10","fromHash":"a0f224fd7bd5f28ea5a752d41b9c9f6372fc6d9e","toHash":"dc93f22caadcde35daf5cc2cd65d2738c87e31ca","whiteSpace":"SHOW"}],"truncated":"true","contextLines":"10","fromHash":"a0f224fd7bd5f28ea5a752d41b9c9f6372fc6d9e","toHash":"dc93f22caadcde35daf5cc2cd65d2738c87e31ca","whiteSpace":"SHOW"}
a page of differences from a pull request.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository or pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository or pull request does not exist.
parameter | value | description |
---|---|---|
path | the path to the file which should be diffed (optional) |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Streams a diff within a pull request.
If the specified file has been copied, moved or renamed, the srcPath
must also be specified to
produce the correct diff.
Note: This RESTful endpoint is currently not paged. The server will internally apply a hard cap to the streamed lines, and it is not possible to request subsequent pages if that cap is exceeded.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
parameter | value | description |
---|---|---|
contextLines | Default: -1 | the number of context lines to include around added/removed lines in the diff |
diffType | Default: EFFECTIVE | the type of diff being requested. When {@code withComments} is {@code true} this works as a hint to the system to attach the correct set of comments to the diff |
sinceId | the since commit hash to stream a diff between two arbitrary hashes | |
srcPath | the previous path to the file, if the file has been copied, moved or renamed | |
untilId | the until commit hash to stream a diff between two arbitrary hashes | |
whitespace | optional whitespace flag which can be set to | |
withComments | Default: true |
|
Example response representations:
{"diffs":[{"source":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"destination":{"components":["path","to","file.txt"],"parent":"path/to","name":"file.txt","extension":"txt","toString":"path/to/file.txt"},"hunks":[{"sourceLine":1,"sourceSpan":1,"destinationLine":1,"destinationSpan":2,"segments":[{"type":"REMOVED","lines":[{"destination":1,"source":1,"line":"import sys","truncated":false}],"truncated":false},{"type":"ADDED","lines":[{"destination":1,"source":2,"line":"import re","truncated":false,"conflictMarker":"OURS","commentIds":[1]},{"destination":2,"source":3,"line":"import os","truncated":false}],"truncated":false}],"truncated":false}],"lineComments":[{"properties":{"key":"value"},"id":1,"version":1,"text":"An insightful comment.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}}],"truncated":"true","contextLines":"10","fromHash":"a0f224fd7bd5f28ea5a752d41b9c9f6372fc6d9e","toHash":"dc93f22caadcde35daf5cc2cd65d2738c87e31ca","whiteSpace":"SHOW"}],"truncated":"true","contextLines":"10","fromHash":"a0f224fd7bd5f28ea5a752d41b9c9f6372fc6d9e","toHash":"dc93f22caadcde35daf5cc2cd65d2738c87e31ca","whiteSpace":"SHOW"}
a page of differences from a pull request.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the repository or pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository or pull request does not exist.
parameter | value | description |
---|---|---|
pullRequestId | the id of the pull request within the repository |
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieves a page of the participants for a given pull request.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"lastReviewedCommit":"7549846524f8aed2bd1c0249993ae1bf9d3c9998","role":"REVIEWER","approved":true,"status":"APPROVED"}],"start":0}
Details of the participants in this pull request
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Assigns a participant to an explicit role in pull request. Currently only the REVIEWER role may be assigned.
If the user is not yet a participant in the pull request, they are made one and assigned the supplied role.
If the user is already a participant in the pull request, their previous role is replaced with the supplied role unless they are already assigned the AUTHOR role which cannot be changed and will result in a Bad Request (400) response code.
The authenticated user must have REPO_WRITE permission for the repository that this pull request targets to call this resource.
Example request representations:
{"user":{"name":"charlie"},"role":"REVIEWER"}
Example response representations:
{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"lastReviewedCommit":"7549846524f8aed2bd1c0249993ae1bf9d3c9998","role":"REVIEWER","approved":false,"status":"UNAPPROVED"}
The created or updated participant.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request does not have the username and role, or is attempting an invalid assignment
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to update the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Unassigns a participant from the REVIEWER role they may have been given in a pull request.
If the participant has no explicit role this method has no effect.
Afterwards, the user will still remain a participant in the pull request but their role will be reduced to PARTICIPANT. This is because once made a participant of a pull request, a user will forever remain a participant. Only their role may be altered.
The authenticated user must have REPO_WRITE permission for the repository that this pull request targets to call this resource.
Deprecated since 4.2. Use /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug} instead.
parameter | value | description |
---|---|---|
username | the participant's user name |
Example response representations:
The update completed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request does not have the username
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to update the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
parameter | value | description |
---|---|---|
pullRequestId | the id of the pull request within the repository | |
userSlug | the slug for the user changing their status | |
pullRequestId | the id of the pull request within the repository |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Unassigns a participant from the REVIEWER role they may have been given in a pull request.
If the participant has no explicit role this method has no effect.
Afterwards, the user will still remain a participant in the pull request but their role will be reduced to PARTICIPANT. This is because once made a participant of a pull request, a user will forever remain a participant. Only their role may be altered.
The authenticated user must have REPO_WRITE permission for the repository that this pull request targets to call this resource.
Deprecated since 4.2. Use /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug} instead.
Example response representations:
The update completed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request does not have the username
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to update the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Change the current user's status for a pull request. Implicitly adds the user as a participant if they are not
already. If the current user is the author, this method will fail.
The possible values for {@code status} are UNAPPROVED, NEEDS_WORK, or APPROVED.
If the new {@code status} is NEEDS_WORK or APPROVED then the {@code lastReviewedCommit} for the participant will be updated to the latest commit of the source branch of the pull request.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
Example request representations:
{"user":{"name":"charlie"},"approved":true,"status":"APPROVED"}
Example response representations:
{"user":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"lastReviewedCommit":"7549846524f8aed2bd1c0249993ae1bf9d3c9998","role":"REVIEWER","approved":true,"status":"APPROVED"}
Details of the new participant
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified status was invalid.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The pull request is not open.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve the tasks associated with a pull request.
Example response representations:
{"size":2,"limit":25,"isLastPage":true,"values":[{"properties":{"diffAnchorPath":"path/to/file.txt"},"anchor":{"properties":{"key":"value"},"id":1,"version":1,"text":"An insightful comment.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}},"author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792964,"id":98,"permittedOperations":{"deletable":true,"editable":true,"transitionable":true},"text":"Fix typos on the constructor's arguments","state":"OPEN"},{"properties":{"diffAnchorPath":"path/to/file.txt"},"anchor":{"properties":{"key":"value"},"id":5,"version":1,"text":"This class is deprecated. Can you please use the replacement?","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}},"author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792964,"id":99,"permittedOperations":{"deletable":false,"editable":false,"transitionable":true},"text":"Remove usage of deprecated class","state":"RESOLVED"}],"start":0}
A page of tasks associated with the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the current user cannot access the pull request
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the pull request does not exist
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve the total number of {@link TaskState#OPEN open} and
{@link TaskState#RESOLVED resolved} tasks associated with a pull request.
Example response representations:
{"open":5,"resolved":2}
Total number of {@link TaskState#OPEN open} and {@link TaskState#RESOLVED resolved} tasks associated with the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the current user cannot access the pull request
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the pull request does not exist
parameter | value | description |
---|---|---|
pullRequestId | the id of the pull request within the repository |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Make the authenticated user stop watching the specified pull request.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
Example response representations:
The user is no longer watching the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Make the authenticated user watch the specified pull request.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
Example response representations:
The user is now watching the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the pull request.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or pull request does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve the raw content for a file path at a specified revision.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
at | the commit ID or ref to retrieve the content for. | |
markup | if present or | |
hardwrap | (Optional) Whether the markup implementation should convert newlines to breaks.
If not specified, {@link MarkupService} will use the value of the
| |
htmlEscape | (Optional) true if HTML should be escaped in the input markup, false otherwise.
If not specified, {@link MarkupService} will use the value of the
|
Example response representations:
parameter | value | description |
---|---|---|
path | the file path to retrieve content from |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve the raw content for a file path at a specified revision.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
at | the commit ID or ref to retrieve the content for. | |
markup | if present or | |
hardwrap | (Optional) Whether the markup implementation should convert newlines to breaks.
If not specified, {@link MarkupService} will use the value of the
| |
htmlEscape | (Optional) true if HTML should be escaped in the input markup, false otherwise.
If not specified, {@link MarkupService} will use the value of the
|
Example response representations:
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Update the pull request settings for the context repository.
The authenticated user must have REPO_ADMIN permission for the context repository to call this resource.
This resource will call all RestFragments that are registered with the key bitbucket.repository.settings.pullRequests. If any fragment fails validations by returning a non-empty Map of errors, then no fragments will execute.
Only the settings that should be updated need to be included in the request.
The property keys for the settings that are bundled with the application are
An explicitly set pull request merge strategy configuration can be deleted by POSTing a document with an empty "mergeConfig" attribute. i.e:
{ "mergeConfig": { } }Upon completion of this request, the effective configuration will be:
Example request representations:
{"mergeConfig":{"defaultStrategy":{"id":"no-ff"},"strategies":[{"id":"no-ff"}]},"requiredAllApprovers":false,"requiredAllTasksComplete":false,"com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook":{"enabled":true,"count":2},"requiredApprovers":2,"com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck":{"enabled":true,"count":3},"requiredSuccessfulBuilds":2}
Example response representations:
{"mergeConfig":{"defaultStrategy":{"description":"Always create a merge commit","enabled":true,"flag":"--no-ff","id":"no-ff","name":"Merge commit"},"strategies":[{"description":"Always create a merge commit","enabled":true,"flag":"--no-ff","id":"no-ff","name":"Merge commit"}],"type":"repository"},"requiredAllApprovers":false,"requiredAllTasksComplete":false,"com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook":{"enabled":true,"count":2},"requiredApprovers":2,"com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck":{"enabled":true,"count":3},"requiredSuccessfulBuilds":2}
The repository pull request settings for the context repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository pull request settings were not updated due to a validation error.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to see the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve the pull request settings for the context repository.
The authenticated user must have REPO_READ permission for the context repository to call this resource.
This resource will call all RestFragments that are registered with the key bitbucket.repository.settings.pullRequests. If any fragment fails validations by returning a non-empty Map of errors, then no fragments will execute.
The property keys for the settings that are bundled with the application are
Example response representations:
{"mergeConfig":{"defaultStrategy":{"description":"Always create a merge commit","enabled":true,"flag":"--no-ff","id":"no-ff","name":"Merge commit"},"strategies":[{"description":"Always create a merge commit","enabled":true,"flag":"--no-ff","id":"no-ff","name":"Merge commit"}],"type":"repository"},"requiredAllApprovers":false,"requiredAllTasksComplete":false,"com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook":{"enabled":true,"count":2},"requiredApprovers":2,"com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck":{"enabled":true,"count":3},"requiredSuccessfulBuilds":2}
The repository pull request settings for the context repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to see the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a page of repository hooks for this repository.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
type | Default: | the optional type to filter by. Valid values are |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"details":{"key":"com.atlassian.stash.plugin.example:example-repository-hook","name":"Example repository hook","type":"PRE_RECEIVE","description":"An example description for an example hook.","version":"1.2.4","configFormKey":null,"scopeTypes":["PROJECT","REPOSITORY"]},"enabled":true,"configured":true,"scope":{"resourceId":2,"type":"REPOSITORY"}}],"start":0}
returns a page of repository hooks with their associated enabled state.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to retrieve the hooks.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
parameter | value | description |
---|---|---|
hookKey |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Delete repository hook configuration for the supplied hookKey and repositorySlug
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
Example response representations:
The hook configuration matching the supplied hookKey and repositorySlug was deleted
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to delete the hook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or hook does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a repository hook for this repository.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
Example response representations:
{"details":{"key":"com.atlassian.stash.plugin.example:example-repository-hook","name":"Example repository hook","type":"PRE_RECEIVE","description":"An example description for an example hook.","version":"1.2.4","configFormKey":null,"scopeTypes":["PROJECT","REPOSITORY"]},"enabled":true,"configured":true,"scope":{"resourceId":2,"type":"REPOSITORY"}}
returns the repository hooks with their associated enabled state for the supplied hookKey.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to retrieve the hook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository hook does not exist for the given repository, or the repository does not exist.
parameter | value | description |
---|---|---|
hookKey |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Enable a repository hook for this repository and optionally apply new configuration.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
A JSON document may be provided to use as the settings for the hook. These structure and validity of the document is decided by the plugin providing the hook.
parameter | value | description |
---|---|---|
Content-Length | Default: 0 |
Example response representations:
{"details":{"key":"com.atlassian.stash.plugin.example:example-repository-hook","name":"Example repository hook","type":"PRE_RECEIVE","description":"An example description for an example hook.","version":"1.2.4","configFormKey":null,"scopeTypes":["PROJECT","REPOSITORY"]},"enabled":true,"configured":true,"scope":{"resourceId":2,"type":"REPOSITORY"}}
returns the repository hooks with their associated enabled state for the supplied hookKey.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The settings specified are invalid.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to enable the hook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or hook does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Disable a repository hook for this repository.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
Example response representations:
{"details":{"key":"com.atlassian.stash.plugin.example:example-repository-hook","name":"Example repository hook","type":"PRE_RECEIVE","description":"An example description for an example hook.","version":"1.2.4","configFormKey":null,"scopeTypes":["PROJECT","REPOSITORY"]},"enabled":true,"configured":true,"scope":{"resourceId":2,"type":"REPOSITORY"}}
returns the repository hooks with their associated enabled state for the supplied hookKey.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to disable the hook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or hook does not exist.
parameter | value | description |
---|---|---|
hookKey |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve the settings for a repository hook for this repository.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
Example response representations:
{"string-value":"this is an arbitrary string","integer-value":1,"long-value":2147483648,"boolean-value":true,"double-value":1.1}
The settings for the hook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to retrieve the hook settings.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or hook does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Modify the settings for a repository hook for this repository.
The service will reject any settings which are too large, the current limit is 32KB once serialized.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
A JSON document can be provided to use as the settings for the hook. These structure and validity of the document is decided by the plugin providing the hook.
Example request representations:
{"string-value":"this is an arbitrary string","integer-value":1,"long-value":2147483648,"boolean-value":true,"double-value":1.1}
Example response representations:
{"string-value":"this is an arbitrary string","integer-value":1,"long-value":2147483648,"boolean-value":true,"double-value":1.1}
The settings for the hook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The settings specified are invalid.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to modify the hook settings.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository or hook does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Creates a tag using the information provided in the {@link RestCreateTagRequest request}
The authenticated user must have REPO_WRITE permission for the context repository to call this resource.
Example request representations:
{"name":"my-tag","startPoint":"8d351a10fb428c0c1239530256e21cf24f136e73","message":"This is my tag"}
Example response representations:
{"id":"release-2.0.0","displayId":"refs/tags/release-2.0.0","type":"TAG","latestCommit":"8d351a10fb428c0c1239530256e21cf24f136e73","latestChangeset":"8d351a10fb428c0c1239530256e21cf24f136e73","hash":"8d51122def5632836d1cb1026e879069e10a1e13"}
The created tag
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to write to the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
This is a paged API. This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve the tags matching the supplied filterText param.
The authenticated user must have REPO_READ permission for the context repository to call this resource.
parameter | value | description |
---|---|---|
filterText | the text to match on | |
orderBy | ordering of refs either ALPHABETICAL (by name) or MODIFICATION (last updated) |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"id":"release-2.0.0","displayId":"refs/tags/release-2.0.0","type":"TAG","latestCommit":"8d351a10fb428c0c1239530256e21cf24f136e73","latestChangeset":"8d351a10fb428c0c1239530256e21cf24f136e73","hash":"8d51122def5632836d1cb1026e879069e10a1e13"}],"start":0}
The tags matching the supplied filterText.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to read the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
parameter | value | description |
---|---|---|
name | the name of the tag to be retrieved |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Retrieve a tag in the specified repository.
The authenticated user must have REPO_READ permission for the context repository to call this resource.
Example response representations:
{"id":"release-2.0.0","displayId":"refs/tags/release-2.0.0","type":"TAG","latestCommit":"8d351a10fb428c0c1239530256e21cf24f136e73","latestChangeset":"8d351a10fb428c0c1239530256e21cf24f136e73","hash":"8d51122def5632836d1cb1026e879069e10a1e13"}
The tag which matches the supplied name.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to read the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified tag does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Find webhooks in this repository.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
event | list of {@link com.atlassian.webhooks.WebhookEvent} ids to filter for | |
statistics | Default: false | {@code true} if statistics should be provided for all found webhooks |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"id":10,"name":"Webhook Name","createdDate":1513106011000,"updatedDate":1513106011000,"events":["repo:refs_updated","repo:modified"],"configuration":{"secret":"password"},"url":"http://example.com","active":true}],"start":0}
A list of webhooks.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to find webhooks in the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Create a webhook for the repository specified via the URL.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
Example request representations:
Example response representations:
{"id":10,"name":"Webhook Name","createdDate":1513106011000,"updatedDate":1513106011000,"events":["repo:refs_updated","repo:modified"],"configuration":{"secret":"password"},"url":"http://example.com","active":true}
A created webhook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The webhook parameters were invalid or not supplied.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to create webhooks in the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Test connectivity to a specific endpoint.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
url | the url in which to connect to |
Example response representations:
{"request":{"url":"http://example.com/callback","body":null,"method":"POST","headers":{"Accept":"*/*"}},"response":{"status":200,"headers":{"Content-Type":"application/json"},"body":"{\n \"accepted\": true\n}"}}
a webhook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to test a connection.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist.
parameter | value | description |
---|---|---|
webhookId | the existing webhook id |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Delete a webhook for the repository specified via the URL.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
Example response representations:
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to delete webhooks in the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist, or webhook does not exist in this repository.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Get a webhook by id.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
statistics | Default: false |
Example response representations:
{"id":10,"name":"Webhook Name","createdDate":1513106011000,"updatedDate":1513106011000,"events":["repo:refs_updated","repo:modified"],"configuration":{"secret":"password"},"url":"http://example.com","active":true}
a webhook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to get a webhook in the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist, or the webhook does not exist in the repository.
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Update an existing webhook.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
Example request representations:
Example response representations:
{"id":10,"name":"Webhook Name","createdDate":1513106011000,"updatedDate":1513106011000,"events":["repo:refs_updated","repo:modified"],"configuration":{"secret":"password"},"url":"http://example.com","active":true}
a webhook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to update a webhook in this repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist, or the webhook does not exist in the repository.
parameter | value | description |
---|---|---|
webhookId | id of the webhook |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Get the latest invocations for a specific webhook.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
event | the string id of a specific event to retrieve the last invocation for. | |
outcome | the outcome to filter for. Can be SUCCESS, FAILURE, ERROR. None specified means that the all will be considered |
Example response representations:
{"id":10,"event":"repo:created","duration":155,"start":1513106011,"finish":1513106166,"request":{"method":"POST","url":"http://example.com/callback"},"result":{"description":"200","outcome":"SUCCESS"}}
a webhook invocation dataset.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to get webhook invocations in the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist, or the webhook does not exist in the repository.
parameter | value | description |
---|---|---|
webhookId | id of the webhook |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Get the statistics for a specific webhook.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
parameter | value | description |
---|---|---|
event | the string id of a specific event to retrieve the last invocation for. May be empty, in which case all events are considered |
Example response representations:
{"lastSuccess":{"id":10,"event":"repo:created","duration":155,"start":1513106011,"finish":1513106166,"request":{"method":"POST","url":"http://example.com/callback"},"result":{"description":"200","outcome":"SUCCESS"}},"lastFailure":{"id":11,"event":"repo:refs_updated","duration":100,"start":1513106011,"finish":1513106111,"request":{"method":"POST","url":"http://example.com/callback"},"result":{"description":"404","outcome":"FAILURE"}},"lastError":{"id":12,"event":"repo:modified","duration":100,"start":1513106011,"finish":1513106111,"request":{"method":"POST","url":"http://example.com/callback"},"result":{"description":"Detailed error message","outcome":"ERROR"}},"counts":100}
a webhook invocation dataset.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to get webhook statistics in the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist, or the webhook does not exist in the repository.
parameter | value | description |
---|---|---|
webhookId | id of the webhook |
This API can also be invoked via a user-centric URL when addressing repositories in personal projects.
Get the statistics summary for a specific webhook.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
Example response representations:
{"lastSuccess":{"id":10,"event":"repo:created","duration":155,"start":1513106011,"finish":1513106166,"request":{"method":"POST","url":"http://example.com/callback"},"result":{"description":"200","outcome":"SUCCESS"}},"lastFailure":{"id":11,"event":"repo:refs_updated","duration":100,"start":1513106011,"finish":1513106111,"request":{"method":"POST","url":"http://example.com/callback"},"result":{"description":"404","outcome":"FAILURE"}},"lastError":{"id":12,"event":"repo:modified","duration":100,"start":1513106011,"finish":1513106111,"request":{"method":"POST","url":"http://example.com/callback"},"result":{"description":"Detailed error message","outcome":"ERROR"}},"counts":100}
a webhook invocation dataset.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to get webhook statistics summary in the repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository does not exist, or the webhook does not exist in the repository.
parameter | value | description |
---|---|---|
scmId | the SCM to get strategies for |
Update the pull request merge strategy configuration for this project and SCM.
The authenticated user must have PROJECT_ADMIN permission for the context repository to call this resource.
Only the strategies provided will be enabled, the default must be set and included in the set of strategies.
An explicitly set pull request merge strategy configuration can be deleted by POSTing a document with an empty "mergeConfig" attribute. i.e:
{ "mergeConfig": { } }Upon completion of this request, the effective configuration will be the configuration explicitly set for the SCM, or if no such explicit configuration is set then the default configuration will be used.
Example request representations:
{"mergeConfig":{"defaultStrategy":{"id":"no-ff"},"strategies":[{"id":"no-ff"}]}}
Example response representations:
{"mergeConfig":{"defaultStrategy":{"description":"Always create a merge commit","enabled":true,"flag":"--no-ff","id":"no-ff","name":"Merge commit"},"strategies":[{"description":"Always create a merge commit","enabled":true,"flag":"--no-ff","id":"no-ff","name":"Merge commit"}],"type":"repository"}}
The repository pull request merge strategies for the context repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The repository pull request merge strategies were not updated due to a validation error.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to administrate the specified repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository does not exist.
This is a paged API.
Retrieve the merge strategy configuration for this project and SCM.
The authenticated user must have PROJECT_READ permission for the context repository to call this resource.
Example response representations:
{"mergeConfig":{"defaultStrategy":{"description":"Always create a merge commit","enabled":true,"flag":"--no-ff","id":"no-ff","name":"Merge commit"},"strategies":[{"description":"Always create a merge commit","enabled":true,"flag":"--no-ff","id":"no-ff","name":"Merge commit"}],"type":"repository"}}
The merge configuration of the request project.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to see the request repository.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request repository does not exist.
This is a paged API.
Retrieve a page of repository hooks for this project.
The authenticated user must have PROJECT_READ permission for the specified project to call this resource.
parameter | value | description |
---|---|---|
type | Default: | the optional type to filter by. Valid values are |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"details":{"key":"com.atlassian.stash.plugin.example:example-repository-hook","name":"Example repository hook","type":"PRE_RECEIVE","description":"An example description for an example hook.","version":"1.2.4","configFormKey":null,"scopeTypes":["PROJECT","REPOSITORY"]},"enabled":true,"configured":true,"scope":{"resourceId":2,"type":"REPOSITORY"}}],"start":0}
returns a page of repository hooks with their associated enabled state.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to retrieve the hooks.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified project does not exist.
parameter | value | description |
---|---|---|
hookKey |
Retrieve a repository hook for this project.
The authenticated user must have PROJECT_READ permission for the specified project to call this resource.
Example response representations:
{"details":{"key":"com.atlassian.stash.plugin.example:example-repository-hook","name":"Example repository hook","type":"PRE_RECEIVE","description":"An example description for an example hook.","version":"1.2.4","configFormKey":null,"scopeTypes":["PROJECT","REPOSITORY"]},"enabled":true,"configured":true,"scope":{"resourceId":2,"type":"REPOSITORY"}}
returns the repository hooks with their associated enabled state for the supplied hookKey.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to retrieve the hook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified repository hook does not exist for the given project, or the project does not exist.
parameter | value | description |
---|---|---|
hookKey |
Enable a repository hook for this project and optionally apply new configuration.
The authenticated user must have PROJECT_ADMIN permission for the specified project to call this resource.
A JSON document may be provided to use as the settings for the hook. These structure and validity of the document is decided by the plugin providing the hook.
parameter | value | description |
---|---|---|
Content-Length | Default: 0 |
Example response representations:
{"details":{"key":"com.atlassian.stash.plugin.example:example-repository-hook","name":"Example repository hook","type":"PRE_RECEIVE","description":"An example description for an example hook.","version":"1.2.4","configFormKey":null,"scopeTypes":["PROJECT","REPOSITORY"]},"enabled":true,"configured":true,"scope":{"resourceId":2,"type":"REPOSITORY"}}
returns the repository hooks with their associated enabled state for the supplied hookKey.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The settings specified are invalid.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to enable the hook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified project or hook does not exist.
Disable a repository hook for this project.
The authenticated user must have PROJECT_ADMIN permission for the specified project to call this resource.
Example response representations:
{"details":{"key":"com.atlassian.stash.plugin.example:example-repository-hook","name":"Example repository hook","type":"PRE_RECEIVE","description":"An example description for an example hook.","version":"1.2.4","configFormKey":null,"scopeTypes":["PROJECT","REPOSITORY"]},"enabled":true,"configured":true,"scope":{"resourceId":2,"type":"REPOSITORY"}}
returns the repository hooks with their associated enabled state for the supplied hookKey.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to disable the hook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified project or hook does not exist.
parameter | value | description |
---|---|---|
hookKey |
Retrieve the settings for a repository hook for this project.
The authenticated user must have PROJECT_READ permission for the specified project to call this resource.
Example response representations:
{"string-value":"this is an arbitrary string","integer-value":1,"long-value":2147483648,"boolean-value":true,"double-value":1.1}
The settings for the hook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to retrieve the hook settings.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified project or hook does not exist.
Modify the settings for a repository hook for this project.
The service will reject any settings which are too large, the current limit is 32KB once serialized.
The authenticated user must have PROJECT_ADMIN permission for the specified project to call this resource.
A JSON document can be provided to use as the settings for the hook. These structure and validity of the document is decided by the plugin providing the hook.
Example request representations:
{"string-value":"this is an arbitrary string","integer-value":1,"long-value":2147483648,"boolean-value":true,"double-value":1.1}
Example response representations:
{"string-value":"this is an arbitrary string","integer-value":1,"long-value":2147483648,"boolean-value":true,"double-value":1.1}
The settings for the hook.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The settings specified are invalid.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to modify the hook settings.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified project or hook does not exist.
REST resource for searching through repositories
This is a paged API.
Retrieve a page of repositories based on query parameters that control the search. See the documentation of the
parameters for more details.
This resource is anonymously accessible.
Note on permissions. In absence of the {@code permission} query parameter the implicit 'read' permission is assumed. Please note that this permission is lower than the REPO_READ permission rather than being equal to it. The implicit 'read' permission for a given repository is assigned to any user that has any of the higher permissions, such as REPO_READ, as well as to anonymous users if the repository is marked as public. The important implication of the above is that an anonymous request to this resource with a permission level REPO_READ is guaranteed to receive an empty list of repositories as a result. For anonymous requests it is therefore recommended to not specify the permission parameter at all.
parameter | value | description |
---|---|---|
name | (optional) if specified, this will limit the resulting repository list to ones whose name
matches this parameter's value. The match will be done case-insensitive and any leading
and/or trailing whitespace characters on the | |
projectname | (optional) if specified, this will limit the resulting repository list to ones whose project's
name matches this parameter's value. The match will be done case-insensitive and any leading
and/or trailing whitespace characters on the | |
permission | (optional) if specified, it must be a valid repository permission level name and will limit the resulting repository list to ones that the requesting user has the specified permission level to. If not specified, the default implicit 'read' permission level will be assumed. The currently supported explicit permission values are REPO_READ, REPO_WRITE and REPO_ADMIN. | |
visibility | (optional) if specified, this will limit the resulting repository list based on the repositories visibility. Valid values are public or private. |
Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"slug":"my-repo","id":1,"name":"My repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PRJ","id":1,"name":"My Cool Project","description":"The description for my cool project.","public":true,"type":"NORMAL","links":{"self":[{"href":"http://link/to/project"}]}},"public":true,"links":{"clone":[{"href":"ssh://git@<baseURL>/PRJ/my-repo.git","name":"ssh"},{"href":"https://<baseURL>/scm/PRJ/my-repo.git","name":"http"}],"self":[{"href":"http://link/to/repository"}]}}],"start":0}
A page of repositories.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The visibility
parameter contains an invalid value
Create a new task.
Example request representations:
{"anchor":{"id":1,"type":"COMMENT"},"text":"Fix the missing imports"}
Example response representations:
{"anchor":{"properties":{"key":"value"},"id":1,"version":1,"text":"An insightful comment.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}},"author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792963,"id":99,"permittedOperations":{"deletable":true,"editable":true,"transitionable":true},"text":"Fix the missing imports"}
A copy of the created task.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the task data is invalid (for example, if the task's text is missing or blank)
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the anchor of the task (such as a pull request comment) does not exist or is not visible to the current user
parameter | value | description |
---|---|---|
taskId | the id identifying the task to delete |
Delete a task.
Note that only the task's creator, the context's author or an admin of the context's repository can delete a task. (For a pull request task, those are the task's creator, the pull request's author or an admin on the repository containing the pull request). Additionally a task cannot be deleted if it has already been resolved.
Example response representations:
if the task was successfully deleted.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the current user does not have the permission to delete the task
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the task does not exist
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the task to delete is in the resolved state
Update a existing task.
As of Stash 3.3, only the state and text of a task can be updated.
Updating the state of a task is allowed for any user having READ access to the repository. However only the task's creator, the context's author or an admin of the context's repository can update the task's text. (For a pull request task, those are the task's creator, the pull request's author or an admin on the repository containing the pull request). Additionally the task's text cannot be updated if it has been resolved.
Example request representations:
{"id":99,"text":"Fix the missing and obsolete imports"}
Example response representations:
{"properties":{"diffAnchorPath":"path/to/file.txt"},"anchor":{"properties":{"key":"value"},"id":1,"version":1,"text":"An insightful comment.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}},"author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792963,"id":99,"permittedOperations":{"deletable":true,"editable":true,"transitionable":true},"text":"Fix the missing and deprecated imports","state":"OPEN"}
A copy of the task if it was successfully updated.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the current user does not have the permission to update the task
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the task does not exist
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the task to update is in the resolved state
Retrieve a existing task.
Example response representations:
{"properties":{"diffAnchorPath":"path/to/file.txt"},"anchor":{"properties":{"key":"value"},"id":1,"version":1,"text":"An insightful comment.","author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792949,"updatedDate":1515624792949,"comments":[],"tasks":[],"permittedOperations":{"editable":true,"deletable":true}},"author":{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"},"createdDate":1515624792964,"id":99,"permittedOperations":{"deletable":false,"editable":false,"transitionable":true},"text":"Resolve the merge conflicts","state":"OPEN"}
A copy of the task.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
If the task does not exist
Update the currently authenticated user's details. The update will always be applied to the currently authenticated user.
Example request representations:
{"name":null,"displayName":"Jane Citizen","email":"jane@example.com"}
Example response representations:
{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"}
The updated user.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
Authentication failed or was not attempted.
This is a paged API.
Retrieve a page of users, optionally run through provided filters.
Only authenticated users may call this resource.
Filters are provided in query parameters in a standard name=value
fashion. The following filters are
currently supported:
permission.
. See the
section "Permission Filters" below for more details.
The following three sub-sections list parameters supported for permission filters (where [root]
is
the root permission filter name, e.g. {@code permission}, {@code permission.1} etc.) depending on the
permission resource. The system determines which filter to apply (Global, Project or Repository permission)
based on the [root]
permission value. E.g. {@code ADMIN} is a global permission,
{@code PROJECT_ADMIN} is a project permission and {@code REPO_ADMIN} is a repository permission. Note
that the parameters for a given resource will be looked up in the order as they are listed below, that is e.g.
for a project resource, if both {@code projectId} and {@code projectKey} are provided, the system will
use {@code projectId} for the lookup.
The permission value under [root]
is the only required and recognized parameter, as global
permissions do not apply to a specific resource.
Example valid filter: permission=ADMIN
.
[root]
- specifies the project permission[root].projectId
- specifies the project ID to lookup the project by[root].projectKey
- specifies the project key to lookup the project by
Example valid filter: permission.1=PROJECT_ADMIN&permission.1.projectKey=TEST_PROJECT
.
[root]
- specifies the repository permission[root].projectId
- specifies the repository ID to lookup the repository by[root].projectKey
and [root].repositorySlug
- specifies the project key and
repository slug to lookup the repository by; both values need to be provided for this look up to be
triggeredpermission.2=REPO_ADMIN&permission.2.projectKey=TEST_PROJECT&permission.2.repositorySlug=test_repo
.Example response representations:
{"size":1,"limit":25,"isLastPage":true,"values":[{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"}],"start":0}
A page of users.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The search request was invalid, which may happen for multiple reasons, among others:
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
Authentication failed or was not attempted.
Update the currently authenticated user's password.
Example request representations:
{"password":"secret","passwordConfirm":"secret","oldPassword":"faithless"}
Example response representations:
The user's password was successfully updated.
{"errors":[{"context":"field_a","message":"A detailed validation error message for field_a.","exceptionName":null},{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The request was malformed or the old password was incorrect.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
Authentication failed or was not attempted.
Retrieve the user matching the supplied userSlug.
Example response representations:
{"name":"jcitizen","emailAddress":"jane@example.com","id":101,"displayName":"Jane Citizen","active":true,"slug":"jcitizen","type":"NORMAL"}
The user matching the supplied userSlug. Note, this may not be the user's username, always use the user.slug property.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to view the user.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user does not exist.
Delete the avatar associated to a user.
Users are always allowed to delete their own avatar. To delete someone else's avatar the authenticated user must have global ADMIN permission, or global SYS_ADMIN permission to update a SYS_ADMIN user's avatar.
Example response representations:
{"href":"http://www.gravatar.com/avatar/aa99b351245441b8ca95d54a52d2998c"}
The new avatar URL if the local avatar was successfully deleted or did not exist
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The authenticated user has insufficient permissions to delete the specified avatar.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user does not exist.
Update the avatar for the user with the supplied slug.
This resource accepts POST multipart form data, containing a single image in a form-field named 'avatar'.
There are configurable server limits on both the dimensions (1024x1024 pixels by default) and uploaded file size (1MB by default). Several different image formats are supported, but PNG and JPEG are preferred due to the file size limit.
This resource has Cross-Site Request Forgery (XSRF) protection. To allow the request to
pass the XSRF check the caller needs to send an X-Atlassian-Token
HTTP header with the
value no-check
.
An example curl request to upload an image name 'avatar.png' would be:
curl -X POST -u username:password -H "X-Atlassian-Token: no-check" http://example.com/rest/api/latest/users/jdoe/avatar.png -F avatar=@avatar.png
Users are always allowed to update their own avatar. To update someone else's avatar the authenticated user must have global ADMIN permission, or global SYS_ADMIN permission to update a SYS_ADMIN user's avatar.
Example response representations:
The avatar was uploaded successfully.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user has insufficient permissions to update the avatar.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The specified user does not exist.
Rest resource for retrieving, and updating user settings key/values
Retrieve a map of user setting key values for a specific user identified by the user slug.
Example response representations:
{"string key":"string value","boolean key":true,"long key":10}
The user settings for the specified user slug.
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not a project administrator.
Update the entries of a map of user setting key/values for a specific user identified by the user slug.
Example request representations:
{"string key":"string value","boolean key":true,"long key":10}
Example response representations:
The {@link UserSettings were updated successfully}
{"errors":[{"context":null,"message":"A detailed error message.","exceptionName":null}]}
The currently authenticated user is not a project administrator.