NAME
WebService::BitbucketServer::Core::V1 - Bindings for a Bitbucket Server REST API
VERSION
version 0.600
SYNOPSIS
my $stash = WebService::BitbucketServer->new(
base_url => 'https://stash.example.com/',
username => 'bob',
password => 'secret',
);
my $api = $stash->core;
DESCRIPTION
This is a Bitbucket Server REST API for Core::V1.
Original API documentation created by and copyright Atlassian.
ATTRIBUTES
context
Get the instance of WebService::BitbucketServer passed to "new".
METHODS
new
$api = WebService::BitbucketServer::Core::V1->new(context => $webservice_bitbucketserver_obj);
Create a new API.
Normally you would use $webservice_bitbucketserver_obj->core
instead.
get_dashboard_pull_request_suggestions
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.
GET api/1.0/dashboard/pull-request-suggestions
Parameters:
changesSince
- string, default: 172800restrict 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
- int, default: 3restricts the result set to return at most this many suggestions.
Responses:
200
- page, type: application/jsonA page of pull requests that match the search criteria.
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonThe current user is not authenticated
get_dashboard_pull_requests
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.
GET api/1.0/dashboard/pull-requests
Parameters:
state
- string, default: none(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
- string, default: none(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
- string, default: none(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
- string, default: none(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
- string, default: none(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.
Responses:
200
- page, type: application/jsonA page of pull requests that match the search criteria.
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonThe current user is not authenticated
get_inbox_pull_requests
GET api/1.0/inbox/pull-requests
Parameters:
start
- int, default: nonelimit
- int, default: 25role
- string, default: reviewer
get_inbox_pull_request_count
GET api/1.0/inbox/pull-requests/count
get_cluster_information
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.
GET api/1.0/admin/cluster
Responses:
200
- data, type: application/jsonInformation about the cluster
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the cluster information.
delete_group
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.
DELETE api/1.0/admin/groups
Parameters:
name
- string, default: nonethe name identifying the group to delete
Responses:
200
- detailedGroup, type: application/jsonThe deleted group.
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonThe authenticated user does not have the ADMIN permission.
403
- errors, type: application/jsonThe action was disallowed as the authenticated user has a lower permission level than the group being deleted.
404
- errors, type: application/jsonThe specified group does not exist.
409
- errors, type: application/jsonThe action was disallowed as it would lower the authenticated user's permission level.
create_group
Create a new group.
The authenticated user must have ADMIN permission or higher to call this resource.
POST api/1.0/admin/groups
Parameters:
name
- string, default: noneName of the group.
Responses:
200
- restDetailedGroup, type: application/jsonThe newly created group.
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonThe currently authenticated user is not an administrator.
409
- errors, type: application/jsonA group with this name already exists.
get_groups
Retrieve a page of groups.
The authenticated user must have LICENSED_USER permission or higher to call this resource.
GET api/1.0/admin/groups
Parameters:
filter
- string, default: noneif specified only group names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of groups.
401
- errors, type: application/jsonThe currently authenticated user is not a licensed user.
add_user_to_group
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.
POST api/1.0/admin/groups/add-user
Responses:
200
- data, type: unknownThe user was added to the group
401
- errors, type: application/jsonThe authenticated user does not have the ADMIN permission.
403
- errors, type: application/jsonThe action was disallowed as it would exceed the server's licensing limit, or the groups permissions exceed the authenticated user's permission level.
404
- errors, type: application/jsonThe specified user or group does not exist.
add_users_to_group
Add multiple users to a group.
The authenticated user must have the ADMIN permission to call this resource.
POST api/1.0/admin/groups/add-users
Responses:
200
- data, type: unknown<em>>All</em the users were added to the group
401
- errors, type: application/jsonThe authenticated user does not have the ADMIN permission.
403
- errors, type: application/jsonThe action was disallowed as it would exceed the server's licensing limit, or the group's permissions exceed the authenticated user's permission level.
404
- errors, type: application/jsonThe specified group or users do not exist.
find_users_in_group
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.
GET api/1.0/admin/groups/more-members
Parameters:
context
- string, default: nonethe group which should be used to locate members
filter
- string, default: noneif specified only users with usernames, display names or email addresses containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of users.
401
- errors, type: application/jsonThe currently authenticated user is not a licensed user.
find_users_not_in_group
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.
GET api/1.0/admin/groups/more-non-members
Parameters:
context
- string, default: nonethe group which should be used to locate non-members
filter
- string, default: noneif specified only users with usernames, display names or email addresses containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of users.
401
- errors, type: application/jsonThe currently authenticated user is not a licensed user.
remove_user_from_group
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.
POST api/1.0/admin/groups/remove-user
Responses:
200
- data, type: unknownThe user was removed from the group.
401
- errors, type: application/jsonThe authenticated user does not have the ADMIN permission.
403
- errors, type: application/jsonThe action was disallowed as the group has a higher permission level than the context user.
404
- errors, type: application/jsonThe specified user or group does not exist.
get_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.
GET api/1.0/admin/license
Responses:
200
- license, type: application/jsonThe currently-installed license.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the license, or the request is anonymous.
404
- errors, type: application/jsonNo license has been installed.
update_license
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:
It is for a different product
It is already expired
Otherwise, if the license is updated successfully, details for the new license are returned with a 200 response.
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.
POST api/1.0/admin/license
Responses:
200
- license, type: application/jsonThe newly-installed license.
400
- errors, type: application/jsonNo encoded license was provided in the JSON body for the POST.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to update the license.
409
- errors, type: application/jsonThe 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.
delete_mail_config
Deletes the current mail configuration.
The authenticated user must have the SYS_ADMIN permission to call this resource.
DELETE api/1.0/admin/mail-server
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to delete the mail server configuration.
204
- data, type: application/jsonThe mail configuration was successfully deleted.
get_mail_config
Retrieves the current mail configuration. The authenticated user must have the SYS_ADMIN permission to call this resource.
GET api/1.0/admin/mail-server
Responses:
200
- mailHostConfiguration, type: application/jsonThe mail configuration.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the mail configuration.
404
- data, type: application/jsonThe mail server hasn't been configured
set_mail_config
Updates the mail configuration The authenticated user must have the SYS_ADMIN permission to call this resource.
PUT api/1.0/admin/mail-server
Responses:
200
- mailConfiguration, type: application/jsonThe updated mail configuration.
400
- errors, type: application/jsonThe mail configuration was not updated due to a validation error.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to update the mail configuration.
clear_sender_address
Clears the server email address.
The authenticated user must have the ADMIN permission to call this resource.
DELETE api/1.0/admin/mail-server/sender-address
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to clear the server email address.
204
- data, type: application/jsonThe server email address was successfully cleared.
get_sender_address
Retrieves the server email address
GET api/1.0/admin/mail-server/sender-address
Responses:
200
- server email address, type: application/jsonThe server email address
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the server email address.
404
- data, type: application/jsonThe server email address is not set
set_sender_address
Updates the server email address The authenticated user must have the ADMIN permission to call this resource.
PUT api/1.0/admin/mail-server/sender-address
Responses:
200
- senderAddress, type: application/jsonThe updated server email address.
400
- errors, type: application/jsonThe server email address was not updated due to a validation error.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to update the server email address.
get_groups_with_any_permission
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.
GET api/1.0/admin/permissions/groups
Parameters:
filter
- string, default: noneif specified only group names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of groups and their highest global permissions.
401
- errors, type: application/jsonThe currently authenticated user is not an administrator.
set_permission_for_groups
Promote or demote a user's global permission level. Available global permissions are:
LICENSED_USER
PROJECT_CREATE
ADMIN
SYS_ADMIN
See the Bitbucket Server documentation for a detailed explanation of what each permission entails.
The authenticated user must have:
ADMIN permission or higher; and
the permission they are attempting to grant or higher; and
greater or equal permissions than the current permission level of the group (a user may not demote the permission level of a group with higher permissions than them)
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.
PUT api/1.0/admin/permissions/groups
Parameters:
permission
- string, default: nonethe permission to grant
name
- string, default: nonethe names of the groups
Responses:
400
- errors, type: application/jsonThe request was malformed or the specified permission does not exist.
401
- errors, type: application/jsonThe currently authenticated user is not an administrator or doesn't have the specified permission they are attempting to grant.
204
- data, type: unknownThe specified permission was granted to the specified user.
403
- errors, type: application/jsonThe action was disallowed as it would exceed the server's license limits.
404
- errors, type: application/jsonThe specified group does not exist.
409
- errors, type: application/jsonThe 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.
revoke_permissions_for_group
Revoke all global permissions for a group.
The authenticated user must have:
ADMIN permission or higher; and
greater or equal permissions than the current permission level of the group (a user may not demote the permission level of a group with higher permissions than them)
to call this resource. In addition, a user may not revoke a group's permissions if their own permission level would be reduced as a result.
DELETE api/1.0/admin/permissions/groups
Parameters:
name
- string, default: nonethe name of the group
Responses:
401
- errors, type: application/jsonThe currently authenticated user is not an administrator.
204
- data, type: unknownAll global permissions were revoked from the group.
404
- errors, type: application/jsonThe specified group does not exist.
409
- errors, type: application/jsonThe 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.
get_groups_without_any_permission
Retrieve a page of groups that have no granted global permissions.
The authenticated user must have ADMIN permission or higher to call this resource.
GET api/1.0/admin/permissions/groups/none
Parameters:
filter
- string, default: noneif specified only group names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of groups that have not been granted any global permissions.
401
- errors, type: application/jsonThe currently authenticated user is not an administrator.
revoke_permissions_for_user
Revoke all global permissions for a user.
The authenticated user must have:
ADMIN permission or higher; and
greater or equal permissions than the current permission level of the user (a user may not demote the permission level of a user with higher permissions than them)
to call this resource. In addition, a user may not demote their own permission level.
DELETE api/1.0/admin/permissions/users
Parameters:
name
- string, default: nonethe name of the user
Responses:
401
- errors, type: application/jsonThe currently authenticated user is not an administrator.
204
- data, type: unknownAll global permissions were revoked from the user.
404
- errors, type: application/jsonThe specified user does not exist.
409
- errors, type: application/jsonThe 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.
get_users_with_any_permission
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.
GET api/1.0/admin/permissions/users
Parameters:
filter
- string, default: noneif specified only user names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of users and their highest global permissions.
401
- errors, type: application/jsonThe currently authenticated user is not an administrator.
set_permission_for_users
Promote or demote the global permission level of a user. Available global permissions are:
LICENSED_USER
PROJECT_CREATE
ADMIN
SYS_ADMIN
See the Bitbucket Server documentation for a detailed explanation of what each permission entails.
The authenticated user must have:
ADMIN permission or higher; and
the permission they are attempting to grant; and
greater or equal permissions than the current permission level of the user (a user may not demote the permission level of a user with higher permissions than them)
to call this resource. In addition, a user may not demote their own permission level.
PUT api/1.0/admin/permissions/users
Parameters:
name
- string, default: nonethe names of the users
permission
- string, default: nonethe permission to grant
Responses:
400
- errors, type: application/jsonThe request was malformed or the specified permission does not exist.
401
- errors, type: application/jsonThe currently authenticated user is not an administrator or doesn't have the specified permission they are attempting to grant.
204
- data, type: unknownThe requested permission was granted.
403
- errors, type: application/jsonThe action was disallowed as it would exceed the server's license limits.
404
- errors, type: application/jsonThe specified user does not exist.
409
- errors, type: application/jsonThe 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.
get_users_without_any_permission
Retrieve a page of users that have no granted global permissions.
The authenticated user must have ADMIN permission or higher to call this resource.
GET api/1.0/admin/permissions/users/none
Parameters:
filter
- string, default: noneif specified only user names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of users that have not been granted any global permissions.
401
- errors, type: application/jsonThe currently authenticated user is not an administrator.
get_merge_config
Retrieve the merge strategies available for this instance.
The user must be authenticated to call this resource.
GET api/1.0/admin/pull-requests/{scmId}
Parameters:
scmId
- string, default: nonethe id of the scm to get strategies for
Responses:
200
- page, type: application/jsonThe merge configuration of this instance.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to see the request repository.
404
- errors, type: application/jsonThe request repository does not exist.
set_merge_config
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.
POST api/1.0/admin/pull-requests/{scmId}
Parameters:
scmId
- string, default: nonethe id of the scm to get strategies for
Responses:
200
- strategies, type: application/jsonThe repository pull request merge strategies for the context repository.
400
- errors, type: application/jsonThe repository pull request merge strategies were not updated due to a validation error.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to administrate the specified repository.
404
- errors, type: application/jsonThe specified repository does not exist.
create_user
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.
POST api/1.0/admin/users
Parameters:
name
- string, default: nonethe username for the new user
password
- string, default: nonethe password for the new user
displayName
- string, default: nonethe display name for the new user
emailAddress
- string, default: nonethe e-mail address for the new user
addToDefaultGroup
- boolean, default: truetrue
to add the user to the default group, which can be used to grant them a set of initial permissions; otherwise,false
to not add them to a groupnotify
- string, default: noneif present and not
false
instead of requiring a password, the create user will be notified via email their account has been created and requires a password to be reset. This option can only be used if a mail server has been configured
Responses:
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonThe authenticated user is not an administrator.
204
- data, type: unknownThe user was successfully created.
403
- errors, type: application/jsonAdding the user to the default group would exceed the server's license limit.
409
- errors, type: application/jsonAnother user with the same name already exists.
delete_user
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.
DELETE api/1.0/admin/users
Parameters:
name
- string, default: nonethe username identifying the user to delete
Responses:
200
- detailedUser, type: application/jsonThe deleted user.
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonThe authenticated user does not have the ADMIN permission.
403
- errors, type: application/jsonThe action was disallowed as the authenticated user has a lower permission level than the user being deleted.
404
- errors, type: application/jsonThe specified user does not exist.
409
- errors, type: application/jsonThe action was disallowed as a user can not delete themselves.
update_user_details
Update a user's details.
The authenticated user must have the ADMIN permission to call this resource.
PUT api/1.0/admin/users
Responses:
200
- detailedUser, type: application/jsonThe updated user.
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonThe authenticated user does not have the ADMIN permission or has a lower permission level than the user being deleted.
404
- errors, type: application/jsonThe specified user does not exist.
get_users
Retrieve a page of users.
The authenticated user must have the LICENSED_USER permission to call this resource.
GET api/1.0/admin/users
Parameters:
filter
- string, default: noneif specified only users with usernames, display name or email addresses containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of users.
401
- errors, type: application/jsonThe currently authenticated user is not a licensed user.
add_group_to_user
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.
POST api/1.0/admin/users/add-group
Responses:
200
- data, type: unknownThe user was added to the group
401
- errors, type: application/jsonThe authenticated user does not have the ADMIN permission.
403
- errors, type: application/jsonThe action was disallowed as it would exceed the server's licensing limit, or the groups permissions exceed the authenticated user's permission level.
404
- errors, type: application/jsonThe specified user or group does not exist.
add_user_to_groups
Add a user to one or more groups.
The authenticated user must have the ADMIN permission to call this resource.
POST api/1.0/admin/users/add-groups
Responses:
200
- data, type: unknownThe user was added to all the groups
401
- errors, type: application/jsonThe authenticated user does not have the ADMIN permission.
403
- errors, type: application/jsonThe action was disallowed as it would exceed the server's licensing limit, or the groups permissions exceed the authenticated user's permission level.
404
- errors, type: application/jsonThe specified user or groups do not exist.
clear_user_captcha_challenge
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.
DELETE api/1.0/admin/users/captcha
Parameters:
name
- string, default: none
Responses:
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonThe authenticated user does not have the ADMIN permission.
204
- data, type: application/jsonThe CAPTCHA was successfully cleared.
403
- errors, type: application/jsonThe action was disallowed as the authenticated user has a lower permission level than the group being deleted.
404
- errors, type: application/jsonThe specified user does not exist.
update_user_password
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.
PUT api/1.0/admin/users/credentials
Responses:
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonThe authenticated user does not have the ADMIN permission or has a lower permission level than the user being deleted.
204
- data, type: unknownThe user's password was successfully updated.
404
- errors, type: application/jsonThe specified user does not exist.
find_groups_for_user
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.
GET api/1.0/admin/users/more-members
Parameters:
context
- string, default: nonethe user which should be used to locate groups
filter
- string, default: noneif specified only groups with names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of groups.
401
- errors, type: application/jsonThe currently authenticated user is not a licensed user.
find_other_groups_for_user
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.
GET api/1.0/admin/users/more-non-members
Parameters:
context
- string, default: nonethe user which should be used to locate groups
filter
- string, default: noneif specified only groups with names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of groups.
401
- errors, type: application/jsonThe currently authenticated user is not a licensed user.
remove_group_from_user
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.
POST api/1.0/admin/users/remove-group
Responses:
200
- data, type: unknownThe user was removed from the group.
401
- errors, type: application/jsonThe authenticated user does not have the ADMIN permission.
403
- errors, type: application/jsonThe action was disallowed as the group has a higher permission level than the context user.
404
- errors, type: application/jsonThe specified user or group does not exist.
rename_user
Rename a user.
The authenticated user must have the ADMIN permission to call this resource.
POST api/1.0/admin/users/rename
Responses:
200
- detailedUser, type: application/jsonThe renamed user.
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonThe authenticated user does not have the ADMIN permission or has a lower permission level than the user being deleted.
404
- errors, type: application/jsonThe specified user does not exist.
get_application_properties
Retrieve version information and other application properties.
No authentication is required to call this resource.
GET api/1.0/application-properties
Responses:
200
- applicationProperties, type: application/jsonThe application properties.
get_group_names
Retrieve a page of group names.
The authenticated user must have PROJECT_ADMIN permission or higher to call this resource.
GET api/1.0/groups
Parameters:
filter
- string, default: noneif specified only group names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of group names.
401
- errors, type: application/jsonThe currently authenticated user is not a project administrator.
get_avatar
Retrieve the avatar for the project matching the supplied moduleKey.
GET api/1.0/hooks/{hookKey}/avatar
Parameters:
hookKey
- string, default: nonethe complete module key of the hook module
version
- string, default: noneoptional 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.
Responses:
200
- data, type: image/pngThe avatar of the project matching the supplied projectKey.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the project.
404
- errors, type: application/jsonThe specified project does not exist.
get_level
Retrieve the current log level for a given logger.
The authenticated user must have ADMIN permission or higher to call this resource.
GET api/1.0/logs/logger/{loggerName}
Parameters:
loggerName
- string, default: nonethe name of the logger.
Responses:
200
- logLevel, type: application/jsonThe log level of the logger.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the log level.
set_level
Set the current log level for a given logger.
The authenticated user must have ADMIN permission or higher to call this resource.
PUT api/1.0/logs/logger/{loggerName}/{levelName}
Parameters:
levelName
- string, default: nonethe level to set the logger to. Either TRACE, DEBUG, INFO, WARN or ERROR
loggerName
- string, default: nonethe name of the logger.
Responses:
400
- errors, type: application/jsonThe log level was invalid.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to set the log level.
204
- data, type: application/jsonThe log level was successfully changed.
get_root_level
Retrieve the current log level for the root logger.
The authenticated user must have ADMIN permission or higher to call this resource.
GET api/1.0/logs/rootLogger
Responses:
200
- logLevel, type: application/jsonThe log level of the logger.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the log level.
set_root_level
Set the current log level for the root logger.
The authenticated user must have ADMIN permission or higher to call this resource.
PUT api/1.0/logs/rootLogger/{levelName}
Parameters:
levelName
- string, default: nonethe level to set the logger to. Either TRACE, DEBUG, INFO, WARN or ERROR
Responses:
400
- errors, type: application/jsonThe log level was invalid.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the log level.
204
- data, type: application/jsonThe log level was successfully changed.
preview
Preview the generated html for given markdown contents.
Only authenticated users may call this resource.
POST api/1.0/markup/preview
Parameters:
urlMode
- string, default: none(Optional) The UrlMode used when building the url. One of: ABSOLUTE, RELATIVE and CONFIGURED By default this is RELATIVE.
hardwrap
- boolean, default: none(Optional) Whether the markup implementation should convert newlines to breaks. By default this is false which reflects the standard markdown specification.
htmlEscape
- boolean, default: none(Optional) true if HTML should be escaped in the input markup, false otherwise.
Responses:
200
- markup, type: application/jsonThe rendered markdown.
400
- errors, type: application/jsonThe markdown was invalid.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions preview rendered markdown.
get_repositories_recently_accessed
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.
GET api/1.0/profile/recent/repos
Parameters:
permission
- string, default: none(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
REPO_READ
permission level will be assumed.
Responses:
200
- page, type: application/jsonA page of recently accessed repositories.
400
- errors, type: application/jsonThe permission level is unknown or not related to repository.
401
- errors, type: application/jsonThe request is unauthenticated.
get_projects
Retrieve a page of projects.
Only projects for which the authenticated user has the PROJECT_VIEW permission will be returned.
GET api/1.0/projects
Parameters:
name
- string, default: nonepermission
- string, default: none
Responses:
200
- page, type: application/jsonA page of projects.
400
- errors, type: application/jsonThe permission level is unknown or not related to projects.
create_project
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.
POST api/1.0/projects
Responses:
201
- project, type: application/jsonThe newly created project.
400
- errors, type: application/jsonThe project was not created due to a validation error.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to create a project.
409
- errors, type: application/jsonThe project key or name is already in use.
delete_project
Delete the project matching the supplied projectKey.
The authenticated user must have PROJECT_ADMIN permission for the specified project to call this resource.
DELETE api/1.0/projects/{projectKey}
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to delete the project.
204
- data, type: unknownThe project matching the supplied projectKey was deleted.
404
- errors, type: application/jsonThe specified project does not exist.
409
- errors, type: application/jsonThe project can not be deleted as it contains repositories.
update_project
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.
PUT api/1.0/projects/{projectKey}
Responses:
200
- project, type: application/jsonThe updated project. The project's key was not updated.
201
- project, type: application/jsonThe updated project. The project's key was updated.
400
- errors, type: application/jsonThe project was not updated due to a validation error.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to update the project.
404
- errors, type: application/jsonThe specified project does not exist.
get_project
Retrieve the project matching the supplied projectKey.
The authenticated user must have PROJECT_VIEW permission for the specified project to call this resource.
GET api/1.0/projects/{projectKey}
Responses:
200
- project, type: application/jsonThe project matching the supplied projectKey.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the project.
404
- errors, type: application/jsonThe specified project does not exist.
upload_project_avatar
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.
POST api/1.0/projects/{projectKey}/avatar.png
Responses:
201
- data, type: unknownThe avatar was uploaded successfully.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to update the project.
404
- errors, type: application/jsonThe specified project does not exist.
get_project_avatar
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.
GET api/1.0/projects/{projectKey}/avatar.png
Parameters:
s
- int, default: noneThe desired size of the image. The server will return an image as close as possible to the specified size.
Responses:
200
- data, type: image/pngThe avatar of the project matching the supplied projectKey.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the project.
404
- errors, type: application/jsonThe specified project does not exist.
get_groups_with_any_project_permission
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.
GET api/1.0/projects/{projectKey}/permissions/groups
Parameters:
filter
- string, default: noneif specified only group names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of groups and their highest permissions for the specified project.
401
- data, type: unknownThe currently authenticated user is not a project administrator for the specified project.
404
- data, type: unknownThe specified project does not exist.
set_project_permission_for_groups
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.
PUT api/1.0/projects/{projectKey}/permissions/groups
Parameters:
permission
- string, default: noneThe 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:
PROJECT_READ
PROJECT_WRITE
PROJECT_ADMIN
name
- string, default: nonethe names of the groups
Responses:
400
- errors, type: application/jsonThe request was malformed or the specified permission does not exist.
401
- data, type: unknownThe currently authenticated user is not an administrator for the specified project.
204
- data, type: unknownThe requested permission was granted.
403
- data, type: unknownThe action was disallowed as it would reduce the currently authenticated user's permission level.
404
- data, type: unknownThe specified project or group does not exist.
revoke_project_permissions_for_group
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.
DELETE api/1.0/projects/{projectKey}/permissions/groups
Parameters:
name
- string, default: nonethe name of the group
Responses:
401
- data, type: unknownThe currently authenticated user is not an administrator of the specified project.
204
- data, type: unknownAll project permissions were revoked from the group for the specified project.
404
- data, type: unknownThe specified project or group does not exist.
409
- data, type: unknownThe action was disallowed as it would reduce the currently authenticated user's permission level.
get_groups_without_any_project_permission
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.
GET api/1.0/projects/{projectKey}/permissions/groups/none
Parameters:
filter
- string, default: noneif specified only group names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of groups that have not been granted any permissions for the specified project.
401
- data, type: unknownThe currently authenticated user is not a project administrator for the specified project.
404
- data, type: unknownThe specified project does not exist.
revoke_project_permissions_for_user
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.
DELETE api/1.0/projects/{projectKey}/permissions/users
Parameters:
name
- string, default: nonethe name of the user
Responses:
401
- data, type: unknownThe currently authenticated user is not an administrator of the specified project.
204
- data, type: unknownAll project permissions were revoked from the user for the specified project.
404
- data, type: unknownThe specified project or group does not exist.
409
- data, type: unknownThe action was disallowed as it would reduce the currently authenticated user's permission level.
get_users_with_any_project_permission
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.
GET api/1.0/projects/{projectKey}/permissions/users
Parameters:
filter
- string, default: noneif specified only group names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of users and their highest permissions for the specified project.
401
- data, type: unknownThe currently authenticated user is not a project administrator for the specified project.
404
- data, type: unknownThe specified project does not exist.
set_project_permission_for_users
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.
PUT api/1.0/projects/{projectKey}/permissions/users
Parameters:
name
- string, default: nonethe names of the users
permission
- string, default: nonethe 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:
PROJECT_READ
PROJECT_WRITE
PROJECT_ADMIN
Responses:
400
- data, type: unknownThe request was malformed or the specified permission does not exist.
401
- data, type: unknownThe currently authenticated user is not an administrator for the specified project.
204
- data, type: unknownThe requested permission was granted.
403
- data, type: unknownThe action was disallowed as it would reduce the currently authenticated user's permission level.
404
- data, type: unknownThe specified project or user does not exist.
get_users_without_project_permission
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.
GET api/1.0/projects/{projectKey}/permissions/users/none
Parameters:
filter
- string, default: noneif specified only group names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of users that have not been granted any permissions for the specified project.
401
- data, type: unknownThe currently authenticated user is not a project administrator for the specified project.
404
- data, type: unknownThe specified project does not exist.
has_all_user_project_permission
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.
GET api/1.0/projects/{projectKey}/permissions/{permission}/all
Parameters:
permission
- string, default: nonethe permission to grant Available project permissions are:
PROJECT_READ
PROJECT_WRITE
PROJECT_ADMIN
Responses:
200
- permitted, type: application/jsonA simple entity indicating whether the specified permission is the default permission for this project.
400
- data, type: unknownThe request was malformed or the specified permission does not exist.
401
- data, type: unknownThe currently authenticated user is not an administrator of the specified project.
404
- data, type: unknownThe specified project does not exist.
modify_all_user_project_permission
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.
POST api/1.0/projects/{projectKey}/permissions/{permission}/all
Parameters:
permission
- string, default: nonethe permission to grant Available project permissions are:
PROJECT_READ
PROJECT_WRITE
PROJECT_ADMIN
allow
- boolean, default: nonetrue to grant the specified permission to all users, or false to revoke it
Responses:
400
- data, type: unknownThe request was malformed or the specified permission does not exist.
401
- data, type: unknownThe currently authenticated user is not an administrator of the specified project.
204
- data, type: unknownThe requested permission was successfully granted or revoked.
404
- data, type: unknownThe specified project does not exist.
get_repositories
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.
GET api/1.0/projects/{projectKey}/repos
Parameters:
projectKey
- string, default: nonethe parent project key
Responses:
200
- page, type: application/jsonThe repositories matching the supplied projectKey.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to see the specified project.
404
- errors, type: application/jsonThe specified project does not exist.
create_repository
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.
POST api/1.0/projects/{projectKey}/repos
Parameters:
projectKey
- string, default: nonethe parent project key
Responses:
201
- repository, type: application/jsonThe newly created repository.
400
- errors, type: application/jsonThe repository was not created due to a validation error.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to create a repository.
409
- errors, type: application/jsonA repository with same name already exists.
delete_repository
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.
DELETE api/1.0/projects/{projectKey}/repos/{repositorySlug}
Parameters:
projectKey
- string, default: nonethe parent project key
projectKey
- string, default: nonethe parent project key
repositorySlug
- string, default: nonethe repository slug
Responses:
202
- message, type: application/jsonThe repository has been scheduled for deletion.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to delete the repository.
204
- data, type: unknownNo repository matching the supplied projectKey and repositorySlug was found.
fork_repository
Create a new repository forked from an existing repository.
The JSON body for this POST
is not required to contain any properties. Even the name may be omitted. The following properties will be used, if provided:
"name":"Fork name"
- Specifies the forked repository's nameDefaults to the name of the origin repository if not specified
"project":{"key":"TARGET_KEY"
} - Specifies the forked repository's target project by keyDefaults to the current user's personal project if not specified
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.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}
Parameters:
projectKey
- string, default: nonethe parent project key
projectKey
- string, default: nonethe parent project key
repositorySlug
- string, default: nonethe repository slug
Responses:
201
- repository, type: application/jsonThe newly created fork.
400
- errors, type: application/jsonA 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.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to create a fork.
404
- errors, type: application/jsonThe specified repository does not exist, or, if a target project was specified, the target project does not exist.
get_repository
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}
Parameters:
projectKey
- string, default: nonethe parent project key
projectKey
- string, default: nonethe parent project key
repositorySlug
- string, default: nonethe repository slug
Responses:
200
- repository, type: application/jsonThe repository which matches the supplied projectKey and repositorySlug.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to see the specified repository.
404
- errors, type: application/jsonThe specified repository does not exist.
update_repository
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: {"project":{"key":"NEW_KEY"
}} .
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
PUT api/1.0/projects/{projectKey}/repos/{repositorySlug}
Parameters:
projectKey
- string, default: nonethe parent project key
projectKey
- string, default: nonethe parent project key
repositorySlug
- string, default: nonethe repository slug
Responses:
201
- repository, type: application/jsonThe updated repository.
400
- errors, type: application/jsonThe repository was not updated due to a validation error.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to update a repository
404
- errors, type: application/jsonThe specified repository does not exist.
409
- errors, type: application/jsonA repository with same name as the target already exists
get_archive
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:
No
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.tarIf the branch or tag is qualified (e.g.
refs/heads/master
, the short name (master
) will be included in the filenameIf the branch or tag's short name includes slashes (e.g.
release/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
ortgz
: A GZip-compressed tarball
The contents of the archive may be filtered by using the path=
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/archive
Parameters:
at
- string, default: nonethe commit to stream an archive of; if not supplied, an archive of the default branch is streamed
filename
- string, default: nonea filename to include the "Content-Disposition" header
format
- string, default: nonethe format to stream the archive in; must be one of: zip, tar, tar.gz or tgz
path
- string, default: nonepaths to include in the streamed archive; may be repeated to include multiple paths
prefix
- string, default: nonea prefix to apply to all entries in the streamed archive; if the supplied prefix does not end with a trailing
/
, one will be added automatically
Responses:
200
- archive, type: application/octet-stream; application/x-tarAn archive or the requested commit, in zip, tar or gzipped-tar format.
400
- errors, type: application/jsonThe requested
format
is not supported.401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the repository.
404
- errors, type: application/jsonThe repository does not exist or does not contain the
at
commit.
get_branches
Retrieve the branches matching the supplied filterText param.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/branches
Parameters:
base
- string, default: nonebase branch or tag to compare each branch to (for the metadata providers that uses that information)
details
- boolean, default: nonewhether to retrieve plugin-provided metadata about each branch
filterText
- string, default: nonethe text to match on
orderBy
- string, default: noneordering of refs either ALPHABETICAL (by name) or MODIFICATION (last updated)
Responses:
200
- page, type: application/jsonThe branches matching the supplied filterText.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to read the repository.
404
- errors, type: application/jsonThe specified repository does not exist.
create_branch
Creates a branch using the information provided in the request
The authenticated user must have REPO_WRITE permission for the context repository to call this resource.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/branches
Responses:
200
- branch, type: application/jsonThe created branch
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to write to the repository.
404
- errors, type: application/jsonThe specified repository does not exist.
set_default_branch
Update the default branch of a repository.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
PUT api/1.0/projects/{projectKey}/repos/{repositorySlug}/branches/default
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to update the repository
204
- data, type: unknownThe operation was successful
404
- errors, type: application/jsonThe specified repository does not exist.
get_default_branch
Get the default branch of the repository.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/branches/default
Responses:
200
- page, type: application/jsonThe branches matching the supplied filterText.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to read the repository.
404
- errors, type: application/jsonThe specified repository does not exist or the repository has no default branch configured.
edit_file
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
branch: the branch on which the
path
should be modified or createdcontent: the full content of the file at
path
message: the message associated with this change, to be used as the commit message. Or null if the default message should be used.
sourceCommitId: the commit ID of the file before it was edited, used to identify if content has changed. Or null if this is a new file
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.
PUT api/1.0/projects/{projectKey}/repos/{repositorySlug}/browse/{path:.*}
Parameters:
path
- string, default: nonethe file path to retrieve content from
Responses:
200
- data, type: application/jsonThe newly created commit
400
- errors, type: application/jsonThe branch or content parameters were not supplied.
401
- errors, type: application/jsonThe currently authenticated user does not have write permission for the given repository
404
- errors, type: application/jsonThe repository does not exist.
409
- errors, type: application/jsonThe 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
get_file
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/browse/{path:.*}
Parameters:
path
- string, default: nonethe file path to retrieve content from
at
- string, default: nonethe commit ID or ref to retrieve the content for.
type
- boolean, default: falseif true only the type will be returned for the file path instead of the contents.
blame
- string, default: noneif present the blame will be returned for the file as well.
noContent
- string, default: noneif present and used with blame only the blame is retrieved instead of the contents.
Responses:
200
- page, type: application/jsonA page of contents from a file.
400
- errors, type: application/jsonThe path or until parameters were not supplied.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the repository.
404
- errors, type: application/jsonThe repository does not exist.
get_repository_changes
Retrieve a page of changes made in a specified commit.
Note: The implementation will apply a hard cap (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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/changes
Parameters:
since
- string, default: nonethe commit to which
until
should be compared to produce a page of changes. If not specified the commit's first parent is assumed (if one exists)until
- string, default: nonethe commit to retrieve changes for
Responses:
200
- page, type: application/jsonA page of changes
400
- errors, type: application/jsonThe until parameter was not supplied
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the repository.
404
- errors, type: application/jsonThe repository or the since or until parameters supplied does not exist.
get_repository_commits
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits
Parameters:
followRenames
- boolean, default: falseif
true
, the commit history of the specified file will be followed past renames. Only valid for a path to a single file.ignoreMissing
- boolean, default: falsetrue
to ignore missing commits,false
otherwisemerges
- string, default: noneif present, controls how merge commits should be filtered. Can be either
exclude
, to exclude merge commits,include
, to include both merge commits and non-merge commits oronly
, to only return merge commits.path
- string, default: nonean optional path to filter commits by
since
- string, default: nonethe commit ID or ref (exclusively) to retrieve commits after
until
- string, default: nonethe commit ID (SHA1) or ref (inclusively) to retrieve commits before
withCounts
- boolean, default: falseoptionally include the total number of commits and total number of unique authors
Responses:
200
- page, type: application/jsonA page of commits.
400
- errors, type: application/jsonOne of the supplied commit IDs or refs was invalid.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the repository.
404
- errors, type: application/jsonThe repository does not exist.
get_commit
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}
Parameters:
commitId
- string, default: nonethe commit ID to retrieve
path
- string, default: nonean 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.
Responses:
200
- commit, type: application/jsonA commit.
400
- errors, type: application/jsonThe supplied commit ID was invalid.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the repository.
404
- errors, type: application/jsonThe repository does not exist.
get_commit_changes
Retrieve a page of changes made in a specified commit.
Note: The implementation will apply a hard cap (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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/changes
Parameters:
commitId
- string, default: nonethe commit to retrieve changes for
since
- string, default: nonethe commit to which
until
should be compared to produce a page of changes. If not specified the commit's first parent is assumed (if one exists)withComments
- boolean, default: truetrue
to apply comment counts in the changes (the default); otherwise,false
to stream changes without comment counts
Responses:
200
- page, type: application/jsonA page of changes
400
- errors, type: application/jsonThe until parameter was not supplied
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the repository.
404
- errors, type: application/jsonThe repository or the since or until parameters supplied does not exist.
create_commit_comment
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:
{
"parent" : {
"id" : 1
},
"text" : "A measured reply."
}
General file comment:
{
"anchor" : {
"diffType" : "COMMIT",
"fromHash" : "6df3858eeb9a53a911cd17e66a9174d44ffb02cd",
"path" : "path/to/file",
"srcPath" : "path/to/file",
"toHash" : "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b"
},
"text" : "An insightful general comment on a file."
}
File line comment:
{
"anchor" : {
"diffType" : "COMMIT",
"fileType" : "FROM",
"fromHash" : "6df3858eeb9a53a911cd17e66a9174d44ffb02cd",
"line" : 1,
"lineType" : "CONTEXT",
"path" : "path/to/file",
"srcPath" : "path/to/file",
"toHash" : "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b"
},
"text" : "A pithy comment on a particular line within a file."
}
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:
'ADDED' - for an added line;
'REMOVED' - for a removed line; or
'CONTEXT' - for a line that was unmodified but is in the vicinity of the diff.
'fileType' refers to the file of the diff to which the anchor should be attached - which is of relevance when displaying the diff in a side-by-side way. Currently the supported values are:
'FROM' - the source file of the diff
'TO' - the destination file of the diff
If the current user is not a participant the user is added as one and updated to watch the commit.
The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments
Parameters:
commitId
- string, default: nonethe commit to which the comments must be anchored
since
- string, default: noneFor a merge commit, a parent can be provided to specify which diff the comments should be on. For a commit range, a
sinceId
can be provided to specify where the comments should be anchored from.
Responses:
201
- comment, type: application/jsonThe newly created comment.
400
- errors, type: application/jsonThe comment was not created due to a validation error.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the commit, create a comment or watch the commit.
404
- errors, type: application/jsonUnable to find the supplied project, repository, commit or parent comment. The missing entity will be specified in the error details.
get_commit_comments
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 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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments
Parameters:
commitId
- string, default: nonethe commit to which the comments must be anchored
path
- string, default: nonethe path to the file on which comments were made
since
- string, default: noneFor a merge commit, a parent can be provided to specify which diff the comments are on. For a commit range, a
sinceId
can be provided to specify where the comments are anchored from.
Responses:
200
- page, type: application/jsonA page of comments that match the search criteria
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the comment
404
- errors, type: application/jsonUnable to find the supplied project, repository, or commit. The missing entity will be specified in the error details.
update_commit_comment
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.
PUT api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}
Parameters:
commitId
- string, default: nonethe commit to which the comments must be anchored
commentId
- long, default: nonethe ID of the comment to retrieve
commitId
- string, default: nonethe full ID of the commit within the repository
Responses:
201
- comment, type: application/jsonThe newly updated comment.
400
- errors, type: application/jsonThe comment was not updated due to a validation error.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the commit, update the comment or watch the commit.
404
- errors, type: application/jsonUnable to find the supplied project, repository, commit or comment. The missing entity will be specified in the error details.
409
- errors, type: application/jsonThe comment version supplied does not match the current version.
delete_commit_comment
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.
DELETE api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}
Parameters:
commitId
- string, default: nonethe commit to which the comments must be anchored
commentId
- long, default: nonethe ID of the comment to retrieve
commitId
- string, default: nonethe full ID of the commit within the repository
version
- int, default: -1The 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.
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to delete the comment.
204
- data, type: unknownThe operation was successful
404
- errors, type: application/jsonUnable to find the supplied project, repository or commit. The missing entity will be specified in the error details.
409
- errors, type: application/jsonThe comment has replies or the version supplied does not match the comment's current version.
get_commit_comment
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}
Parameters:
commitId
- string, default: nonethe commit to which the comments must be anchored
commentId
- long, default: nonethe ID of the comment to retrieve
commitId
- string, default: nonethe full ID of the commit within the repository
Responses:
200
- comment, type: application/jsonThe requested comment.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the comment
404
- errors, type: application/jsonUnable to find the supplied project, repository, commit or comment. The missing entity will be specified in the error details.
stream_commit_diff
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 truncated
flags will be set to true
on the "segments"
, "hunks"
and "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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diff/{path:.*}
Parameters:
commitId
- string, default: nonepath
- string, default: nonethe path to the file which should be diffed (optional)
commitId
- string, default: noneautoSrcPath
- boolean, default: falsetrue
to automatically try to find the source path when it's not provided,false
otherwise. Requires thepath
to be provided.contextLines
- int, default: -1the number of context lines to include around added/removed lines in the diff
since
- string, default: nonethe base revision to diff from. If omitted the parent revision of the until revision is used
srcPath
- string, default: nonethe source path for the file, if it was copied, moved or renamed
whitespace
- string, default: noneoptional whitespace flag which can be set to
ignore-all
withComments
- boolean, default: truetrue
to embed comments in the diff (the default); otherwisefalse
to stream the diff without comments
Responses:
200
- diff, type: application/jsonA diff between two revisions.
400
- errors, type: application/jsonThe until parameter was not supplied.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the repository.
404
- errors, type: application/jsonThe repository does not exist.
unwatch_commit
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.
DELETE api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watch
Parameters:
commitId
- string, default: nonethe full ID of the commit within the repository
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the pull request.
204
- data, type: unknownThe user is no longer watching the commit.
404
- errors, type: application/jsonThe specified project, repository or commit does not exist.
watch_commit
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.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watch
Parameters:
commitId
- string, default: nonethe full ID of the commit within the repository
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the pull request.
204
- data, type: unknownThe user is now watching the commit.
404
- errors, type: application/jsonThe specified project, repository or commit does not exist.
stream_changes
Gets the file changes available in the from
commit but not in the to
commit.
If either the from
or to
commit are not specified, they will be replaced by the default branch of their containing repository.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/compare/changes
Parameters:
from
- string, default: nonethe source commit (can be a partial/full commit ID or qualified/unqualified ref name)
to
- string, default: nonethe target commit (can be a partial/full commit ID or qualified/unqualified ref name)
fromRepo
- string, default: nonean 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
Responses:
200
- page, type: application/jsonA page of changes.
404
- errors, type: application/jsonThe source or target commit does not exist.
stream_commits
Gets the commits accessible from the from
commit but not in the to
commit.
If either the from
or to
commit are not specified, they will be replaced by the default branch of their containing repository.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/compare/commits
Parameters:
from
- string, default: nonethe source commit (can be a partial/full commit ID or qualified/unqualified ref name)
to
- string, default: nonethe target commit (can be a partial/full commit ID or qualified/unqualified ref name)
fromRepo
- string, default: nonean 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
Responses:
200
- page, type: application/jsonA page of commits.
404
- errors, type: application/jsonThe source or target commit does not exist.
stream_diff
Gets a diff of the changes available in the from
commit but not in the to
commit.
If either the from
or to
commit are not specified, they will be replaced by the default branch of their containing repository.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/compare/diff{path:.*}
Parameters:
path
- string, default: nonethe path to the file to diff (optional)
from
- string, default: nonethe source commit (can be a partial/full commit ID or qualified/unqualified ref name)
to
- string, default: nonethe target commit (can be a partial/full commit ID or qualified/unqualified ref name)
fromRepo
- string, default: nonean 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
- string, default: nonecontextLines
- int, default: -1an optional number of context lines to include around each added or removed lines in the diff
whitespace
- string, default: nonean optional whitespace flag which can be set to
ignore-all
Responses:
200
- page, type: application/jsonThe diff of the changes.
404
- errors, type: application/jsonThe source or target commit does not exist.
stream_repository_diff
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/diff/{path:.*}
Parameters:
path
- string, default: nonethe path to the file which should be diffed (required)
contextLines
- int, default: -1the number of context lines to include around added/removed lines in the diff
since
- string, default: nonethe base revision to diff from. If omitted the parent revision of the until revision is used
srcPath
- string, default: nonethe source path for the file, if it was copied, moved or renamed
until
- string, default: nonethe target revision to diff to (required)
whitespace
- string, default: noneoptional whitespace flag which can be set to
ignore-all
Responses:
200
- diff, type: application/jsonA diff of a file path.
400
- errors, type: application/jsonThe path or until parameters were not supplied.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the repository.
404
- errors, type: application/jsonThe repository does not exist.
get_repository_files
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/files/{path:.*}
Parameters:
path
- string, default: nonethe directory to list files for.
at
- string, default: nonethe 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.
Responses:
200
- page, type: application/jsonA page of files.
400
- errors, type: application/jsonThe path requested is not a directory at the supplied commit.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the repository.
404
- errors, type: application/jsonThe path requested does not exist at the supplied commit.
get_forked_repositories
Retrieve repositories which have been forked from this one. Unlike 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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/forks
Parameters:
projectKey
- string, default: nonethe parent project key
Responses:
200
- page, type: application/jsonA page of repositories related to the request repository.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to see the request repository.
404
- errors, type: application/jsonThe request repository does not exist.
stream_last_modified
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/last-modified/{path:.*}
Parameters:
path
- string, default: nonethe path within the repository whose files should be streamed
at
- string, default: nonethe commit to use as the starting point when listing files and calculating modifications
Responses:
200
- modifications, type: application/jsonA map of files to the last commit that modified them, and the latest commit to update the requested path.
400
- errors, type: application/jsonNo
at
commit was specified. When streaming modifications, an explicit starting commit must be supplied.401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the repository.
404
- errors, type: application/jsonThe repository does not exist or does not contain the
at
commit, or theat
commit does not contain the requested path.
get_repository_participants
Retrieve a page of participant users for all the pull requests to or from the specified repository.
Optionally clients can specify following filters.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/participants
Parameters:
direction
- string, default: incoming(optional, defaults to INCOMING) the direction relative to the specified repository. Either INCOMING or OUTGOING.
filter
- string, default: none(optional) return only users, whose username, name or email address contain the
filter
valuerole
- string, default: none(optional) The role associated with the pull request participant. This must be one of
AUTHOR
,REVIEWER
, orPARTICIPANT
Responses:
200
- page, type: application/jsonA page of users that match the search criteria.
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the specified repository.
404
- errors, type: application/jsonThe specified repository does not exist.
set_repository_permission_for_group
Promote or demote a group's permission level for the specified repository. Available repository permissions are:
REPO_READ
REPO_WRITE
REPO_ADMIN
See the Bitbucket Server documentation for a detailed explanation of what each permission entails.
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.
PUT api/1.0/projects/{projectKey}/repos/{repositorySlug}/permissions/groups
Parameters:
permission
- string, default: nonethe permission to grant
name
- string, default: nonethe names of the groups
Responses:
400
- errors, type: application/jsonThe request was malformed or the specified permission does not exist.
401
- errors, type: application/jsonThe currently authenticated user is not an administrator for the specified repository.
204
- data, type: unknownThe requested permission was granted.
403
- errors, type: application/jsonThe action was disallowed as it would reduce the currently authenticated user's permission level.
404
- errors, type: application/jsonThe specified repository or group does not exist.
get_groups_with_any_repository_permission
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/permissions/groups
Parameters:
filter
- string, default: noneif specified only group names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of groups and their highest permissions for the specified repository.
401
- errors, type: application/jsonThe currently authenticated user is not a repository administrator for the specified repository.
404
- errors, type: application/jsonThe specified repository does not exist.
revoke_repository_permissions_for_group
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.
DELETE api/1.0/projects/{projectKey}/repos/{repositorySlug}/permissions/groups
Parameters:
name
- string, default: nonethe name of the group
Responses:
401
- errors, type: application/jsonThe currently authenticated user is not an administrator of the specified repository.
204
- data, type: unknownAll repository permissions were revoked from the group for the specified repository.
404
- errors, type: application/jsonThe specified repository or group does not exist.
409
- errors, type: application/jsonThe action was disallowed as it would reduce the currently authenticated user's permission level.
get_groups_without_any_repository_permission
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/permissions/groups/none
Parameters:
filter
- string, default: noneif specified only group names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of groups that have not been granted any permissions for the specified repository.
401
- errors, type: application/jsonThe currently authenticated user is not a repository administrator for the specified repository.
404
- errors, type: application/jsonThe specified repository does not exist.
revoke_repository_permissions_for_user
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.
DELETE api/1.0/projects/{projectKey}/repos/{repositorySlug}/permissions/users
Parameters:
name
- string, default: nonethe name of the user
Responses:
401
- errors, type: application/jsonThe currently authenticated user is not an administrator of the specified repository.
204
- data, type: unknownAll repository permissions were revoked from the user for the specified repository.
404
- errors, type: application/jsonThe specified repository or group does not exist.
409
- errors, type: application/jsonThe action was disallowed as it would reduce the currently authenticated user's permission level.
set_repository_permission_for_user
Promote or demote a user's permission level for the specified repository. Available repository permissions are:
REPO_READ
REPO_WRITE
REPO_ADMIN
See the Bitbucket Server documentation for a detailed explanation of what each permission entails.
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.
PUT api/1.0/projects/{projectKey}/repos/{repositorySlug}/permissions/users
Parameters:
name
- string, default: nonethe names of the users
permission
- string, default: nonethe permission to grant
Responses:
400
- errors, type: application/jsonThe request was malformed or the specified permission does not exist.
401
- errors, type: application/jsonThe currently authenticated user is not an administrator for the specified repository.
204
- data, type: unknownThe requested permission was granted.
403
- errors, type: application/jsonThe action was disallowed as it would reduce the currently authenticated user's permission level.
404
- errors, type: application/jsonThe specified repository or user does not exist.
get_users_with_any_repository_permission
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/permissions/users
Parameters:
filter
- string, default: noneif specified only group names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of users and their highest permissions for the specified repository.
401
- errors, type: application/jsonThe currently authenticated user is not a repository administrator for the specified repository.
404
- errors, type: application/jsonThe specified repository does not exist.
get_users_without_repository_permission
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/permissions/users/none
Parameters:
filter
- string, default: noneif specified only group names containing the supplied string will be returned
Responses:
200
- page, type: application/jsonA page of users that have not been granted any permissions for the specified repository.
401
- errors, type: application/jsonThe currently authenticated user is not a repository administrator for the specified repository.
404
- errors, type: application/jsonThe specified repository does not exist.
get_pull_requests
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 username.N
parameter, and the optional role.N
and approved.N
parameters.
username.N
- the "root" of a single participant filter, where "N" is a natural number starting from 1. This allows clients to specify multiple participant filters, by providing consecutive filters asusername.1
,username.2
etc. Note that the filters numbering has to start with 1 and be continuous for all filters to be processed. The total allowed number of participant filters is 10 and all filters exceeding that limit will be dropped.role.N
(optional) the role associated withusername.N
. This must be one ofAUTHOR
,REVIEWER
, orPARTICIPANT
approved.N
(optional) the approved status associated withusername.N
. That is whetherusername.N
has approved the PR. Eithertrue
, orfalse
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests
Parameters:
direction
- string, default: incoming(optional, defaults to INCOMING) the direction relative to the specified repository. Either INCOMING or OUTGOING.
at
- string, default: none(optional) a fully-qualified branch ID to find pull requests to or from, such as
refs/heads/master
state
- string, default: none(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
- string, default: none(optional, defaults to NEWEST) the order to return pull requests in, either OLDEST (as in: "oldest first") or NEWEST.
withAttributes
- boolean, default: true(optional) defaults to true, whether to return additional pull request attributes
withProperties
- boolean, default: true(optional) defaults to true, whether to return additional pull request properties
Responses:
200
- page, type: application/jsonA page of pull requests that match the search criteria.
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the specified pull request.
404
- errors, type: application/jsonThe specified repository or pull request does not exist.
create_pull_request
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 hierarchy.
The authenticated user must have REPO_READ permission for the "from" and "to"repositories to call this resource.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests
Responses:
201
- pullRequest, type: application/jsonThe newly created pull request.
400
- errors, type: application/jsonThe pull request entity supplied in the request was malformed.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to create a pull request between the two specified repositories.
404
- errors, type: application/jsonOne of the specified repositories or branches does not exist.
409
- errors, type: application/jsonOne of the following error cases occurred (check the error message for more details):
There was a problem resolving one or more reviewers.
The specified branches were the same.
The to branch is already up-to-date with all the commits on the from branch.
A pull request between the two branches already exists.
get_pull_request
Retrieve a pull request.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}
Parameters:
pullRequestId
- long, default: nonethe ID of the pull request within the repository
Responses:
200
- pullRequest, type: application/jsonThe specified pull request.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the specified pull request.
404
- errors, type: application/jsonThe specified repository or pull request does not exist.
update_pull_request
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:
be the author of the pull request and have the REPO_READ permission for the repository that this pull request targets; or
have the REPO_WRITE permission for the repository that this pull request targets
to call this resource.
PUT api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}
Parameters:
pullRequestId
- long, default: nonethe ID of the pull request within the repository
Responses:
200
- pullRequest, type: application/jsonThe updated pull request.
400
- errors, type: application/jsonOne of the following error cases occurred (check the error message for more details):
The request tried to modify the author or participants.
The pull request's version attribute was not specified.
A reviewer's username was not specified.
The toRef id value was incorrectly left blank
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to update the specified pull request.
404
- errors, type: application/jsonOne of the specified repositories or branches does not exist.
409
- errors, type: application/jsonOne of the following error cases occurred (check the error message for more details):
The specified version is out of date.
One of the reviewers could not be added to the pull request.
If updating the destination branch:
There is already an open pull request with an identical to branch
The from and new to branch are the same
The new destination branch up-to-date is up-to-date with all of changes from the from branch, resulting in a pull request with nothing to merge
delete_pull_request
Deletes a pull request.
To call this resource, users must be authenticated and have permission to view the pull request. Additionally, they must:
be the pull request author, if the system is configured to allow authors to delete their own pull requests (this is the default) OR
have repository administrator permission for the repository the pull request is targeting
A body containing the version of the pull request must be provided with this request.
C<<< { "version": 1 } >>>
DELETE api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}
Parameters:
pullRequestId
- long, default: nonethe ID of the pull request within the repository
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the specified pull request.
204
- data, type: application/json404
- errors, type: application/jsonThe specified repository or pull request does not exist.
get_pull_request_activities
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/activities
Parameters:
pullRequestId
- long, default: nonethe id of the pull request within the repository
fromId
- long, default: none(optional) the id of the activity item to use as the first item in the returned page
fromType
- string, default: none(required if fromId is present) the type of the activity item specified by fromId (either COMMENT or ACTIVITY)
Responses:
200
- page, type: application/jsonA page of activity relating to the specified pull request.
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the specified pull request.
404
- errors, type: application/jsonThe specified repository or pull request does not exist.
withdraw_pull_request_approval
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
DELETE api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/approve
Parameters:
pullRequestId
- long, default: nonethe id of the pull request within the repository
Responses:
201
- participant, type: application/jsonDetails of the updated participant
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the pull request.
404
- errors, type: application/jsonThe specified repository or pull request does not exist or the current user is not a participant on the pull request.
409
- errors, type: application/jsonThe pull request is not open.
approve_pull_request
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
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/approve
Parameters:
pullRequestId
- long, default: nonethe id of the pull request within the repository
Responses:
201
- participant, type: application/jsonDetails of the new participant
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the pull request.
404
- errors, type: application/jsonThe specified repository or pull request does not exist.
409
- errors, type: application/jsonThe pull request is not open.
stream_pull_request_changes
Gets changes for the specified PullRequest.
If the changeScope
query parameter is set to unreviewed
, the application will attempt to stream unreviewed changes based on the lastReviewedCommit
of the current user, which are the changes between the 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 lastReviewedCommit
is either 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 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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/changes
Parameters:
changeScope
- string, default: ALLUNREVIEWED
to stream the unreviewed changes for the current user (if they exist);RANGE
to stream changes between two arbitrary commits (requiressinceId
anduntilId
); otherwiseALL
to stream all changes (the default)sinceId
- string, default: nonethe since commit hash to stream changes for a
RANGE
arbitrary change scopeuntilId
- string, default: nonethe until commit hash to stream changes for a
RANGE
arbitrary change scopewithComments
- boolean, default: truetrue
to apply comment counts in the changes (the default); otherwise,false
to stream changes without comment counts
Responses:
200
- page, type: application/jsonA page of unreviewed Changes for the current user from the supplied pull request, including the unreviewedCommits in the properties map.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the repository or pull request.
404
- errors, type: application/jsonThe repository or pull request does not exist.
create_pull_request_comment
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:
{
"parent" : {
"id" : 1
},
"text" : "A measured reply."
}
General file comment:
{
"anchor" : {
"diffType" : "RANGE",
"fromHash" : "6df3858eeb9a53a911cd17e66a9174d44ffb02cd",
"path" : "path/to/file",
"srcPath" : "path/to/file",
"toHash" : "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b"
},
"text" : "An insightful general comment on a file."
}
File line comment:
{
"anchor" : {
"diffType" : "COMMIT",
"fileType" : "FROM",
"fromHash" : "6df3858eeb9a53a911cd17e66a9174d44ffb02cd",
"line" : 1,
"lineType" : "CONTEXT",
"path" : "path/to/file",
"srcPath" : "path/to/file",
"toHash" : "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b"
},
"text" : "A pithy comment on a particular line within a file."
}
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:
'ADDED' - for an added line;
'REMOVED' - for a removed line; or
'CONTEXT' - for a line that was unmodified but is in the vicinity of the diff.
'fileType' refers to the file of the diff to which the anchor should be attached - which is of relevance when displaying the diff in a side-by-side way. Currently the supported values are:
'FROM' - the source file of the diff
'TO' - the destination file of the diff
If the current user is not a participant the user is added as a watcher of the pull request.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments
Responses:
201
- comment, type: application/jsonThe newly created comment.
400
- errors, type: application/jsonThe comment was not created due to a validation error.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the pull request, create a comment or watch the pull request.
404
- errors, type: application/jsonUnable to find the supplied project, repository, pull request or parent comment
get_pull_request_comments
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments
Parameters:
anchorState
- string, default: ACTIVEACTIVE
to stream the active comments;ORPHANED
to stream the orphaned comments;ALL
to stream both the active and the orphaned comments;diffType
- string, default: noneEFFECTIVE
to stream the comments related to the effective diff of the pull request;RANGE
to stream comments related to a commit range between two arbitrary commits (requiresfromHash
andtoHash
);COMMIT
to stream comments related to a commit between two arbitrary commits (requiresfromHash
andtoHash
)fromHash
- string, default: nonethe from commit hash to stream comments for a
RANGE
orCOMMIT
arbitrary change scopepath
- string, default: nonethe path to stream comments for a given path
toHash
- string, default: nonethe to commit hash to stream comments for a
RANGE
orCOMMIT
arbitrary change scope
Responses:
200
- page, type: application/jsonA page of Comments from the supplied pull request.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the repository or pull request.
404
- errors, type: application/jsonThe repository or pull request does not exist.
update_pull_request_comment
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.
PUT api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}
Parameters:
commentId
- long, default: nonethe id of the comment to retrieve
Responses:
201
- comment, type: application/jsonThe newly updated comment.
400
- errors, type: application/jsonThe comment was not updated due to a validation error.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the pull request, update a comment or watch the pull request.
404
- errors, type: application/jsonUnable to find the supplied project, repository, pull request or comment
409
- errors, type: application/jsonThe comment version supplied does not match the current version.
delete_pull_request_comment
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.
DELETE api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}
Parameters:
commentId
- long, default: nonethe id of the comment to retrieve
version
- int, default: -1The 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.
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to delete the comment.
204
- data, type: unknownThe operation was successful
404
- errors, type: application/jsonUnable to find the supplied project, repository or pull request.
409
- errors, type: application/jsonThe comment has replies or the version supplied does not match the current version.
get_pull_request_comment
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}
Parameters:
commentId
- long, default: nonethe id of the comment to retrieve
Responses:
200
- comment, type: application/jsonThe requested comment.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the comment
404
- errors, type: application/jsonUnable to find the supplied project, repository, pull request or comment
get_pull_request_commits
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/commits
Parameters:
pullRequestId
- long, default: nonewithCounts
- boolean, default: noneif 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.
Responses:
200
- page, type: application/jsona page of commits from the supplied pull request.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the repository or pull request.
404
- errors, type: application/jsonThe repository or pull request does not exist.
decline_pull_request
Decline a pull request.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/decline
Parameters:
pullRequestId
- long, default: noneversion
- int, default: -1the 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.
Responses:
200
- data, type: unknownThe pull request was declined.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the pull request.
404
- errors, type: application/jsonThe specified repository or pull request does not exist.
409
- errors, type: application/jsonThe pull request is not OPEN or has been updated since the version specified by the request.
stream_pull_request_diff
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/diff/{path:.*}
Parameters:
path
- string, default: nonethe path to the file which should be diffed (optional)
contextLines
- int, default: -1the number of context lines to include around added/removed lines in the diff
diffType
- string, default: EFFECTIVEthe type of diff being requested. When
withComments
istrue
this works as a hint to the system to attach the correct set of comments to the diffsinceId
- string, default: nonethe since commit hash to stream a diff between two arbitrary hashes
srcPath
- string, default: nonethe previous path to the file, if the file has been copied, moved or renamed
untilId
- string, default: nonethe until commit hash to stream a diff between two arbitrary hashes
whitespace
- string, default: noneoptional whitespace flag which can be set to
ignore-all
withComments
- boolean, default: truetrue
to embed comments in the diff (the default); otherwise,false
to stream the diff without comments
Responses:
200
- diffs, type: application/jsona page of differences from a pull request.
400
- errors, type: application/jsonIf the request was malformed.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the repository or pull request.
404
- errors, type: application/jsonThe repository or pull request does not exist.
can_merge_pull_request
Test whether a pull request can be merged.
A pull request may not be merged if:
there are conflicts that need to be manually resolved before merging; and/or
one or more merge checks have vetoed the merge.
The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/merge
Parameters:
pullRequestId
- long, default: nonethe ID of the pull request within the repository
Responses:
200
- pullRequest, type: application/jsonThe mergeability status of the pull request.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the specified pull request.
404
- errors, type: application/jsonThe specified repository or pull request does not exist.
409
- errors, type: application/jsonThe specified pull request is not open.
merge_pull_request
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.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/merge
Parameters:
pullRequestId
- long, default: nonethe ID of the pull request within the repository
version
- int, default: -1the 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.
Responses:
200
- pullRequest, type: application/jsonThe merged pull request.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to merge the specified pull request.
404
- errors, type: application/jsonThe specified repository or pull request does not exist.
409
- errors, type: application/jsonOne of the following error cases occurred (check the error message for more details):
The pull request has conflicts.
A merge check vetoed the merge.
The specified version is out of date.
The specified pull request is not open.
get_pull_request_participants
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants
Parameters:
pullRequestId
- long, default: nonethe id of the pull request within the repository
Responses:
201
- page, type: application/jsonDetails of the participants in this pull request
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the pull request.
404
- errors, type: application/jsonThe specified repository or pull request does not exist.
assign_participant_role
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.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants
Parameters:
pullRequestId
- long, default: nonethe id of the pull request within the repository
Responses:
201
- participant, type: application/jsonThe created or updated participant.
400
- errors, type: application/jsonThe request does not have the username and role, or is attempting an invalid assignment
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to update the pull request.
404
- errors, type: application/jsonThe specified repository or pull request does not exist.
unassign_participant_role
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.
DELETE api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug}
Parameters:
pullRequestId
- long, default: nonethe id of the pull request within the repository
userSlug
- string, default: nonethe slug for the user changing their status
pullRequestId
- long, default: nonethe id of the pull request within the repository
Responses:
400
- errors, type: application/jsonThe request does not have the username
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to update the pull request.
204
- data, type: unknownThe update completed.
404
- errors, type: application/jsonThe specified repository or pull request does not exist.
update_status
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 status
are UNAPPROVED, NEEDS_WORK, or APPROVED.
If the new status
is NEEDS_WORK or APPROVED then the 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.
PUT api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug}
Parameters:
pullRequestId
- long, default: nonethe id of the pull request within the repository
userSlug
- string, default: nonethe slug for the user changing their status
pullRequestId
- long, default: nonethe id of the pull request within the repository
Responses:
201
- participant, type: application/jsonDetails of the new participant
400
- errors, type: application/jsonThe specified status was invalid.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the pull request.
404
- errors, type: application/jsonThe specified repository or pull request does not exist.
409
- errors, type: application/jsonThe pull request is not open.
reopen_pull_request
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.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/reopen
Parameters:
pullRequestId
- long, default: nonethe id of the pull request within the repository
version
- int, default: -1the 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.
Responses:
200
- pullRequest, type: application/jsonThe merged pull request.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to reopen the specified pull request.
404
- errors, type: application/jsonThe specified repository or pull request does not exist.
409
- errors, type: application/jsonOne of the following error cases occurred (check the error message for more details):
The pull request is not in a declined state.
The specified version is out of date.
get_pull_request_tasks
Retrieve the tasks associated with a pull request.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/tasks
Responses:
200
- task, type: application/jsonA page of tasks associated with the pull request.
401
- errors, type: application/jsonIf the current user cannot access the pull request
404
- errors, type: application/jsonIf the pull request does not exist
count_pull_request_tasks
Retrieve the total number of open and resolved tasks associated with a pull request.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/tasks/count
Responses:
200
- taskCount, type: application/jsonTotal number of open and resolved tasks associated with the pull request.
401
- errors, type: application/jsonIf the current user cannot access the pull request
404
- errors, type: application/jsonIf the pull request does not exist
unwatch_pull_request
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.
DELETE api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/watch
Parameters:
pullRequestId
- long, default: nonethe id of the pull request within the repository
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the pull request.
204
- data, type: unknownThe user is no longer watching the pull request.
404
- errors, type: application/jsonThe specified repository or pull request does not exist.
watch_pull_request
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.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/watch
Parameters:
pullRequestId
- long, default: nonethe id of the pull request within the repository
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the pull request.
204
- data, type: unknownThe user is now watching the pull request.
404
- errors, type: application/jsonThe specified repository or pull request does not exist.
get_content
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/raw/{path:.*}
Parameters:
path
- string, default: nonethe file path to retrieve content from
at
- string, default: nonethe commit ID or ref to retrieve the content for.
markup
- string, default: noneif present or
"true"
, triggers the raw content to be markup-rendered and returned as HTML; otherwise, if not specified, or any value other than"true"
, the content is streamed without markuphardwrap
- boolean, default: none(Optional) Whether the markup implementation should convert newlines to breaks. If not specified, {@link MarkupService} will user the value of the
markup.render.hardwrap
which istrue
by defaulthtmlEscape
- boolean, default: none(Optional) true if HTML should be escaped in the input markup, false otherwise. If not specified, {@link MarkupService} will user the value of the
markup.render.html.escape
which istrue
by default
retry_create_repository
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.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/recreate
Parameters:
projectKey
- string, default: nonethe parent project key
Responses:
201
- repository, type: application/jsonThe newly created repository.
400
- errors, type: application/jsonThe repository was not created due to a validation error.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to create a repository.
404
- errors, type: application/jsonThe specified repository does not exist.
get_related_repositories
Retrieve repositories which are related to this one. Related repositories are from the same 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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/related
Parameters:
projectKey
- string, default: nonethe parent project key
Responses:
200
- page, type: application/jsonA page of repositories related to the request repository.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to see the request repository.
404
- errors, type: application/jsonThe request repository does not exist.
get_repository_hooks
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks
Parameters:
type
- string, default: nonethe optional type to filter by. Valid values are
PRE_RECEIVE
orPOST_RECEIVE
Responses:
200
- page, type: application/jsonreturns a page of repository hooks with their associated enabled state.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the hooks.
404
- errors, type: application/jsonThe specified repository does not exist.
delete_repository_hook
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.
DELETE api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}
Parameters:
hookKey
- string, default: none
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to delete the hook.
204
- data, type: unknownThe hook configuration matching the supplied hookKey and repositorySlug was deleted
404
- errors, type: application/jsonThe specified repository or hook does not exist.
get_repository_hook
Retrieve a repository hook for this repository.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}
Parameters:
hookKey
- string, default: none
Responses:
200
- data, type: application/jsonreturns the repository hooks with their associated enabled state for the supplied hookKey.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the hook.
404
- errors, type: application/jsonThe specified repository hook does not exist for the given repository, or the repository does not exist.
enable_repository_hook
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.
PUT api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled
Parameters:
hookKey
- string, default: noneContent-Length
- int, default: none
Responses:
200
- data, type: application/jsonreturns the repository hooks with their associated enabled state for the supplied hookKey.
400
- errors, type: application/jsonThe settings specified are invalid.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to enable the hook.
404
- errors, type: application/jsonThe specified repository or hook does not exist.
disable_repository_hook
Disable a repository hook for this repository.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
DELETE api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled
Parameters:
hookKey
- string, default: none
Responses:
200
- data, type: application/jsonreturns the repository hooks with their associated enabled state for the supplied hookKey.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to disable the hook.
404
- errors, type: application/jsonThe specified repository or hook does not exist.
set_repository_hook_settings
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.
PUT api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings
Parameters:
hookKey
- string, default: none
Responses:
200
- data, type: application/jsonThe settings for the hook.
400
- errors, type: application/jsonThe settings specified are invalid.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to modify the hook settings.
404
- errors, type: application/jsonThe specified repository or hook does not exist.
get_repository_hook_settings
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.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings
Parameters:
hookKey
- string, default: none
Responses:
200
- data, type: application/jsonThe settings for the hook.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the hook settings.
404
- errors, type: application/jsonThe specified repository or hook does not exist.
get_repository_pull_request_settings
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
mergeConfig - the merge strategy configuration for pull requests
requiredApprovers - (Deprecated, please use com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook instead) the number of approvals required on a pull request for it to be mergeable, or 0 if the merge check is disabled
com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook - the merge check configuration for required approvers
requiredAllApprovers - whether or not all approvers must approve a pull request for it to be mergeable
requiredAllTasksComplete - whether or not all tasks on a pull request need to be completed for it to be mergeable
requiredSuccessfulBuilds - (Deprecated, please use com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck instead) the number of successful builds on a pull request for it to be mergeable, or 0 if the merge check is disabled
com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck - the merge check configuration for required builds
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests
Responses:
200
- data, type: application/jsonThe repository pull request settings for the context repository.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to see the specified repository.
404
- errors, type: application/jsonThe specified repository does not exist.
update_repository_pull_request_settings
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
mergeConfig - the merge strategy configuration for pull requests
requiredApprovers - (Deprecated, please use com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook instead) the number of approvals required on a pull request for it to be mergeable, or 0 to disable the merge check
com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook - a json map containing the keys 'enabled' (a boolean to enable or disable this merge check) and 'count' (an integer to set the number of required approvals)
requiredAllApprovers - whether or not all approvers must approve a pull request for it to be mergeable
requiredAllTasksComplete - whether or not all tasks on a pull request need to be completed for it to be mergeable
requiredSuccessfulBuilds - (Deprecated, please use com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck instead) the number of successful builds on a pull request for it to be mergeable, or 0 to disable the merge check
com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck - a json map containing the keys 'enabled' (a boolean to enable or disable this merge check) and 'count' (an integer to set the number of required builds)
Merge strategy configuration deletion:
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 set for this repository's SCM type as set at the project level, if present, otherwise
the configuration set for this repository's SCM type as set at the instance level, if present, otherwise
the default configuration for this repository's SCM type
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests
Responses:
200
- settings, type: application/jsonThe repository pull request settings for the context repository.
400
- errors, type: application/jsonThe repository pull request settings were not updated due to a validation error.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to see the specified repository.
404
- errors, type: application/jsonThe specified repository does not exist.
create_tag
Creates a tag using the information provided in the request
The authenticated user must have REPO_WRITE permission for the context repository to call this resource.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/tags
Responses:
200
- tag, type: application/jsonThe created tag
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to write to the repository.
404
- errors, type: application/jsonThe specified repository does not exist.
get_tags
Retrieve the tags matching the supplied filterText param.
The authenticated user must have REPO_READ permission for the context repository to call this resource.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/tags
Parameters:
filterText
- string, default: nonethe text to match on
orderBy
- string, default: noneordering of refs either ALPHABETICAL (by name) or MODIFICATION (last updated)
Responses:
200
- page, type: application/jsonThe tags matching the supplied filterText.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to read the repository.
404
- errors, type: application/jsonThe specified repository does not exist.
get_tag
Retrieve a tag in the specified repository.
The authenticated user must have REPO_READ permission for the context repository to call this resource.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/tags/{name:.*}
Parameters:
name
- string, default: nonethe name of the tag to be retrieved
Responses:
200
- tag, type: application/jsonThe tag which matches the supplied name.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to read the repository.
404
- errors, type: application/jsonThe specified tag does not exist.
create_webhook
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.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/webhooks
Responses:
200
- webhook, type: application/jsonA created webhook.
400
- errors, type: application/jsonThe webhook parameters were invalid or not supplied.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to create webhooks in the repository.
404
- errors, type: application/jsonThe repository does not exist.
find_webhooks
Find webhooks in this repository.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/webhooks
Parameters:
event
- string, default: nonelist of {@link com.atlassian.webhooks.WebhookEvent} ids to filter for
statistics
- boolean, default: falsetrue
if statistics should be provided for all found webhooks
Responses:
200
- webhook, type: application/jsonA list of webhooks.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to find webhooks in the repository.
404
- errors, type: application/jsonThe repository does not exist.
test_webhook
Test connectivity to a specific endpoint.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
POST api/1.0/projects/{projectKey}/repos/{repositorySlug}/webhooks/test
Parameters:
url
- string, default: nonethe url in which to connect to
Responses:
200
- webhook, type: application/jsona webhook.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to test a connection.
404
- errors, type: application/jsonThe repository does not exist.
delete_webhook
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.
DELETE api/1.0/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}
Parameters:
webhookId
- int, default: nonethe existing webhook id
Responses:
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to delete webhooks in the repository.
404
- errors, type: application/jsonThe repository does not exist, or webhook does not exist in this repository.
get_webhook
Get a webhook by id.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}
Parameters:
webhookId
- int, default: nonethe existing webhook id
statistics
- boolean, default: false
Responses:
200
- webhook, type: application/jsona webhook.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to get a webhook in the repository.
404
- errors, type: application/jsonThe repository does not exist, or the webhook does not exist in the repository.
update_webhook
Update an existing webhook.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
PUT api/1.0/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}
Parameters:
webhookId
- int, default: nonethe existing webhook id
Responses:
200
- webhook, type: application/jsona webhook.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to update a webhook in this repository.
404
- errors, type: application/jsonThe repository does not exist, or the webhook does not exist in the repository.
get_latest_webhook_invocation
Get the latest invocations for a specific webhook.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/latest
Parameters:
webhookId
- int, default: noneid of the webhook
event
- string, default: nonethe string id of a specific event to retrieve the last invocation for.
outcome
- string, default: nonethe outcome to filter for. Can be SUCCESS, FAILURE, ERROR. None specified means that the all will be considered
Responses:
200
- webhookInvocation, type: application/jsona webhook invocation dataset.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to get webhook invocations in the repository.
404
- errors, type: application/jsonThe repository does not exist, or the webhook does not exist in the repository.
get_webhook_statistics
Get the statistics for a specific webhook.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/statistics
Parameters:
webhookId
- int, default: noneid of the webhook
event
- string, default: nonethe string id of a specific event to retrieve the last invocation for. May be empty, in which case all events are considered
Responses:
200
- webhookInvocation, type: application/jsona webhook invocation dataset.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to get webhook statistics in the repository.
404
- errors, type: application/jsonThe repository does not exist, or the webhook does not exist in the repository.
get_webhook_statistics_summary
Get the statistics summary for a specific webhook.
The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
GET api/1.0/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/statistics/summary
Parameters:
webhookId
- int, default: noneid of the webhook
Responses:
200
- webhookInvocation, type: application/jsona webhook invocation dataset.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to get webhook statistics summary in the repository.
404
- errors, type: application/jsonThe repository does not exist, or the webhook does not exist in the repository.
get_repository_hooks_for_project
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.
GET api/1.0/projects/{projectKey}/settings/hooks
Parameters:
type
- string, default: nonethe optional type to filter by. Valid values are
PRE_RECEIVE
orPOST_RECEIVE
Responses:
200
- page, type: application/jsonreturns a page of repository hooks with their associated enabled state.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the hooks.
404
- errors, type: application/jsonThe specified project does not exist.
get_repository_hook_for_project
Retrieve a repository hook for this project.
The authenticated user must have PROJECT_READ permission for the specified project to call this resource.
GET api/1.0/projects/{projectKey}/settings/hooks/{hookKey}
Parameters:
hookKey
- string, default: none
Responses:
200
- data, type: application/jsonreturns the repository hooks with their associated enabled state for the supplied hookKey.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the hook.
404
- errors, type: application/jsonThe specified repository hook does not exist for the given project, or the project does not exist.
enable_repository_hook_for_project
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.
PUT api/1.0/projects/{projectKey}/settings/hooks/{hookKey}/enabled
Parameters:
hookKey
- string, default: noneContent-Length
- int, default: none
Responses:
200
- data, type: application/jsonreturns the repository hooks with their associated enabled state for the supplied hookKey.
400
- errors, type: application/jsonThe settings specified are invalid.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to enable the hook.
404
- errors, type: application/jsonThe specified project or hook does not exist.
disable_repository_hook_for_project
Disable a repository hook for this project.
The authenticated user must have PROJECT_ADMIN permission for the specified project to call this resource.
DELETE api/1.0/projects/{projectKey}/settings/hooks/{hookKey}/enabled
Parameters:
hookKey
- string, default: none
Responses:
200
- data, type: application/jsonreturns the repository hooks with their associated enabled state for the supplied hookKey.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to disable the hook.
404
- errors, type: application/jsonThe specified project or hook does not exist.
set_repository_hook_settings_for_project
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.
PUT api/1.0/projects/{projectKey}/settings/hooks/{hookKey}/settings
Parameters:
hookKey
- string, default: none
Responses:
200
- data, type: application/jsonThe settings for the hook.
400
- errors, type: application/jsonThe settings specified are invalid.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to modify the hook settings.
404
- errors, type: application/jsonThe specified project or hook does not exist.
get_repository_hook_settings_for_project
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.
GET api/1.0/projects/{projectKey}/settings/hooks/{hookKey}/settings
Parameters:
hookKey
- string, default: none
Responses:
200
- data, type: application/jsonThe settings for the hook.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to retrieve the hook settings.
404
- errors, type: application/jsonThe specified project or hook does not exist.
get_project_pull_request_settings
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.
GET api/1.0/projects/{projectKey}/settings/pull-requests/{scmId}
Parameters:
scmId
- string, default: nonethe SCM to get strategies for
Responses:
200
- page, type: application/jsonThe merge configuration of the request project.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to see the request repository.
404
- errors, type: application/jsonThe request repository does not exist.
update_project_pull_request_settings
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.
POST api/1.0/projects/{projectKey}/settings/pull-requests/{scmId}
Parameters:
scmId
- string, default: nonethe SCM to get strategies for
Responses:
200
- strategies, type: application/jsonThe repository pull request merge strategies for the context repository.
400
- errors, type: application/jsonThe repository pull request merge strategies were not updated due to a validation error.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to administrate the specified repository.
404
- errors, type: application/jsonThe specified repository does not exist.
find_repositories
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 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.
GET api/1.0/repos
Parameters:
name
- string, default: none(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
name
parameter will be stripped.projectname
- string, default: none(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
projectname
parameter will be stripped.permission
- string, default: none(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
andREPO_ADMIN
.visibility
- string, default: none(optional) if specified, this will limit the resulting repository list based on the repositories visibility. Valid values are public or private.
Responses:
200
- page, type: application/jsonA page of repositories.
400
- errors, type: application/jsonThe
visibility
parameter contains an invalid value
create_task
Create a new task.
POST api/1.0/tasks
Responses:
201
- task, type: application/jsonA copy of the created task.
400
- errors, type: application/jsonIf the task data is invalid (for example, if the task's text is missing or blank)
404
- errors, type: application/jsonIf the anchor of the task (such as a pull request comment) does not exist or is not visible to the current user
update_task
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.
PUT api/1.0/tasks/{taskId}
Parameters:
taskId
- long, default: nonethe id identifying the task to delete
Responses:
200
- task, type: application/jsonA copy of the task if it was successfully updated.
401
- errors, type: application/jsonIf the current user does not have the permission to update the task
404
- errors, type: application/jsonIf the task does not exist
409
- errors, type: application/jsonIf the task to update is in the resolved state
delete_task
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.
DELETE api/1.0/tasks/{taskId}
Parameters:
taskId
- long, default: nonethe id identifying the task to delete
Responses:
401
- errors, type: application/jsonIf the current user does not have the permission to delete the task
204
- task, type: unknownif the task was successfully deleted.
404
- errors, type: application/jsonIf the task does not exist
409
- errors, type: application/jsonIf the task to delete is in the resolved state
get_task
Retrieve a existing task.
GET api/1.0/tasks/{taskId}
Parameters:
taskId
- long, default: nonethe id identifying the task to delete
Responses:
200
- task, type: application/jsonA copy of the task.
404
- errors, type: application/jsonIf the task does not exist
update_current_user
Update the currently authenticated user's details. The update will always be applied to the currently authenticated user.
PUT api/1.0/users
Responses:
200
- detailedUser, type: application/jsonThe updated user.
400
- errors, type: application/jsonThe request was malformed.
401
- errors, type: application/jsonAuthentication failed or was not attempted.
find_users
Retrieve a page of users, optionally run through provided filters.
Only authenticated users may call this resource.
Supported Filters
Filters are provided in query parameters in a standard name=value
fashion. The following filters are currently supported:
filter
- return only users, whose username, name or email address contain thefilter
valuegroup
- return only users who are members of the given grouppermission
- the "root" of a permission filter, whose value must be a valid global, project, or repository permission. Additional filter parameters referring to this filter that specify the resource (project or repository) to apply the filter to must be prefixed withpermission.
. See the section "Permission Filters" below for more details.permission.N
- the "root" of a single permission filter, similar to thepermission
parameter, where "N" is a natural number starting from 1. This allows clients to specify multiple permission filters, by providing consecutive filters aspermission.1
,permission.2
etc. Note that the filters numbering has to start with 1 and be continuous for all filters to be processed. The total allowed number of permission filters is 50 and all filters exceeding that limit will be dropped. See the section "Permission Filters" below for more details on how the permission filters are processed.
Permission Filters
The following three sub-sections list parameters supported for permission filters (where [root]
is the root permission filter name, e.g. permission
, 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. ADMIN
is a global permission, PROJECT_ADMIN
is a project permission and 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 projectId
and projectKey
are provided, the system will use projectId
for the lookup.
Global permissions
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
.
Project permissions
[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
.
Repository permissions
[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 triggered
Example valid filter: permission.2=REPO_ADMIN&permission.2.projectKey=TEST_PROJECT&permission.2.repositorySlug=test_repo
.
GET api/1.0/users
Responses:
200
- page, type: application/jsonA page of users.
400
- errors, type: application/jsonThe search request was invalid, which may happen for multiple reasons, among others:
permission filter for project/repository permission with no parameters specifying the project or repository to apply the filter to
invalid permission name
permission filter for a project/repository permission pointing to a non-existent project or repository
The exact reason for the error and - in most cases - the request parameter name that had invalid value - will be provided in the error message.
401
- errors, type: application/jsonAuthentication failed or was not attempted.
update_current_user_password
Update the currently authenticated user's password.
PUT api/1.0/users/credentials
Responses:
400
- errors, type: application/jsonThe request was malformed or the old password was incorrect.
401
- errors, type: application/jsonAuthentication failed or was not attempted.
204
- data, type: unknownThe user's password was successfully updated.
get_user
Retrieve the user matching the supplied userSlug.
GET api/1.0/users/{userSlug}
Responses:
200
- userSlug, type: application/jsonThe user matching the supplied userSlug. Note, this may not be the user's username, always use the user.slug property.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to view the user.
404
- errors, type: application/jsonThe specified user does not exist.
upload_user_avatar
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.
POST api/1.0/users/{userSlug}/avatar.png
Responses:
201
- data, type: unknownThe avatar was uploaded successfully.
401
- errors, type: application/jsonThe currently authenticated user has insufficient permissions to update the avatar.
404
- errors, type: application/jsonThe specified user does not exist.
delete_user_avatar
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.
DELETE api/1.0/users/{userSlug}/avatar.png
Responses:
200
- href, type: application/jsonThe new avatar URL if the local avatar was successfully deleted or did not exist
401
- errors, type: application/jsonThe authenticated user has insufficient permissions to delete the specified avatar.
404
- errors, type: application/jsonThe specified user does not exist.
get_user_settings
Retrieve a map of user setting key values for a specific user identified by the user slug.
GET api/1.0/users/{userSlug}/settings
Responses:
200
- settings, type: application/jsonThe user settings for the specified user slug.
401
- errors, type: application/jsonThe currently authenticated user is not a project administrator.
update_user_settings
Update the entries of a map of user setting key/values for a specific user identified by the user slug.
POST api/1.0/users/{userSlug}/settings
Responses:
200
- data, type: unknownThe were updated successfully
401
- errors, type: application/jsonThe currently authenticated user is not a project administrator.
SEE ALSO
BUGS
Please report any bugs or feature requests on the bugtracker website https://github.com/chazmcgarvey/WebService-BitbucketServer/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHOR
Charles McGarvey <ccm@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2017 by Charles McGarvey.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.