PHPackages                             dario\_swain/stash-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. dario\_swain/stash-api

ActiveLibrary[API Development](/categories/api)

dario\_swain/stash-api
======================

REST-ish endpoint for interacting with Stash

07PHP

Since Apr 17Pushed 9y ago1 watchersCompare

[ Source](https://github.com/DarioSwain/StashApi)[ Packagist](https://packagist.org/packages/dario_swain/stash-api)[ RSS](/packages/dario-swain-stash-api/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (2)Used By (0)

**UNSTABLE - under heavy development.**

About
=====

[](#about)

Auto-generated PHP client for Stash API. Was generated using [APIMATIC](https://apimatic.io/), based on Stash official [WADL definition](https://developer.atlassian.com/static/rest/stash/3.11.6/stash-rest.wadl).

Getting started
===============

[](#getting-started)

How to Build
------------

[](#how-to-build)

The generated code has dependencies over external libraries like UniRest. These dependencies are defined in the `composer.json` file that comes with the SDK. To resolve these dependencies, we use the Composer package manager which requires PHP greater than 5.3.2 installed in your system. Visit  to download the installer file for Composer and run it in your system. Open command prompt and type `composer --version`. This should display the current version of the Composer installed if the installation was successful.

- Using command line, navigate to the directory containing the generated files (including `composer.json`) for the SDK.
- Run the command `composer install`. This should install all the required dependencies and create the `vendor` directory in your project directory.

[![Building SDK - Step 1](https://camo.githubusercontent.com/040e83b454b23c13b8ab0f4b5e98dab5aacd47bc4c81ae4d88b395cb2c312960/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d696e7374616c6c446570656e64656e6369657326776f726b7370616365466f6c6465723d53746173682532304150492d504850)](https://camo.githubusercontent.com/040e83b454b23c13b8ab0f4b5e98dab5aacd47bc4c81ae4d88b395cb2c312960/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d696e7374616c6c446570656e64656e6369657326776f726b7370616365466f6c6465723d53746173682532304150492d504850)

### \[For Windows Users Only\] Configuring CURL Certificate Path in php.ini

[](#for-windows-users-only-configuring-curl-certificate-path-in-phpini)

CURL used to include a list of accepted CAs, but no longer bundles ANY CA certs. So by default it will reject all SSL certificates as unverifiable. You will have to get your CA's cert and point curl at it. The steps are as follows:

1. Download the certificate bundle (.pem file) from  on to your system.
2. Add curl.cainfo = "PATH\_TO/cacert.pem" to your php.ini file located in your php installation. “PATH\_TO” must be an absolute path containing the .pem file.

```
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
;curl.cainfo =
```

How to Use
----------

[](#how-to-use)

The following section explains how to use the StashAPILib library in a new project.

### 1. Open Project in an IDE

[](#1-open-project-in-an-ide)

Open an IDE for PHP like PhpStorm. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.

[![Open project in PHPStorm - Step 1](https://camo.githubusercontent.com/091d986a87722194065c250cc2f59664d463d74f11c39710cb2961fe7ab3cb84/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d6f70656e49444526776f726b7370616365466f6c6465723d53746173682532304150492d504850)](https://camo.githubusercontent.com/091d986a87722194065c250cc2f59664d463d74f11c39710cb2961fe7ab3cb84/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d6f70656e49444526776f726b7370616365466f6c6465723d53746173682532304150492d504850)

Click on `Open` in PhpStorm to browse to your generated SDK directory and then click `OK`.

[![Open project in PHPStorm - Step 2](https://camo.githubusercontent.com/5083a10c34211b90b533d633df92263994dec4f9d290b8b90d118a0b0cbd83fa/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d6f70656e50726f6a6563743026776f726b7370616365466f6c6465723d53746173682532304150492d504850)](https://camo.githubusercontent.com/5083a10c34211b90b533d633df92263994dec4f9d290b8b90d118a0b0cbd83fa/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d6f70656e50726f6a6563743026776f726b7370616365466f6c6465723d53746173682532304150492d504850)

### 2. Add a new Test Project

[](#2-add-a-new-test-project)

Create a new directory by right clicking on the solution name as shown below:

[![Add a new project in PHPStorm - Step 1](https://camo.githubusercontent.com/27b5c9e8358134de6153d1d58a0294ebae5d37dcc058c58710609e2e1bec53c7/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d6372656174654469726563746f727926776f726b7370616365466f6c6465723d53746173682532304150492d504850)](https://camo.githubusercontent.com/27b5c9e8358134de6153d1d58a0294ebae5d37dcc058c58710609e2e1bec53c7/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d6372656174654469726563746f727926776f726b7370616365466f6c6465723d53746173682532304150492d504850)

Name the directory as "test"

[![Add a new project in PHPStorm - Step 2](https://camo.githubusercontent.com/3899a6a4cebea9b9e347d71bada815a100d5d78633328f9ad63c46f3f5d80763/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d6e616d654469726563746f727926776f726b7370616365466f6c6465723d53746173682532304150492d504850)](https://camo.githubusercontent.com/3899a6a4cebea9b9e347d71bada815a100d5d78633328f9ad63c46f3f5d80763/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d6e616d654469726563746f727926776f726b7370616365466f6c6465723d53746173682532304150492d504850)

Add a PHP file to this project

[![Add a new project in PHPStorm - Step 3](https://camo.githubusercontent.com/40a444b0c916b1d737d1976be63ebc910c8ad05f9f7e13e9c353a03bef6a1ff5/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d63726561746546696c6526776f726b7370616365466f6c6465723d53746173682532304150492d504850)](https://camo.githubusercontent.com/40a444b0c916b1d737d1976be63ebc910c8ad05f9f7e13e9c353a03bef6a1ff5/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d63726561746546696c6526776f726b7370616365466f6c6465723d53746173682532304150492d504850)

Name it "testSDK"

[![Add a new project in PHPStorm - Step 4](https://camo.githubusercontent.com/9aede2fb6fa5182038cd58b7539d58ad51dc8f8766084066d323638f2659d835/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d6e616d6546696c6526776f726b7370616365466f6c6465723d53746173682532304150492d504850)](https://camo.githubusercontent.com/9aede2fb6fa5182038cd58b7539d58ad51dc8f8766084066d323638f2659d835/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d6e616d6546696c6526776f726b7370616365466f6c6465723d53746173682532304150492d504850)

Depending on your project setup, you might need to include composer's autoloader in your PHP code to enable auto loading of classes.

```
require_once "../vendor/autoload.php";
```

It is important that the path inside require\_once correctly points to the file `autoload.php` inside the vendor directory created during dependency installations.

[![Add a new project in PHPStorm - Step 4](https://camo.githubusercontent.com/aa45f008ca4d732b28d8da9132bdb7bec2af2eabf2a53300abe8bf8f6a0ff2c1/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d70726f6a65637446696c657326776f726b7370616365466f6c6465723d53746173682532304150492d504850)](https://camo.githubusercontent.com/aa45f008ca4d732b28d8da9132bdb7bec2af2eabf2a53300abe8bf8f6a0ff2c1/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d70726f6a65637446696c657326776f726b7370616365466f6c6465723d53746173682532304150492d504850)

After this you can add code to initialize the client library and acquire the instance of a Controller class. Sample code to initialize the client library and using controller methods is given in the subsequent sections.

### 3. Run the Test Project

[](#3-run-the-test-project)

To run your project you must set the Interpreter for your project. Interpreter is the PHP engine installed on your computer.

Open `Settings` from `File` menu.

[![Run Test Project - Step 1](https://camo.githubusercontent.com/e993c48acb30227bcbc45efddb504bbd1c86531fb6bca9212c5aa684c3f35ba3/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d6f70656e53657474696e677326776f726b7370616365466f6c6465723d53746173682532304150492d504850)](https://camo.githubusercontent.com/e993c48acb30227bcbc45efddb504bbd1c86531fb6bca9212c5aa684c3f35ba3/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d6f70656e53657474696e677326776f726b7370616365466f6c6465723d53746173682532304150492d504850)

Select `PHP` from within `Languages & Frameworks`

[![Run Test Project - Step 2](https://camo.githubusercontent.com/a57b3809b25f153188d0b7292b74630006c256be52910bf140784e1238e3e679/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d736574496e7465727072657465723026776f726b7370616365466f6c6465723d53746173682532304150492d504850)](https://camo.githubusercontent.com/a57b3809b25f153188d0b7292b74630006c256be52910bf140784e1238e3e679/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d736574496e7465727072657465723026776f726b7370616365466f6c6465723d53746173682532304150492d504850)

Browse for Interpreters near the `Interpreter` option and choose your interpreter.

[![Run Test Project - Step 3](https://camo.githubusercontent.com/f01adbfb3d262c7cf1e867fea4b2f909eda20a5e82a4c6afb0c1848d99db517f/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d736574496e7465727072657465723126776f726b7370616365466f6c6465723d53746173682532304150492d504850)](https://camo.githubusercontent.com/f01adbfb3d262c7cf1e867fea4b2f909eda20a5e82a4c6afb0c1848d99db517f/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d736574496e7465727072657465723126776f726b7370616365466f6c6465723d53746173682532304150492d504850)

Once the interpreter is selected, click `OK`

[![Run Test Project - Step 4](https://camo.githubusercontent.com/457a98d8b35d69d7028e9ee673c4141f02e20b50b38a3137751822262c711a27/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d736574496e7465727072657465723226776f726b7370616365466f6c6465723d53746173682532304150492d504850)](https://camo.githubusercontent.com/457a98d8b35d69d7028e9ee673c4141f02e20b50b38a3137751822262c711a27/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d736574496e7465727072657465723226776f726b7370616365466f6c6465723d53746173682532304150492d504850)

To run your project, right click on your PHP file inside your Test project and click on `Run`

[![Run Test Project - Step 5](https://camo.githubusercontent.com/c1d99e86e18c86754a874ab76564d6828c36ee9f3aa217db4c72bd1e898a0201/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d72756e50726f6a65637426776f726b7370616365466f6c6465723d53746173682532304150492d504850)](https://camo.githubusercontent.com/c1d99e86e18c86754a874ab76564d6828c36ee9f3aa217db4c72bd1e898a0201/68747470733a2f2f617069646f63732e696f2f696c6c757374726174696f6e2f7068703f737465703d72756e50726f6a65637426776f726b7370616365466f6c6465723d53746173682532304150492d504850)

How to Test
-----------

[](#how-to-test)

Unit tests in this SDK can be run using PHPUnit.

1. First install the dependencies using composer including the `require-dev` dependencies.
2. Run `vendor\bin\phpunit --verbose` from commandline to execute tests. If you have installed PHPUnit globally, run tests using `phpunit --verbose` instead.

You can change the PHPUnit test configuration in the `phpunit.xml` file.

Initialization
--------------

[](#initialization)

### Authentication

[](#authentication)

In order to setup authentication and initialization of the API client, you need the following information.

ParameterDescriptionstashDomainTODO: add a descriptionbasicAuthUserNameThe username to use with basic authenticationbasicAuthPasswordThe password to use with basic authenticationAPI client can be initialized as following.

```
// Configuration parameters and credentials
$stashDomain = "stashDomain";
$basicAuthUserName = "basicAuthUserName"; // The username to use with basic authentication
$basicAuthPassword = "basicAuthPassword"; // The password to use with basic authentication

$client = new StashAPILib\StashAPILibClient($stashDomain, $basicAuthUserName, $basicAuthPassword);
```

Class Reference
---------------

[](#class-reference)

### List of Controllers

[](#list-of-controllers)

- [RepositoryController](#repository_controller)
- [AdminController](#admin_controller)
- [PullRequestController](#pull_request_controller)
- [HookController](#hook_controller)
- [ProjectController](#project_controller)
- [TaskController](#task_controller)
- [GroupController](#group_controller)
- [ProfileController](#profile_controller)
- [ApplicationController](#application_controller)
- [LogController](#log_controller)
- [UserController](#user_controller)
- [MarkupController](#markup_controller)

### [![Class: ](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67 ".RepositoryController")](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67) RepositoryController

[](#-repositorycontroller)

#### Get singleton instance

[](#get-singleton-instance)

The singleton instance of the `RepositoryController` class can be accessed from the API Client.

```
$repository = $client->getRepository();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryCommitChanges")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryCommitChanges

[](#-getrepositorycommitchanges)

> Retrieve a page of changes made in a specified commit.
>
>  **Note:** The implementation will apply a hard cap ({@code page.max.changes}) and it is not possible to request subsequent content when that cap is exceeded.
>
>  The authenticated user must have **REPO\_READ** permission for the specified repository to call this resource.

```
function getRepositoryCommitChanges(
        $projectKey,
        $repositorySlug,
        $commitId,
        $since = null,
        $withComments = true)
```

#### Parameters

[](#parameters)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptioncommitId`Required`the commit to retrieve changes forsince`Optional`the 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 | `Optional` `DefaultValue` | {@code true} to apply comment counts in the changes (the default); otherwise, {@code false} to stream changes without comment counts |

#### Example Usage

[](#example-usage)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$commitId = 'commitId';
$since = 'since';
$withComments = true;

$result = $repository->getRepositoryCommitChanges($projectKey, $repositorySlug, $commitId, $since, $withComments);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryCompareDiffByPath")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryCompareDiffByPath

[](#-getrepositorycomparediffbypath)

> Gets a diff of the changes available in the {@code from} changeset but not in the {@code to} changeset.
>
>  If either the {@code from} or {@code to} changeset are not specified, they will be replaced by the default branch of their containing repository.

```
function getRepositoryCompareDiffByPath(
        $projectKey,
        $repositorySlug,
        $path,
        $from = null,
        $to = null,
        $fromRepo = null,
        $srcPath = null,
        $contextLines = -1,
        $whitespace = null)
```

#### Parameters

[](#parameters-1)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpath`Required`the path to the file to diff (optional)from`Optional`the source changeset (can be a partial/full changeset id or qualified/unqualified ref name)to`Optional`the target changeset (can be a partial/full changeset id or qualified/unqualified ref name)fromRepo`Optional`an optional parameter specifying the source repository containing the source changeset```
             if that changeset 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 | `Optional` | TODO: Add a parameter description | | contextLines | `Optional` `DefaultValue` | an optional number of context lines to include around each added or removed lines in the diff | | whitespace | `Optional` | an optional whitespace flag which can be set to `ignore-all` |

#### Example Usage

[](#example-usage-1)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$path = 'path';
$from = 'from';
$to = 'to';
$fromRepo = 'fromRepo';
$srcPath = 'srcPath';
$contextLines = -1;
$whitespace = 'whitespace';

$result = $repository->getRepositoryCompareDiffByPath($projectKey, $repositorySlug, $path, $from, $to, $fromRepo, $srcPath, $contextLines, $whitespace);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryCompareChanges")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryCompareChanges

[](#-getrepositorycomparechanges)

> Gets the file changes available in the {@code from} changeset but not in the {@code to} changeset.
>
>  If either the {@code from} or {@code to} changeset are not specified, they will be replaced by the default branch of their containing repository.

```
function getRepositoryCompareChanges(
        $projectKey,
        $repositorySlug,
        $from = null,
        $to = null,
        $fromRepo = null)
```

#### Parameters

[](#parameters-2)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionfrom`Optional`the source changeset (can be a partial/full changeset id or qualified/unqualified ref name)to`Optional`the target changeset (can be a partial/full changeset id or qualified/unqualified ref name)fromRepo`Optional`an optional parameter specifying the source repository containing the source changeset```
             if that changeset is not present in the current repository; the repository can be specified
             by either its ID fromRepo=42 or by its project key plus its repo slug separated by
             a slash: fromRepo=projectKey/repoSlug |

```

#### Example Usage

[](#example-usage-2)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$from = 'from';
$to = 'to';
$fromRepo = 'fromRepo';

$result = $repository->getRepositoryCompareChanges($projectKey, $repositorySlug, $from, $to, $fromRepo);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryCompareCommits")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryCompareCommits

[](#-getrepositorycomparecommits)

> Gets the commits accessible from the {@code from} changeset but not in the {@code to} changeset.
>
>  If either the {@code from} or {@code to} changeset are not specified, they will be replaced by the default branch of their containing repository.

```
function getRepositoryCompareCommits(
        $projectKey,
        $repositorySlug,
        $from = null,
        $to = null,
        $fromRepo = null)
```

#### Parameters

[](#parameters-3)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionfrom`Optional`the source changeset (can be a partial/full changeset id or qualified/unqualified ref name)to`Optional`the target changeset (can be a partial/full changeset id or qualified/unqualified ref name)fromRepo`Optional`an optional parameter specifying the source repository containing the source changeset```
             if that changeset is not present in the current repository; the repository can be specified
             by either its ID fromRepo=42 or by its project key plus its repo slug separated by
             a slash: fromRepo=projectKey/repoSlug |

```

#### Example Usage

[](#example-usage-3)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$from = 'from';
$to = 'to';
$fromRepo = 'fromRepo';

$result = $repository->getRepositoryCompareCommits($projectKey, $repositorySlug, $from, $to, $fromRepo);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryBranches")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryBranches

[](#-getrepositorybranches)

> Retrieve the branches matching the supplied **filterText** param.
>
>  The authenticated user must have **REPO\_READ** permission for the specified repository to call this resource.

```
function getRepositoryBranches(
        $projectKey,
        $repositorySlug,
        $base = null,
        $details = null,
        $filterText = null,
        $orderBy = null)
```

#### Parameters

[](#parameters-4)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionbase`Optional`base branch or tag to compare each branch to (for the metadata providers that uses that information)details`Optional`whether to retrieve plugin-provided metadata about each branchfilterText`Optional`the text to match onorderBy`Optional`ordering of refs either ALPHABETICAL (by name) or MODIFICATION (last updated)#### Example Usage

[](#example-usage-4)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$base = 'base';
$details = false;
$filterText = 'filterText';
$orderBy = 'orderBy';

$result = $repository->getRepositoryBranches($projectKey, $repositorySlug, $base, $details, $filterText, $orderBy);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryDefaultBranch")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryDefaultBranch

[](#-getrepositorydefaultbranch)

> Get the default branch of the repository.
>
>  The authenticated user must have **REPO\_READ** permission for the specified repository to call this resource.

```
function getRepositoryDefaultBranch(
        $projectKey,
        $repositorySlug)
```

#### Parameters

[](#parameters-5)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-5)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';

$result = $repository->getRepositoryDefaultBranch($projectKey, $repositorySlug);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.updateSetRepositoryDefaultBranch")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateSetRepositoryDefaultBranch

[](#-updatesetrepositorydefaultbranch)

> Update the default branch of a repository.
>
>  The authenticated user must have **REPO\_ADMIN** permission for the specified repository to call this resource.

```
function updateSetRepositoryDefaultBranch(
        $dynamic,
        $projectKey,
        $repositorySlug)
```

#### Parameters

[](#parameters-6)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-6)

```
$dynamic = array('key' => 'value');
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';

$result = $repository->updateSetRepositoryDefaultBranch($dynamic, $projectKey, $repositorySlug);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.updateSetRepositoryPermissionForGroup")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateSetRepositoryPermissionForGroup

[](#-updatesetrepositorypermissionforgroup)

> Promote or demote a group's permission level for the specified repository. Available repository permissions are:
>
> - REPO\_READ
> - REPO\_WRITE
> - REPO\_ADMIN
>
>  See the [Stash documentation](https://confluence.atlassian.com/display/STASH/Managing+permissions+for+a+repository) 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.

```
function updateSetRepositoryPermissionForGroup(
        $projectKey,
        $repositorySlug,
        $permission = null,
        $name = null)
```

#### Parameters

[](#parameters-7)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpermission`Optional`the permission to grantname`Optional`the names of the groups#### Example Usage

[](#example-usage-7)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$permission = 'permission';
$name = 'name';

$result = $repository->updateSetRepositoryPermissionForGroup($projectKey, $repositorySlug, $permission, $name);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryGroupsWithAnyPermission")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryGroupsWithAnyPermission

[](#-getrepositorygroupswithanypermission)

> 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.

```
function getRepositoryGroupsWithAnyPermission(
        $projectKey,
        $repositorySlug,
        $filter = null)
```

#### Parameters

[](#parameters-8)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionfilter`Optional`if specified only group names containing the supplied string will be returned#### Example Usage

[](#example-usage-8)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$filter = 'filter';

$result = $repository->getRepositoryGroupsWithAnyPermission($projectKey, $repositorySlug, $filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.deleteRevokeRepositoryPermissionsForGroup")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteRevokeRepositoryPermissionsForGroup

[](#-deleterevokerepositorypermissionsforgroup)

> 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.

```
function deleteRevokeRepositoryPermissionsForGroup(
        $projectKey,
        $repositorySlug,
        $name = null)
```

#### Parameters

[](#parameters-9)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionname`Optional`the name of the group#### Example Usage

[](#example-usage-9)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$name = 'name';

$result = $repository->deleteRevokeRepositoryPermissionsForGroup($projectKey, $repositorySlug, $name);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.updateSetRepositoryPermissionForUser")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateSetRepositoryPermissionForUser

[](#-updatesetrepositorypermissionforuser)

> Promote or demote a user's permission level for the specified repository. Available repository permissions are:
>
> - REPO\_READ
> - REPO\_WRITE
> - REPO\_ADMIN
>
>  See the [Stash documentation](https://confluence.atlassian.com/display/STASH/Managing+permissions+for+a+repository) 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.

```
function updateSetRepositoryPermissionForUser(
        $projectKey,
        $repositorySlug,
        $name = null,
        $permission = null)
```

#### Parameters

[](#parameters-10)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionname`Optional`the names of the userspermission`Optional`the permission to grant#### Example Usage

[](#example-usage-10)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$name = 'name';
$permission = 'permission';

$result = $repository->updateSetRepositoryPermissionForUser($projectKey, $repositorySlug, $name, $permission);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryUsersWithAnyPermission")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryUsersWithAnyPermission

[](#-getrepositoryuserswithanypermission)

> 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.

```
function getRepositoryUsersWithAnyPermission(
        $projectKey,
        $repositorySlug,
        $filter = null)
```

#### Parameters

[](#parameters-11)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionfilter`Optional`if specified only group names containing the supplied string will be returned#### Example Usage

[](#example-usage-11)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$filter = 'filter';

$result = $repository->getRepositoryUsersWithAnyPermission($projectKey, $repositorySlug, $filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.deleteRevokeRepositoryPermissionsForUser")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteRevokeRepositoryPermissionsForUser

[](#-deleterevokerepositorypermissionsforuser)

> 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.

```
function deleteRevokeRepositoryPermissionsForUser(
        $projectKey,
        $repositorySlug,
        $name = null)
```

#### Parameters

[](#parameters-12)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionname`Optional`the name of the user#### Example Usage

[](#example-usage-12)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$name = 'name';

$result = $repository->deleteRevokeRepositoryPermissionsForUser($projectKey, $repositorySlug, $name);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryGroupsWithoutAnyPermission")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryGroupsWithoutAnyPermission

[](#-getrepositorygroupswithoutanypermission)

> 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.

```
function getRepositoryGroupsWithoutAnyPermission(
        $projectKey,
        $repositorySlug,
        $filter = null)
```

#### Parameters

[](#parameters-13)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionfilter`Optional`if specified only group names containing the supplied string will be returned#### Example Usage

[](#example-usage-13)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$filter = 'filter';

$result = $repository->getRepositoryGroupsWithoutAnyPermission($projectKey, $repositorySlug, $filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryUsersWithoutPermission")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryUsersWithoutPermission

[](#-getrepositoryuserswithoutpermission)

> 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.

```
function getRepositoryUsersWithoutPermission(
        $projectKey,
        $repositorySlug,
        $filter = null)
```

#### Parameters

[](#parameters-14)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionfilter`Optional`if specified only group names containing the supplied string will be returned#### Example Usage

[](#example-usage-14)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$filter = 'filter';

$result = $repository->getRepositoryUsersWithoutPermission($projectKey, $repositorySlug, $filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryCommits")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryCommits

[](#-getrepositorycommits)

> 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.

```
function getRepositoryCommits(
        $projectKey,
        $repositorySlug,
        $path = null,
        $since = null,
        $until = null,
        $withCounts = false)
```

#### Parameters

[](#parameters-15)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpath`Optional`an optional path to filter commits bysince`Optional`the commit ID or ref (exclusively) to retrieve commits afteruntil`Optional`the commit ID (SHA1) or ref (inclusively) to retrieve commits beforewithCounts`Optional` `DefaultValue`optionally include the total number of commits and total number of unique authors#### Example Usage

[](#example-usage-15)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$path = 'path';
$since = 'since';
$until = 'until';
$withCounts = false;

$result = $repository->getRepositoryCommits($projectKey, $repositorySlug, $path, $since, $until, $withCounts);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryCommit")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryCommit

[](#-getrepositorycommit)

> Retrieve a single commit *identified by its ID*&gt;. 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.

```
function getRepositoryCommit(
        $projectKey,
        $repositorySlug,
        $commitId,
        $path = null)
```

#### Parameters

[](#parameters-16)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptioncommitId`Required`the commit ID to retrievepath`Optional`an optional path to filter the commit by. If supplied the details returned *may not*```
         be for the specified commit. Instead, starting from the specified commit, they will be the
         details for the first commit affecting the specified path. |

```

#### Example Usage

[](#example-usage-16)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$commitId = 'commitId';
$path = 'path';

$result = $repository->getRepositoryCommit($projectKey, $repositorySlug, $commitId, $path);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryTags")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryTags

[](#-getrepositorytags)

> Retrieve the tags matching the supplied **filterText** param.
>
>  The authenticated user must have **REPO\_READ** permission for the context repository to call this resource.

```
function getRepositoryTags(
        $projectKey,
        $repositorySlug,
        $filterText = null,
        $orderBy = null)
```

#### Parameters

[](#parameters-17)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionfilterText`Optional`the text to match onorderBy`Optional`ordering of refs either ALPHABETICAL (by name) or MODIFICATION (last updated)#### Example Usage

[](#example-usage-17)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$filterText = 'filterText';
$orderBy = 'orderBy';

$result = $repository->getRepositoryTags($projectKey, $repositorySlug, $filterText, $orderBy);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositories")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositories

[](#-getrepositories)

> Retrieve a page of repositories based on query parameters that control the search. See the documentation of the parameters for more details.
>
>  This resource is anonymously accessible.
>
>  **Note on permissions.** In absence of the {@code permission} query parameter the implicit 'read' permission is assumed. Please note that this permission is lower than the REPO\_READ permission rather than being equal to it. The implicit 'read' permission for a given repository is assigned to any user that has any of the higher permissions, such as REPO\_READ, as well as to anonymous users if the repository is marked as public. The important implication of the above is that an anonymous request to this resource with a permission level REPO\_READ is guaranteed to receive an empty list of repositories as a result. For anonymous requests it is therefore recommended to not specify the permission parameter at all.

```
function getRepositories(
        $name = null,
        $projectname = null,
        $permission = null,
        $visibility = null)
```

#### Parameters

[](#parameters-18)

ParameterTagsDescriptionname`Optional`(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 | `Optional` | (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 | `Optional` | (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\_WRITEand REPO\_ADMIN. | | visibility | `Optional` | (optional) if specified, this will limit the resulting repository list based on the repositories visibility. Valid values are *public* or *private*. |

#### Example Usage

[](#example-usage-18)

```
$name = 'name';
$projectname = 'projectname';
$permission = 'permission';
$visibility = 'visibility';

$result = $repository->getRepositories($name, $projectname, $permission, $visibility);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.listRepositoryFiles")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) listRepositoryFiles

[](#-listrepositoryfiles)

> 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.

```
function listRepositoryFiles(
        $projectKey,
        $repositorySlug,
        $at = null)
```

#### Parameters

[](#parameters-19)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionat`Optional`the changeset id or ref (e.g. a branch or tag) to list the files at.```
         If not specified the default branch will be used instead. |

```

#### Example Usage

[](#example-usage-19)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$at = 'at';

$result = $repository->listRepositoryFiles($projectKey, $repositorySlug, $at);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.listRepositoryFilesByPath")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) listRepositoryFilesByPath

[](#-listrepositoryfilesbypath)

> 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.

```
function listRepositoryFilesByPath(
        $projectKey,
        $repositorySlug,
        $path,
        $at = null)
```

#### Parameters

[](#parameters-20)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpath`Required`the directory to list files for.at`Optional`the changeset id or ref (e.g. a branch or tag) to list the files at.```
         If not specified the default branch will be used instead. |

```

#### Example Usage

[](#example-usage-20)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$path = 'path';
$at = 'at';

$result = $repository->listRepositoryFilesByPath($projectKey, $repositorySlug, $path, $at);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.createRepository")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createRepository

[](#-createrepository)

> 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.

```
function createRepository(
        $dynamic,
        $projectKey)
```

#### Parameters

[](#parameters-21)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptionprojectKey`Required`the parent project key#### Example Usage

[](#example-usage-21)

```
$dynamic = array('key' => 'value');
$projectKey = 'projectKey';

$result = $repository->createRepository($dynamic, $projectKey);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.deleteRepository")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteRepository

[](#-deleterepository)

> 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.

```
function deleteRepository(
        $repositorySlug,
        $projectKey)
```

#### Parameters

[](#parameters-22)

ParameterTagsDescriptionrepositorySlug`Required`the repository slugprojectKey`Required`the parent project key#### Example Usage

[](#example-usage-22)

```
$repositorySlug = 'repositorySlug';
$projectKey = 'projectKey';

$result = $repository->deleteRepository($repositorySlug, $projectKey);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.createForkRepository")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createForkRepository

[](#-createforkrepository)

> Create a new repository forked from an existing repository.
>
>  The JSON body for this {@code POST} is not required to contain *any* properties. Even the name may be omitted. The following properties will be used, if provided:
>
> - {@code "name":"Fork name"} - Specifies the forked repository's name
>     - Defaults to the name of the origin repository if not specified
> - {@code "project":{"key":"TARGET\_KEY"}} - Specifies the forked repository's target project by key
>     - Defaults 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.

```
function createForkRepository(
        $dynamic,
        $repositorySlug,
        $projectKey)
```

#### Parameters

[](#parameters-23)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptionrepositorySlug`Required`the repository slugprojectKey`Required`the parent project key#### Example Usage

[](#example-usage-23)

```
$dynamic = array('key' => 'value');
$repositorySlug = 'repositorySlug';
$projectKey = 'projectKey';

$result = $repository->createForkRepository($dynamic, $repositorySlug, $projectKey);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepository")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepository

[](#-getrepository)

> 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.

```
function getRepository(
        $repositorySlug,
        $projectKey)
```

#### Parameters

[](#parameters-24)

ParameterTagsDescriptionrepositorySlug`Required`the repository slugprojectKey`Required`the parent project key#### Example Usage

[](#example-usage-24)

```
$repositorySlug = 'repositorySlug';
$projectKey = 'projectKey';

$result = $repository->getRepository($repositorySlug, $projectKey);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.updateRepository")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateRepository

[](#-updaterepository)

> Update the repository matching the **repositorySlug** supplied in the resource path.
>
>  The repository's slug is derived from its name. If the name changes the slug may also change.
>
>  This API can be used to move the repository to a different project by setting the new project in the request, example: {@code {"project":{"key":"NEW\_KEY"}}} .
>
>  The authenticated user must have **REPO\_ADMIN** permission for the specified repository to call this resource.

```
function updateRepository(
        $dynamic,
        $repositorySlug,
        $projectKey)
```

#### Parameters

[](#parameters-25)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptionrepositorySlug`Required`the repository slugprojectKey`Required`the parent project key#### Example Usage

[](#example-usage-25)

```
$dynamic = array('key' => 'value');
$repositorySlug = 'repositorySlug';
$projectKey = 'projectKey';

$result = $repository->updateRepository($dynamic, $repositorySlug, $projectKey);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getForkedRepositories")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getForkedRepositories

[](#-getforkedrepositories)

> Retrieve repositories which have been forked from this one. Unlike {@link #getRelatedRepositories(Repository, PageRequest) related repositories}, this only looks at a given repository's direct forks. If those forks have themselves been the origin of more forks, such "grandchildren" repositories will not be retrieved.
>
>  Only repositories to which the authenticated user has **REPO\_READ** permission will be included, even if other repositories have been forked from this one.

```
function getForkedRepositories(
        $projectKey,
        $repositorySlug)
```

#### Parameters

[](#parameters-26)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-26)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';

$result = $repository->getForkedRepositories($projectKey, $repositorySlug);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRelatedRepositories")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRelatedRepositories

[](#-getrelatedrepositories)

> Retrieve repositories which are related to this one. Related repositories are from the same {@link Repository#getHierarchyId() hierarchy} as this repository.
>
>  Only repositories to which the authenticated user has **REPO\_READ** permission will be included, even if more repositories are part of this repository's hierarchy.

```
function getRelatedRepositories(
        $projectKey,
        $repositorySlug)
```

#### Parameters

[](#parameters-27)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-27)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';

$result = $repository->getRelatedRepositories($projectKey, $repositorySlug);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.createRetryCreateRepository")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createRetryCreateRepository

[](#-createretrycreaterepository)

> 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.

```
function createRetryCreateRepository(
        $projectKey,
        $repositorySlug)
```

#### Parameters

[](#parameters-28)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-28)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';

$result = $repository->createRetryCreateRepository($projectKey, $repositorySlug);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryShowDiff")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryShowDiff

[](#-getrepositoryshowdiff)

> 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.

```
function getRepositoryShowDiff(
        $projectKey,
        $repositorySlug,
        $contextLines = -1,
        $since = null,
        $srcPath = null,
        $until = null,
        $whitespace = null)
```

#### Parameters

[](#parameters-29)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptioncontextLines`Optional` `DefaultValue`the number of context lines to include around added/removed lines in the diffsince`Optional`the base revision to diff from. If omitted the parent revision of the until revision is usedsrcPath`Optional`the source path for the file, if it was copied, moved or renameduntil`Optional`the target revision to diff to (required)whitespace`Optional`optional whitespace flag which can be set to `ignore-all`#### Example Usage

[](#example-usage-29)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$contextLines = -1;
$since = 'since';
$srcPath = 'srcPath';
$until = 'until';
$whitespace = 'whitespace';

$result = $repository->getRepositoryShowDiff($projectKey, $repositorySlug, $contextLines, $since, $srcPath, $until, $whitespace);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryShowDiffByPath")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryShowDiffByPath

[](#-getrepositoryshowdiffbypath)

> 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.

```
function getRepositoryShowDiffByPath(
        $projectKey,
        $repositorySlug,
        $path,
        $contextLines = -1,
        $since = null,
        $srcPath = null,
        $until = null,
        $whitespace = null)
```

#### Parameters

[](#parameters-30)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpath`Required`the path to the file which should be diffed (required)contextLines`Optional` `DefaultValue`the number of context lines to include around added/removed lines in the diffsince`Optional`the base revision to diff from. If omitted the parent revision of the until revision is usedsrcPath`Optional`the source path for the file, if it was copied, moved or renameduntil`Optional`the target revision to diff to (required)whitespace`Optional`optional whitespace flag which can be set to `ignore-all`#### Example Usage

[](#example-usage-30)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$path = 'path';
$contextLines = -1;
$since = 'since';
$srcPath = 'srcPath';
$until = 'until';
$whitespace = 'whitespace';

$result = $repository->getRepositoryShowDiffByPath($projectKey, $repositorySlug, $path, $contextLines, $since, $srcPath, $until, $whitespace);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryContent")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryContent

[](#-getrepositorycontent)

> 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.

```
function getRepositoryContent(
        $projectKey,
        $repositorySlug,
        $at = null,
        $type = false,
        $blame = null,
        $noContent = null)
```

#### Parameters

[](#parameters-31)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionat`Optional`the changeset id or ref to retrieve the content for.type`Optional` `DefaultValue`if true only the type will be returned for the file path instead of the contents.blame`Optional`if present the blame will be returned for the file as well.noContent`Optional`if present and used with blame only the blame is retrieved instead of the contents.#### Example Usage

[](#example-usage-31)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$at = 'at';
$type = false;
$blame = 'blame';
$noContent = 'noContent';

$result = $repository->getRepositoryContent($projectKey, $repositorySlug, $at, $type, $blame, $noContent);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryContentByPath")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryContentByPath

[](#-getrepositorycontentbypath)

> 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.

```
function getRepositoryContentByPath(
        $projectKey,
        $repositorySlug,
        $path,
        $at = null,
        $type = false,
        $blame = null,
        $noContent = null)
```

#### Parameters

[](#parameters-32)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpath`Required`the file path to retrieve content fromat`Optional`the changeset id or ref to retrieve the content for.type`Optional` `DefaultValue`if true only the type will be returned for the file path instead of the contents.blame`Optional`if present the blame will be returned for the file as well.noContent`Optional`if present and used with blame only the blame is retrieved instead of the contents.#### Example Usage

[](#example-usage-32)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$path = 'path';
$at = 'at';
$type = false;
$blame = 'blame';
$noContent = 'noContent';

$result = $repository->getRepositoryContentByPath($projectKey, $repositorySlug, $path, $at, $type, $blame, $noContent);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.createRepositoryCommitComment")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createRepositoryCommitComment

[](#-createrepositorycommitcomment)

> Add a new comment.
>
>  Comments can be added in a few places by setting different attributes:
>
>  General commit comment:
>
> ```
>      {
>          "text": "An insightful general comment on a commit."
>      }
>
> ```
>
> Reply to a comment:
>
>  ```
>      {
>          "text": "A measured reply.",
>          "parent": {
>              "id": 1
>          }
>      }
>
> ```
>
> General file comment:
>
>  ```
>      {
>          "text": "An insightful general comment on a file.",
>          "anchor": {
>              "path": "path/to/file",
>              "srcPath": "path/to/file"
>          }
>      }
>
> ```
>
> File line comment:
>
>  ```
>      {
>          "text": "A pithy comment on a particular line within a file.",
>          "anchor": {
>              "line": 1,
>              "lineType": "CONTEXT",
>              "fileType": "FROM"
>              "path": "path/to/file",
>              "srcPath": "path/to/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).
>
>  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.

```
function createRepositoryCommitComment(
        $dynamic,
        $projectKey,
        $repositorySlug,
        $commitId,
        $since = null)
```

#### Parameters

[](#parameters-33)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptioncommitId`Required`TODO: Add a parameter descriptionsince`Optional`TODO: Add a parameter description#### Example Usage

[](#example-usage-33)

```
$dynamic = array('key' => 'value');
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$commitId = 'commitId';
$since = 'since';

$result = $repository->createRepositoryCommitComment($dynamic, $projectKey, $repositorySlug, $commitId, $since);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryCommitComments")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryCommitComments

[](#-getrepositorycommitcomments)

> TODO: Add a method description

```
function getRepositoryCommitComments(
        $projectKey,
        $repositorySlug,
        $commitId,
        $path = null,
        $since = null)
```

#### Parameters

[](#parameters-34)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptioncommitId`Required`TODO: Add a parameter descriptionpath`Optional`TODO: Add a parameter descriptionsince`Optional`TODO: Add a parameter description#### Example Usage

[](#example-usage-34)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$commitId = 'commitId';
$path = 'path';
$since = 'since';

$result = $repository->getRepositoryCommitComments($projectKey, $repositorySlug, $commitId, $path, $since);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.updateRepositoryCommitComment")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateRepositoryCommitComment

[](#-updaterepositorycommitcomment)

> 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.

```
function updateRepositoryCommitComment(
        $dynamic,
        $projectKey,
        $repositorySlug,
        $commitId,
        $commentId)
```

#### Parameters

[](#parameters-35)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptioncommitId`Required`the *full {@link Changeset#getId() ID}* of the commit within the repositorycommentId`Required`the ID of the comment to retrieve#### Example Usage

[](#example-usage-35)

```
$dynamic = array('key' => 'value');
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$commitId = 'commitId';
$commentId = 51;

$result = $repository->updateRepositoryCommitComment($dynamic, $projectKey, $repositorySlug, $commitId, $commentId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.deleteRepositoryCommitComment")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteRepositoryCommitComment

[](#-deleterepositorycommitcomment)

> 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.

```
function deleteRepositoryCommitComment(
        $projectKey,
        $repositorySlug,
        $commitId,
        $commentId,
        $version = -1)
```

#### Parameters

[](#parameters-36)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptioncommitId`Required`the *full {@link Changeset#getId() ID}* of the commit within the repositorycommentId`Required`the ID of the comment to retrieveversion`Optional` `DefaultValue`The expected version of the comment. This must match the server's version of the comment or```
              the delete will fail. To determine the current version of the comment, the comment should be
              fetched from the server prior to the delete. Look for the 'version' attribute in the returned
              JSON structure. |

```

#### Example Usage

[](#example-usage-36)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$commitId = 'commitId';
$commentId = 51;
$version = -1;

$result = $repository->deleteRepositoryCommitComment($projectKey, $repositorySlug, $commitId, $commentId, $version);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryCommitComment")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryCommitComment

[](#-getrepositorycommitcomment)

> 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.

```
function getRepositoryCommitComment(
        $projectKey,
        $repositorySlug,
        $commitId,
        $commentId)
```

#### Parameters

[](#parameters-37)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptioncommitId`Required`the *full {@link Changeset#getId() ID}* of the commit within the repositorycommentId`Required`the ID of the comment to retrieve#### Example Usage

[](#example-usage-37)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$commitId = 'commitId';
$commentId = 51;

$result = $repository->getRepositoryCommitComment($projectKey, $repositorySlug, $commitId, $commentId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryHooks")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryHooks

[](#-getrepositoryhooks)

> Retrieve a page of repository hooks for this repository.
>
>  The authenticated user must have **REPO\_ADMIN** permission for the specified repository to call this resource.

```
function getRepositoryHooks(
        $projectKey,
        $repositorySlug,
        $type = null)
```

#### Parameters

[](#parameters-38)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptiontype`Optional`the optional type to filter by. Valid values are `PRE_RECEIVE` or `POST_RECEIVE`#### Example Usage

[](#example-usage-38)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$type = 'type';

$result = $repository->getRepositoryHooks($projectKey, $repositorySlug, $type);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.updateSetRepositoryHookSettings")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateSetRepositoryHookSettings

[](#-updatesetrepositoryhooksettings)

> Modify the settings for a repository hook for this repositories.
>
>  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.

```
function updateSetRepositoryHookSettings(
        $dynamic,
        $projectKey,
        $repositorySlug,
        $hookKey)
```

#### Parameters

[](#parameters-39)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionhookKey`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-39)

```
$dynamic = array('key' => 'value');
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$hookKey = 'hookKey';

$result = $repository->updateSetRepositoryHookSettings($dynamic, $projectKey, $repositorySlug, $hookKey);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryHookSettings")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryHookSettings

[](#-getrepositoryhooksettings)

> Retrieve the settings for a repository hook for this repositories.
>
>  The authenticated user must have **REPO\_ADMIN** permission for the specified repository to call this resource.

```
function getRepositoryHookSettings(
        $projectKey,
        $repositorySlug,
        $hookKey)
```

#### Parameters

[](#parameters-40)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionhookKey`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-40)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$hookKey = 'hookKey';

$result = $repository->getRepositoryHookSettings($projectKey, $repositorySlug, $hookKey);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryHook")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryHook

[](#-getrepositoryhook)

> Retrieve a repository hook for this repositories.
>
>  The authenticated user must have **REPO\_ADMIN** permission for the specified repository to call this resource.

```
function getRepositoryHook(
        $projectKey,
        $repositorySlug,
        $hookKey)
```

#### Parameters

[](#parameters-41)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionhookKey`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-41)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$hookKey = 'hookKey';

$result = $repository->getRepositoryHook($projectKey, $repositorySlug, $hookKey);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.updateEnableRepositoryHook")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateEnableRepositoryHook

[](#-updateenablerepositoryhook)

> Enable a repository hook for this repositories and optionally applying new configuration.
>
>  The authenticated user must have **REPO\_ADMIN** permission for the specified repository to call this resource.

```
function updateEnableRepositoryHook(
        $projectKey,
        $repositorySlug,
        $hookKey,
        $contentLength = 0)
```

#### Parameters

[](#parameters-42)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionhookKey`Required`TODO: Add a parameter descriptioncontentLength`Optional` `DefaultValue`TODO: Add a parameter description#### Example Usage

[](#example-usage-42)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$hookKey = 'hookKey';
$contentLength = 0;

$result = $repository->updateEnableRepositoryHook($projectKey, $repositorySlug, $hookKey, $contentLength);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.deleteDisableRepositoryHook")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteDisableRepositoryHook

[](#-deletedisablerepositoryhook)

> Disable a repository hook for this repositories.
>
>  The authenticated user must have **REPO\_ADMIN** permission for the specified repository to call this resource.

```
function deleteDisableRepositoryHook(
        $projectKey,
        $repositorySlug,
        $hookKey)
```

#### Parameters

[](#parameters-43)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionhookKey`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-43)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$hookKey = 'hookKey';

$result = $repository->deleteDisableRepositoryHook($projectKey, $repositorySlug, $hookKey);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryChanges")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryChanges

[](#-getrepositorychanges)

> Retrieve a page of changes made in a specified commit.
>
>  The authenticated user must have **REPO\_READ** permission for the specified repository to call this resource.

```
function getRepositoryChanges(
        $projectKey,
        $repositorySlug,
        $since = null,
        $until = null)
```

#### Parameters

[](#parameters-44)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionsince`Optional`the 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 | `Optional` | the commit to retrieve changes for |

#### Example Usage

[](#example-usage-44)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$since = 'since';
$until = 'until';

$result = $repository->getRepositoryChanges($projectKey, $repositorySlug, $since, $until);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.deleteUnwatchRepositoryCommit")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteUnwatchRepositoryCommit

[](#-deleteunwatchrepositorycommit)

> 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.

```
function deleteUnwatchRepositoryCommit(
        $projectKey,
        $repositorySlug,
        $commitId)
```

#### Parameters

[](#parameters-45)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptioncommitId`Required`the *full {@link Changeset#getId() ID}* of the commit within the repository#### Example Usage

[](#example-usage-45)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$commitId = 'commitId';

$result = $repository->deleteUnwatchRepositoryCommit($projectKey, $repositorySlug, $commitId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.createWatchRepositoryCommit")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createWatchRepositoryCommit

[](#-createwatchrepositorycommit)

> 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.

```
function createWatchRepositoryCommit(
        $projectKey,
        $repositorySlug,
        $commitId)
```

#### Parameters

[](#parameters-46)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptioncommitId`Required`the *full {@link Changeset#getId() ID}* of the commit within the repository#### Example Usage

[](#example-usage-46)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$commitId = 'commitId';

$result = $repository->createWatchRepositoryCommit($projectKey, $repositorySlug, $commitId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryCommitDiff")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryCommitDiff

[](#-getrepositorycommitdiff)

> 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 substructures in the returned JSON response.
>
>  The authenticated user must have **REPO\_READ** permission for the specified repository to call this resource.

```
function getRepositoryCommitDiff(
        $projectKey,
        $repositorySlug,
        $commitId,
        $contextLines = -1,
        $since = null,
        $srcPath = null,
        $whitespace = null,
        $withComments = true)
```

#### Parameters

[](#parameters-47)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptioncommitId`Required`TODO: Add a parameter descriptioncontextLines`Optional` `DefaultValue`the number of context lines to include around added/removed lines in the diffsince`Optional`the base revision to diff from. If omitted the parent revision of the until revision is usedsrcPath`Optional`the source path for the file, if it was copied, moved or renamedwhitespace`Optional`optional whitespace flag which can be set to `ignore-all`withComments`Optional` `DefaultValue``true` to embed comments in the diff (the default); otherwise `false````
                 to stream the diff without comments |

```

#### Example Usage

[](#example-usage-47)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$commitId = 'commitId';
$contextLines = -1;
$since = 'since';
$srcPath = 'srcPath';
$whitespace = 'whitespace';
$withComments = true;

$result = $repository->getRepositoryCommitDiff($projectKey, $repositorySlug, $commitId, $contextLines, $since, $srcPath, $whitespace, $withComments);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositoryCommitDiffByPath")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositoryCommitDiffByPath

[](#-getrepositorycommitdiffbypath)

> 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 substructures in the returned JSON response.
>
>  The authenticated user must have **REPO\_READ** permission for the specified repository to call this resource.

```
function getRepositoryCommitDiffByPath(
        $projectKey,
        $repositorySlug,
        $path,
        $commitId,
        $contextLines = -1,
        $since = null,
        $srcPath = null,
        $whitespace = null,
        $withComments = true)
```

#### Parameters

[](#parameters-48)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpath`Required`the path to the file which should be diffed (optional)commitId`Required`TODO: Add a parameter descriptioncontextLines`Optional` `DefaultValue`the number of context lines to include around added/removed lines in the diffsince`Optional`the base revision to diff from. If omitted the parent revision of the until revision is usedsrcPath`Optional`the source path for the file, if it was copied, moved or renamedwhitespace`Optional`optional whitespace flag which can be set to `ignore-all`withComments`Optional` `DefaultValue``true` to embed comments in the diff (the default); otherwise `false````
                 to stream the diff without comments |

```

#### Example Usage

[](#example-usage-48)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$path = 'path';
$commitId = 'commitId';
$contextLines = -1;
$since = 'since';
$srcPath = 'srcPath';
$whitespace = 'whitespace';
$withComments = true;

$result = $repository->getRepositoryCommitDiffByPath($projectKey, $repositorySlug, $path, $commitId, $contextLines, $since, $srcPath, $whitespace, $withComments);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".RepositoryController.getRepositories1")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRepositories1

[](#-getrepositories1)

> 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.

```
function getRepositories1($projectKey)
```

#### Parameters

[](#parameters-49)

ParameterTagsDescriptionprojectKey`Required`the parent project key#### Example Usage

[](#example-usage-49)

```
$projectKey = 'projectKey';

$result = $repository->getRepositories1($projectKey);
```

[Back to List of Controllers](#list_of_controllers)

### [![Class: ](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67 ".AdminController")](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67) AdminController

[](#-admincontroller)

#### Get singleton instance

[](#get-singleton-instance-1)

The singleton instance of the `AdminController` class can be accessed from the API Client.

```
$admin = $client->getAdmin();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.getClusterInformation")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getClusterInformation

[](#-getclusterinformation)

> 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.

```
function getClusterInformation()
```

#### Example Usage

[](#example-usage-50)

```
$result = $admin->getClusterInformation();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.updateLicense")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateLicense

[](#-updatelicense)

> 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.

```
function updateLicense($dynamic)
```

#### Parameters

[](#parameters-50)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-51)

```
$dynamic = array('key' => 'value');

$result = $admin->updateLicense($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.deleteMailConfig")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteMailConfig

[](#-deletemailconfig)

> Deletes the current mail configuration.
>
>  The authenticated user must have the **SYS\_ADMIN** permission to call this resource.

```
function deleteMailConfig()
```

#### Example Usage

[](#example-usage-52)

```
$result = $admin->deleteMailConfig();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.getMailConfig")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getMailConfig

[](#-getmailconfig)

> Retrieves the current mail configuration.
>
> The authenticated user must have the **SYS\_ADMIN** permission to call this resource.

```
function getMailConfig()
```

#### Example Usage

[](#example-usage-53)

```
$result = $admin->getMailConfig();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.updateSetMailConfig")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateSetMailConfig

[](#-updatesetmailconfig)

> Updates the mail configuration
>
> The authenticated user must have the **SYS\_ADMIN** permission to call this resource.

```
function updateSetMailConfig($dynamic)
```

#### Parameters

[](#parameters-51)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-54)

```
$dynamic = array('key' => 'value');

$result = $admin->updateSetMailConfig($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.deleteClearSenderAddress")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteClearSenderAddress

[](#-deleteclearsenderaddress)

> Clears the server email address.
>
>  The authenticated user must have the **ADMIN** permission to call this resource.

```
function deleteClearSenderAddress()
```

#### Example Usage

[](#example-usage-55)

```
$result = $admin->deleteClearSenderAddress();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.getSenderAddress")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getSenderAddress

[](#-getsenderaddress)

> Retrieves the server email address

```
function getSenderAddress()
```

#### Example Usage

[](#example-usage-56)

```
$result = $admin->getSenderAddress();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.updateSetSenderAddress")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateSetSenderAddress

[](#-updatesetsenderaddress)

> Updates the server email address
>
> The authenticated user must have the **ADMIN** permission to call this resource.

```
function updateSetSenderAddress($dynamic)
```

#### Parameters

[](#parameters-52)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-57)

```
$dynamic = array('key' => 'value');

$result = $admin->updateSetSenderAddress($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.getUsersWithoutAnyPermission")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getUsersWithoutAnyPermission

[](#-getuserswithoutanypermission)

> Retrieve a page of users that have no granted global permissions.
>
>  The authenticated user must have **ADMIN** permission or higher to call this resource.

```
function getUsersWithoutAnyPermission($filter = null)
```

#### Parameters

[](#parameters-53)

ParameterTagsDescriptionfilter`Optional`if specified only user names containing the supplied string will be returned#### Example Usage

[](#example-usage-58)

```
$filter = 'filter';

$result = $admin->getUsersWithoutAnyPermission($filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.getGroupsWithAnyPermission")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getGroupsWithAnyPermission

[](#-getgroupswithanypermission)

> 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.

```
function getGroupsWithAnyPermission($filter = null)
```

#### Parameters

[](#parameters-54)

ParameterTagsDescriptionfilter`Optional`if specified only group names containing the supplied string will be returned#### Example Usage

[](#example-usage-59)

```
$filter = 'filter';

$result = $admin->getGroupsWithAnyPermission($filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.updateSetPermissionForGroups")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateSetPermissionForGroups

[](#-updatesetpermissionforgroups)

> Promote or demote a user's global permission level. Available global permissions are:
>
> - LICENSED\_USER
> - PROJECT\_CREATE
> - ADMIN
> - SYS\_ADMIN
>
>  See the [Stash documentation](https://confluence.atlassian.com/display/STASH/Global+permissions) 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.

```
function updateSetPermissionForGroups(
        $permission = null,
        $name = null)
```

#### Parameters

[](#parameters-55)

ParameterTagsDescriptionpermission`Optional`the permission to grantname`Optional`the names of the groups#### Example Usage

[](#example-usage-60)

```
$permission = 'permission';
$name = 'name';

$result = $admin->updateSetPermissionForGroups($permission, $name);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.deleteRevokePermissionsForGroup")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteRevokePermissionsForGroup

[](#-deleterevokepermissionsforgroup)

> 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.

```
function deleteRevokePermissionsForGroup($name = null)
```

#### Parameters

[](#parameters-56)

ParameterTagsDescriptionname`Optional`the name of the group#### Example Usage

[](#example-usage-61)

```
$name = 'name';

$result = $admin->deleteRevokePermissionsForGroup($name);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.getGroupsWithoutAnyPermission")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getGroupsWithoutAnyPermission

[](#-getgroupswithoutanypermission)

> Retrieve a page of groups that have no granted global permissions.
>
>  The authenticated user must have **ADMIN** permission or higher to call this resource.

```
function getGroupsWithoutAnyPermission($filter = null)
```

#### Parameters

[](#parameters-57)

ParameterTagsDescriptionfilter`Optional`if specified only group names containing the supplied string will be returned#### Example Usage

[](#example-usage-62)

```
$filter = 'filter';

$result = $admin->getGroupsWithoutAnyPermission($filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.getUsersWithAnyPermission")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getUsersWithAnyPermission

[](#-getuserswithanypermission)

> 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.

```
function getUsersWithAnyPermission($filter = null)
```

#### Parameters

[](#parameters-58)

ParameterTagsDescriptionfilter`Optional`if specified only user names containing the supplied string will be returned#### Example Usage

[](#example-usage-63)

```
$filter = 'filter';

$result = $admin->getUsersWithAnyPermission($filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.updateSetPermissionForUsers")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateSetPermissionForUsers

[](#-updatesetpermissionforusers)

> Promote or demote the global permission level of a user. Available global permissions are:
>
> - LICENSED\_USER
> - PROJECT\_CREATE
> - ADMIN
> - SYS\_ADMIN
>
>  See the [Stash documentation](https://confluence.atlassian.com/display/STASH/Global+permissions) 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.

```
function updateSetPermissionForUsers(
        $name = null,
        $permission = null)
```

#### Parameters

[](#parameters-59)

ParameterTagsDescriptionname`Optional`the names of the userspermission`Optional`the permission to grant#### Example Usage

[](#example-usage-64)

```
$name = 'name';
$permission = 'permission';

$result = $admin->updateSetPermissionForUsers($name, $permission);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.deleteRevokePermissionsForUser")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteRevokePermissionsForUser

[](#-deleterevokepermissionsforuser)

> 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.

```
function deleteRevokePermissionsForUser($name = null)
```

#### Parameters

[](#parameters-60)

ParameterTagsDescriptionname`Optional`the name of the user#### Example Usage

[](#example-usage-65)

```
$name = 'name';

$result = $admin->deleteRevokePermissionsForUser($name);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.getUsers")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getUsers

[](#-getusers)

> Retrieve a page of users.
>
>  The authenticated user must have the **LICENSED\_USER** permission to call this resource.

```
function getUsers($filter = null)
```

#### Parameters

[](#parameters-61)

ParameterTagsDescriptionfilter`Optional`if specified only users with usernames, display name or email addresses containing the supplied```
           string will be returned |

```

#### Example Usage

[](#example-usage-66)

```
$filter = 'filter';

$result = $admin->getUsers($filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.createUser")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createUser

[](#-createuser)

> 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.

```
function createUser(
        $name = null,
        $password = null,
        $displayName = null,
        $emailAddress = null,
        $addToDefaultGroup = true,
        $notify = null)
```

#### Parameters

[](#parameters-62)

ParameterTagsDescriptionname`Optional`the username for the new userpassword`Optional`the password for the new userdisplayName`Optional`the display name for the new useremailAddress`Optional`the e-mail address for the new useraddToDefaultGroup`Optional` `DefaultValue``true` 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 group |

```

| notify | `Optional` | if 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 |

#### Example Usage

[](#example-usage-67)

```
$name = 'name';
$password = 'password';
$displayName = 'displayName';
$emailAddress = 'emailAddress';
$addToDefaultGroup = true;
$notify = 'notify';

$result = $admin->createUser($name, $password, $displayName, $emailAddress, $addToDefaultGroup, $notify);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.deleteUser")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteUser

[](#-deleteuser)

> 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\_ADMIN**permissions.
>
>  The authenticated user must have the **ADMIN** permission to call this resource.

```
function deleteUser($name = null)
```

#### Parameters

[](#parameters-63)

ParameterTagsDescriptionname`Optional`the username identifying the user to delete#### Example Usage

[](#example-usage-68)

```
$name = 'name';

$result = $admin->deleteUser($name);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.updateUserDetails")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateUserDetails

[](#-updateuserdetails)

> Update a user's details.
>
>  The authenticated user must have the **ADMIN** permission to call this resource.

```
function updateUserDetails($dynamic)
```

#### Parameters

[](#parameters-64)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-69)

```
$dynamic = array('key' => 'value');

$result = $admin->updateUserDetails($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.createRenameUser")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createRenameUser

[](#-createrenameuser)

> Rename a user.
>
>  The authenticated user must have the **ADMIN** permission to call this resource.

```
function createRenameUser($dynamic)
```

#### Parameters

[](#parameters-65)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-70)

```
$dynamic = array('key' => 'value');

$result = $admin->createRenameUser($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.deleteClearUserCaptchaChallenge")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteClearUserCaptchaChallenge

[](#-deleteclearusercaptchachallenge)

> 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.

```
function deleteClearUserCaptchaChallenge($name = null)
```

#### Parameters

[](#parameters-66)

ParameterTagsDescriptionname`Optional`TODO: Add a parameter description#### Example Usage

[](#example-usage-71)

```
$name = 'name';

$result = $admin->deleteClearUserCaptchaChallenge($name);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.deleteGroup")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteGroup

[](#-deletegroup)

> 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.

```
function deleteGroup($name = null)
```

#### Parameters

[](#parameters-67)

ParameterTagsDescriptionname`Optional`the name identifying the group to delete#### Example Usage

[](#example-usage-72)

```
$name = 'name';

$result = $admin->deleteGroup($name);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.createGroup")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createGroup

[](#-creategroup)

> Create a new group.
>
>  The authenticated user must have **ADMIN** permission or higher to call this resource.

```
function createGroup($name = null)
```

#### Parameters

[](#parameters-68)

ParameterTagsDescriptionname`Optional`Name of the group.#### Example Usage

[](#example-usage-73)

```
$name = 'name';

$result = $admin->createGroup($name);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.getGroups")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getGroups

[](#-getgroups)

> Retrieve a page of groups.
>
>  The authenticated user must have **LICENSED\_USER** permission or higher to call this resource.

```
function getGroups($filter = null)
```

#### Parameters

[](#parameters-69)

ParameterTagsDescriptionfilter`Optional`if specified only group names containing the supplied string will be returned#### Example Usage

[](#example-usage-74)

```
$filter = 'filter';

$result = $admin->getGroups($filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.addUserToGroup")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) addUserToGroup

[](#-addusertogroup)

> **Deprecated since 2.10 for removal in 4.0**. Use {@code /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.

```
function addUserToGroup($dynamic)
```

#### Parameters

[](#parameters-70)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-75)

```
$dynamic = array('key' => 'value');

$result = $admin->addUserToGroup($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.addGroupToUser")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) addGroupToUser

[](#-addgrouptouser)

> **Deprecated since 2.10 for removal in 4.0**. Use {@code /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.

```
function addGroupToUser($dynamic)
```

#### Parameters

[](#parameters-71)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-76)

```
$dynamic = array('key' => 'value');

$result = $admin->addGroupToUser($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.addUsersToGroup")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) addUsersToGroup

[](#-adduserstogroup)

> Add multiple users to a group.
>
>  The authenticated user must have the **ADMIN** permission to call this resource.

```
function addUsersToGroup($dynamic)
```

#### Parameters

[](#parameters-72)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-77)

```
$dynamic = array('key' => 'value');

$result = $admin->addUsersToGroup($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.addUserToGroups")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) addUserToGroups

[](#-addusertogroups)

> Add a user to one or more groups.
>
>  The authenticated user must have the **ADMIN** permission to call this resource.

```
function addUserToGroups($dynamic)
```

#### Parameters

[](#parameters-73)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-78)

```
$dynamic = array('key' => 'value');

$result = $admin->addUserToGroups($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.createRemoveUserFromGroup")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createRemoveUserFromGroup

[](#-createremoveuserfromgroup)

> **Deprecated since 2.10 for removal in 3.0**. Use {@code /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.

```
function createRemoveUserFromGroup($dynamic)
```

#### Parameters

[](#parameters-74)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-79)

```
$dynamic = array('key' => 'value');

$result = $admin->createRemoveUserFromGroup($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.createRemoveGroupFromUser")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createRemoveGroupFromUser

[](#-createremovegroupfromuser)

> 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.

```
function createRemoveGroupFromUser($dynamic)
```

#### Parameters

[](#parameters-75)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-80)

```
$dynamic = array('key' => 'value');

$result = $admin->createRemoveGroupFromUser($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.findUsersInGroup")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) findUsersInGroup

[](#-findusersingroup)

> 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.

```
function findUsersInGroup(
        $context = null,
        $filter = null)
```

#### Parameters

[](#parameters-76)

ParameterTagsDescriptioncontext`Optional`the group which should be used to locate membersfilter`Optional`if specified only users with usernames, display names or email addresses containing the```
              supplied string will be returned |

```

#### Example Usage

[](#example-usage-81)

```
$context = 'context';
$filter = 'filter';

$result = $admin->findUsersInGroup($context, $filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.findUsersNotInGroup")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) findUsersNotInGroup

[](#-findusersnotingroup)

> 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.

```
function findUsersNotInGroup(
        $context = null,
        $filter = null)
```

#### Parameters

[](#parameters-77)

ParameterTagsDescriptioncontext`Optional`the group which should be used to locate non-membersfilter`Optional`if specified only users with usernames, display names or email addresses containing the```
              supplied string will be returned |

```

#### Example Usage

[](#example-usage-82)

```
$context = 'context';
$filter = 'filter';

$result = $admin->findUsersNotInGroup($context, $filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.findGroupsForUser")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) findGroupsForUser

[](#-findgroupsforuser)

> 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.

```
function findGroupsForUser(
        $context = null,
        $filter = null)
```

#### Parameters

[](#parameters-78)

ParameterTagsDescriptioncontext`Optional`the user which should be used to locate groupsfilter`Optional`if specified only groups with names containing the supplied string will be returned#### Example Usage

[](#example-usage-83)

```
$context = 'context';
$filter = 'filter';

$result = $admin->findGroupsForUser($context, $filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.findOtherGroupsForUser")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) findOtherGroupsForUser

[](#-findothergroupsforuser)

> 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.

```
function findOtherGroupsForUser(
        $context = null,
        $filter = null)
```

#### Parameters

[](#parameters-79)

ParameterTagsDescriptioncontext`Optional`the user which should be used to locate groupsfilter`Optional`if specified only groups with names containing the supplied string will be returned#### Example Usage

[](#example-usage-84)

```
$context = 'context';
$filter = 'filter';

$result = $admin->findOtherGroupsForUser($context, $filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.updateUserPassword")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateUserPassword

[](#-updateuserpassword)

> 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.

```
function updateUserPassword($dynamic)
```

#### Parameters

[](#parameters-80)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-85)

```
$dynamic = array('key' => 'value');

$result = $admin->updateUserPassword($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".AdminController.getLicense")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getLicense

[](#-getlicense)

> 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.

```
function getLicense()
```

#### Example Usage

[](#example-usage-86)

```
$result = $admin->getLicense();
```

[Back to List of Controllers](#list_of_controllers)

### [![Class: ](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67 ".PullRequestController")](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67) PullRequestController

[](#-pullrequestcontroller)

#### Get singleton instance

[](#get-singleton-instance-2)

The singleton instance of the `PullRequestController` class can be accessed from the API Client.

```
$pullRequest = $client->getPullRequest();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.deleteUnwatchPullRequest")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteUnwatchPullRequest

[](#-deleteunwatchpullrequest)

> 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.

```
function deleteUnwatchPullRequest(
        $projectKey,
        $repositorySlug,
        $pullRequestId)
```

#### Parameters

[](#parameters-81)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`the id of the pull request within the repository#### Example Usage

[](#example-usage-87)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;

$result = $pullRequest->deleteUnwatchPullRequest($projectKey, $repositorySlug, $pullRequestId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.createWatchPullRequest")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createWatchPullRequest

[](#-createwatchpullrequest)

> 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.

```
function createWatchPullRequest(
        $projectKey,
        $repositorySlug,
        $pullRequestId)
```

#### Parameters

[](#parameters-82)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`the id of the pull request within the repository#### Example Usage

[](#example-usage-88)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;

$result = $pullRequest->createWatchPullRequest($projectKey, $repositorySlug, $pullRequestId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.getPullRequestDiff")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getPullRequestDiff

[](#-getpullrequestdiff)

> 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.

```
function getPullRequestDiff(
        $projectKey,
        $repositorySlug,
        $pullRequestId,
        $contextLines = -1,
        $srcPath = null,
        $whitespace = null,
        $withComments = true)
```

#### Parameters

[](#parameters-83)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`TODO: Add a parameter descriptioncontextLines`Optional` `DefaultValue`the number of context lines to include around added/removed lines in the diffsrcPath`Optional`the previous path to the file, if the file has been copied, moved or renamedwhitespace`Optional`optional whitespace flag which can be set to `ignore-all`withComments`Optional` `DefaultValue``true` to embed comments in the diff (the default); otherwise, `false````
                 to stream the diff without comments |

```

#### Example Usage

[](#example-usage-89)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 'pullRequestId';
$contextLines = -1;
$srcPath = 'srcPath';
$whitespace = 'whitespace';
$withComments = true;

$result = $pullRequest->getPullRequestDiff($projectKey, $repositorySlug, $pullRequestId, $contextLines, $srcPath, $whitespace, $withComments);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.getPullRequestDiffByPath")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getPullRequestDiffByPath

[](#-getpullrequestdiffbypath)

> 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.

```
function getPullRequestDiffByPath(
        $projectKey,
        $repositorySlug,
        $pullRequestId,
        $path,
        $contextLines = -1,
        $srcPath = null,
        $whitespace = null,
        $withComments = true)
```

#### Parameters

[](#parameters-84)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`TODO: Add a parameter descriptionpath`Required`the path to the file which should be diffed (optional)contextLines`Optional` `DefaultValue`the number of context lines to include around added/removed lines in the diffsrcPath`Optional`the previous path to the file, if the file has been copied, moved or renamedwhitespace`Optional`optional whitespace flag which can be set to `ignore-all`withComments`Optional` `DefaultValue``true` to embed comments in the diff (the default); otherwise, `false````
                 to stream the diff without comments |

```

#### Example Usage

[](#example-usage-90)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 'pullRequestId';
$path = 'path';
$contextLines = -1;
$srcPath = 'srcPath';
$whitespace = 'whitespace';
$withComments = true;

$result = $pullRequest->getPullRequestDiffByPath($projectKey, $repositorySlug, $pullRequestId, $path, $contextLines, $srcPath, $whitespace, $withComments);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.getPullRequestCommits")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getPullRequestCommits

[](#-getpullrequestcommits)

> Retrieve changesets 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.

```
function getPullRequestCommits(
        $projectKey,
        $repositorySlug,
        $pullRequestId,
        $withCounts = null)
```

#### Parameters

[](#parameters-85)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`TODO: Add a parameter descriptionwithCounts`Optional`if set to true, the service will add "authorCount" and "totalCount" at the end of the page.```
                 "authorCount" is the number of different authors and "totalCount" is the total number of changesets. |

```

#### Example Usage

[](#example-usage-91)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;
$withCounts = true;

$result = $pullRequest->getPullRequestCommits($projectKey, $repositorySlug, $pullRequestId, $withCounts);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.getPullRequestTasks")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getPullRequestTasks

[](#-getpullrequesttasks)

> Retrieve the tasks associated with a pull request.

```
function getPullRequestTasks(
        $projectKey,
        $repositorySlug,
        $pullRequestId)
```

#### Parameters

[](#parameters-86)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-92)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 'pullRequestId';

$result = $pullRequest->getPullRequestTasks($projectKey, $repositorySlug, $pullRequestId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.getCountPullRequestTasks")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getCountPullRequestTasks

[](#-getcountpullrequesttasks)

> Retrieve the total number of {@link com.atlassian.stash.task.TaskState#OPEN open} and {@link com.atlassian.stash.task.TaskState#RESOLVED resolved} tasks associated with a pull request.

```
function getCountPullRequestTasks(
        $projectKey,
        $repositorySlug,
        $pullRequestId)
```

#### Parameters

[](#parameters-87)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-93)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 'pullRequestId';

$result = $pullRequest->getCountPullRequestTasks($projectKey, $repositorySlug, $pullRequestId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.createPullRequestComment")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createPullRequestComment

[](#-createpullrequestcomment)

> Add a new comment.
>
>  Comments can be added in a few places by setting different attributes:
>
>  General pull request comment:
>
> ```
>      {
>          "text": "An insightful general comment on a pull request."
>      }
>
> ```
>
> Reply to a comment:
>
>  ```
>      {
>          "text": "A measured reply.",
>          "parent": {
>              "id": 1
>          }
>      }
>
> ```
>
> General file comment:
>
>  ```
>      {
>          "text": "An insightful general comment on a file.",
>          "anchor": {
>              "path": "path/to/file",
>              "srcPath": "path/to/file"
>          }
>      }
>
> ```
>
> File line comment:
>
>  ```
>      {
>          "text": "A pithy comment on a particular line within a file.",
>          "anchor": {
>              "line": 1,
>              "lineType": "CONTEXT",
>              "fileType": "FROM"
>              "path": "path/to/file",
>              "srcPath": "path/to/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).
>
>  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.

```
function createPullRequestComment(
        $dynamic,
        $projectKey,
        $repositorySlug,
        $pullRequestId)
```

#### Parameters

[](#parameters-88)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-94)

```
$dynamic = array('key' => 'value');
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;

$result = $pullRequest->createPullRequestComment($dynamic, $projectKey, $repositorySlug, $pullRequestId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.getPullRequestComments")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getPullRequestComments

[](#-getpullrequestcomments)

> TODO: Add a method description

```
function getPullRequestComments(
        $projectKey,
        $repositorySlug,
        $pullRequestId,
        $path = null)
```

#### Parameters

[](#parameters-89)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`TODO: Add a parameter descriptionpath`Optional`TODO: Add a parameter description#### Example Usage

[](#example-usage-95)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;
$path = 'path';

$result = $pullRequest->getPullRequestComments($projectKey, $repositorySlug, $pullRequestId, $path);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.updatePullRequestComment")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updatePullRequestComment

[](#-updatepullrequestcomment)

> 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.

```
function updatePullRequestComment(
        $dynamic,
        $projectKey,
        $repositorySlug,
        $pullRequestId,
        $commentId)
```

#### Parameters

[](#parameters-90)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`the id of the pull request within the repositorycommentId`Required`the id of the comment to retrieve#### Example Usage

[](#example-usage-96)

```
$dynamic = array('key' => 'value');
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;
$commentId = 234;

$result = $pullRequest->updatePullRequestComment($dynamic, $projectKey, $repositorySlug, $pullRequestId, $commentId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.deletePullRequestComment")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deletePullRequestComment

[](#-deletepullrequestcomment)

> 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.

```
function deletePullRequestComment(
        $projectKey,
        $repositorySlug,
        $pullRequestId,
        $commentId,
        $version = -1)
```

#### Parameters

[](#parameters-91)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`the id of the pull request within the repositorycommentId`Required`the id of the comment to retrieveversion`Optional` `DefaultValue`The expected version of the comment. This must match the server's version of the comment or```
                  the delete will fail. To determine the current version of the comment, the comment should be
                  fetched from the server prior to the delete. Look for the 'version' attribute in the
                  returned JSON structure. |

```

#### Example Usage

[](#example-usage-97)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;
$commentId = 234;
$version = -1;

$result = $pullRequest->deletePullRequestComment($projectKey, $repositorySlug, $pullRequestId, $commentId, $version);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.getPullRequestComment")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getPullRequestComment

[](#-getpullrequestcomment)

> 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.

```
function getPullRequestComment(
        $projectKey,
        $repositorySlug,
        $pullRequestId,
        $commentId)
```

#### Parameters

[](#parameters-92)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`the id of the pull request within the repositorycommentId`Required`the id of the comment to retrieve#### Example Usage

[](#example-usage-98)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;
$commentId = 234;

$result = $pullRequest->getPullRequestComment($projectKey, $repositorySlug, $pullRequestId, $commentId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.getPullRequestChanges")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getPullRequestChanges

[](#-getpullrequestchanges)

> Gets changes for the specified PullRequest.
>
>  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.

```
function getPullRequestChanges(
        $projectKey,
        $repositorySlug,
        $pullRequestId,
        $withComments = true)
```

#### Parameters

[](#parameters-93)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`TODO: Add a parameter descriptionwithComments`Optional` `DefaultValue`{@code true} to apply comment counts in the changes (the default); otherwise, {@code false}```
                 to stream changes without comment counts |

```

#### Example Usage

[](#example-usage-99)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 'pullRequestId';
$withComments = true;

$result = $pullRequest->getPullRequestChanges($projectKey, $repositorySlug, $pullRequestId, $withComments);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.getPullRequests")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getPullRequests

[](#-getpullrequests)

> Retrieve a page of pull requests to or from the specified repository.
>
>  The authenticated user must have **REPO\_READ** permission for the specified repository to call this resource.
>
> Optionally clients can specify PR participant filters. Each filter has a mandatory {@code username.N} parameter, and the optional {@code role.N} and {@code approved.N} parameters.
>
> - {@code 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 as {@code username.1}, {@code 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.
> - {@code role.N}(optional) the role associated with {@code username.N}. This must be one of {@code AUTHOR}, {@code REVIEWER}, or{@code PARTICIPANT}
> - {@code approved.N}(optional) the approved status associated with {@code username.N}. That is whether {@code username.N} has approved the PR. Either {@code true}, or {@code false}

```
function getPullRequests(
        $projectKey,
        $repositorySlug,
        $direction = 'incoming',
        $at = null,
        $state = null,
        $order = null,
        $withAttributes = true,
        $withProperties = true)
```

#### Parameters

[](#parameters-94)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptiondirection`Optional` `DefaultValue`(optional, defaults to **INCOMING**) the direction relative to the specified```
              repository. Either INCOMING or OUTGOING. |

```

| at | `Optional` | (optional) a *fully-qualified* branch ID to find pull requests to or from, such as {@code refs/heads/master} | | state | `Optional` | (optional, defaults to **OPEN**). Supply **ALL** to return pull request in any state. If a state is supplied only pull requests in the specified state will be returned. Either **OPEN**, **DECLINED** or **MERGED**. | | order | `Optional` | (optional) the order to return pull requests in, either **OLDEST** (as in: "oldest first") or **NEWEST**. | | withAttributes | `Optional` `DefaultValue` | (optional) defaults to true, whether to return additional pull request attributes | | withProperties | `Optional` `DefaultValue` | (optional) defaults to true, whether to return additional pull request properties |

#### Example Usage

[](#example-usage-100)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$direction = 'incoming';
$at = 'at';
$state = 'state';
$order = 'order';
$withAttributes = true;
$withProperties = true;

$result = $pullRequest->getPullRequests($projectKey, $repositorySlug, $direction, $at, $state, $order, $withAttributes, $withProperties);
```

#### Errors

[](#errors)

Error CodeError Description400The request was malformed.401The currently authenticated user has insufficient permissions to view the specified pull request.404The specified repository or pull request does not exist.0Something goes wrong.#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.createDeclinePullRequest")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createDeclinePullRequest

[](#-createdeclinepullrequest)

> Decline a pull request.
>
>  The authenticated user must have **REPO\_READ** permission for the repository that this pull request targets to call this resource.

```
function createDeclinePullRequest(
        $projectKey,
        $repositorySlug,
        $pullRequestId,
        $version = -1)
```

#### Parameters

[](#parameters-95)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`TODO: Add a parameter descriptionversion`Optional` `DefaultValue`the current version of the pull request. If the server's version isn't the same as the specified```
            version the operation will fail. To determine the current version of the pull request it should be
            fetched from the server prior to this operation. Look for the 'version' attribute in the returned
            JSON structure. |

```

#### Example Usage

[](#example-usage-101)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;
$version = -1;

$result = $pullRequest->createDeclinePullRequest($projectKey, $repositorySlug, $pullRequestId, $version);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.getPullRequestActivities")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getPullRequestActivities

[](#-getpullrequestactivities)

> 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.

```
function getPullRequestActivities(
        $projectKey,
        $repositorySlug,
        $pullRequestId,
        $fromId = null,
        $fromType = null)
```

#### Parameters

[](#parameters-96)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`the id of the pull request within the repositoryfromId`Optional`(optional) the id of the activity item to use as the first item in the returned pagefromType`Optional`(required if **fromId** is present) the type of the activity item specified by```
             fromId (either COMMENT or ACTIVITY) |

```

#### Example Usage

[](#example-usage-102)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;
$fromId = 234;
$fromType = 'fromType';

$result = $pullRequest->getPullRequestActivities($projectKey, $repositorySlug, $pullRequestId, $fromId, $fromType);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.createReopenPullRequest")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createReopenPullRequest

[](#-createreopenpullrequest)

> 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.

```
function createReopenPullRequest(
        $projectKey,
        $repositorySlug,
        $pullRequestId,
        $version = -1)
```

#### Parameters

[](#parameters-97)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`the id of the pull request within the repositoryversion`Optional` `DefaultValue`the current version of the pull request. If the server's version isn't the same as the specified```
            version the operation will fail. To determine the current version of the pull request it should be
            fetched from the server prior to this operation. Look for the 'version' attribute in the returned
            JSON structure. |

```

#### Example Usage

[](#example-usage-103)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;
$version = -1;

$result = $pullRequest->createReopenPullRequest($projectKey, $repositorySlug, $pullRequestId, $version);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.getCanMergePullRequest")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getCanMergePullRequest

[](#-getcanmergepullrequest)

> 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.

```
function getCanMergePullRequest(
        $projectKey,
        $repositorySlug,
        $pullRequestId)
```

#### Parameters

[](#parameters-98)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`the id of the pull request within the repository#### Example Usage

[](#example-usage-104)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;

$result = $pullRequest->getCanMergePullRequest($projectKey, $repositorySlug, $pullRequestId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.createMergePullRequest")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createMergePullRequest

[](#-createmergepullrequest)

> 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.

```
function createMergePullRequest(
        $projectKey,
        $repositorySlug,
        $pullRequestId,
        $version = -1)
```

#### Parameters

[](#parameters-99)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`the id of the pull request within the repositoryversion`Optional` `DefaultValue`the current version of the pull request. If the server's version isn't the same as the specified```
            version the operation will fail. To determine the current version of the pull request it should be
            fetched from the server prior to this operation. Look for the 'version' attribute in the returned
            JSON structure. |

```

#### Example Usage

[](#example-usage-105)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;
$version = -1;

$result = $pullRequest->createMergePullRequest($projectKey, $repositorySlug, $pullRequestId, $version);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.getPullRequest")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getPullRequest

[](#-getpullrequest)

> Retrieve a pull request.
>
>  The authenticated user must have **REPO\_READ** permission for the repository that this pull request targets to call this resource.

```
function getPullRequest(
        $projectKey,
        $repositorySlug,
        $pullRequestId)
```

#### Parameters

[](#parameters-100)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-106)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 'pullRequestId';

$result = $pullRequest->getPullRequest($projectKey, $repositorySlug, $pullRequestId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.updatePullRequest")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updatePullRequest

[](#-updatepullrequest)

> 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.

```
function updatePullRequest(
        $dynamic,
        $projectKey,
        $repositorySlug,
        $pullRequestId)
```

#### Parameters

[](#parameters-101)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-107)

```
$dynamic = array('key' => 'value');
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 'pullRequestId';

$result = $pullRequest->updatePullRequest($dynamic, $projectKey, $repositorySlug, $pullRequestId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.createAssignPullRequestParticipantRole")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createAssignPullRequestParticipantRole

[](#-createassignpullrequestparticipantrole)

> 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.

```
function createAssignPullRequestParticipantRole(
        $dynamic,
        $projectKey,
        $repositorySlug,
        $pullRequestId)
```

#### Parameters

[](#parameters-102)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`the id of the pull request within the repository#### Example Usage

[](#example-usage-108)

```
$dynamic = array('key' => 'value');
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;

$result = $pullRequest->createAssignPullRequestParticipantRole($dynamic, $projectKey, $repositorySlug, $pullRequestId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.deleteUnassignPullRequestParticipantRole")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteUnassignPullRequestParticipantRole

[](#-deleteunassignpullrequestparticipantrole)

> 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.

```
function deleteUnassignPullRequestParticipantRole(
        $projectKey,
        $repositorySlug,
        $pullRequestId,
        $username = null)
```

#### Parameters

[](#parameters-103)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`the id of the pull request within the repositoryusername`Optional`the participant's user name#### Example Usage

[](#example-usage-109)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;
$username = 'username';

$result = $pullRequest->deleteUnassignPullRequestParticipantRole($projectKey, $repositorySlug, $pullRequestId, $username);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.listPullRequestParticipants")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) listPullRequestParticipants

[](#-listpullrequestparticipants)

> 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.

```
function listPullRequestParticipants(
        $projectKey,
        $repositorySlug,
        $pullRequestId)
```

#### Parameters

[](#parameters-104)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`the id of the pull request within the repository#### Example Usage

[](#example-usage-110)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;

$result = $pullRequest->listPullRequestParticipants($projectKey, $repositorySlug, $pullRequestId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.createApprovePullRequest")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createApprovePullRequest

[](#-createapprovepullrequest)

> 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.

```
function createApprovePullRequest(
        $projectKey,
        $repositorySlug,
        $pullRequestId)
```

#### Parameters

[](#parameters-105)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`the id of the pull request within the repository#### Example Usage

[](#example-usage-111)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 234;

$result = $pullRequest->createApprovePullRequest($projectKey, $repositorySlug, $pullRequestId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.deleteWithdrawPullRequestApproval")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteWithdrawPullRequestApproval

[](#-deletewithdrawpullrequestapproval)

> 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.

```
function deleteWithdrawPullRequestApproval(
        $projectKey,
        $repositorySlug,
        $pullRequestId)
```

#### Parameters

[](#parameters-106)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter descriptionpullRequestId`Required`the id of the pull request within the repository#### Example Usage

[](#example-usage-112)

```
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';
$pullRequestId = 192;

$result = $pullRequest->deleteWithdrawPullRequestApproval($projectKey, $repositorySlug, $pullRequestId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".PullRequestController.createPullRequest")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createPullRequest

[](#-createpullrequest)

> Create a new pull request between two branches. The branches may be in the same repository, or different ones. When using different repositories, they must still be in the same {@link Repository#getHierarchyId() hierarchy}.
>
>  The authenticated user must have **REPO\_READ** permission for the "from" and "to"repositories to call this resource.

```
function createPullRequest(
        $pullRequest,
        $projectKey,
        $repositorySlug)
```

#### Parameters

[](#parameters-107)

ParameterTagsDescriptionpullRequest`Required`TODO: Add a parameter descriptionprojectKey`Required`TODO: Add a parameter descriptionrepositorySlug`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-113)

```
$pullRequest = new PullRequest();
$projectKey = 'projectKey';
$repositorySlug = 'repositorySlug';

$result = $pullRequest->createPullRequest($pullRequest, $projectKey, $repositorySlug);
```

#### Errors

[](#errors-1)

Error CodeError Description400The pull request entity supplied in the request was malformed.401The currently authenticated user has insufficient permissions to create a pull request between the two specified repositories.404One of the specified repositories or branches does not exist.409One 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.0Something goes wrong.[Back to List of Controllers](#list_of_controllers)

### [![Class: ](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67 ".HookController")](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67) HookController

[](#-hookcontroller)

#### Get singleton instance

[](#get-singleton-instance-3)

The singleton instance of the `HookController` class can be accessed from the API Client.

```
$hook = $client->getHook();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".HookController.getAvatar")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getAvatar

[](#-getavatar)

> Retrieve the avatar for the project matching the supplied **moduleKey**.

```
function getAvatar(
        $hookKey,
        $version = null)
```

#### Parameters

[](#parameters-108)

ParameterTagsDescriptionhookKey`Required`the complete module key of the hook moduleversion`Optional`optional version used for HTTP caching only - any non-blank version will result in a large max-age Cache-Control header.```
            Note that this does not affect the Last-Modified header. |

```

#### Example Usage

[](#example-usage-114)

```
$hookKey = 'hookKey';
$version = 'version';

$result = $hook->getAvatar($hookKey, $version);
```

[Back to List of Controllers](#list_of_controllers)

### [![Class: ](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67 ".ProjectController")](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67) ProjectController

[](#-projectcontroller)

#### Get singleton instance

[](#get-singleton-instance-4)

The singleton instance of the `ProjectController` class can be accessed from the API Client.

```
$project = $client->getProject();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.getProjectGroupsWithAnyPermission")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getProjectGroupsWithAnyPermission

[](#-getprojectgroupswithanypermission)

> 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.

```
function getProjectGroupsWithAnyPermission(
        $projectKey,
        $filter = null)
```

#### Parameters

[](#parameters-109)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionfilter`Optional`if specified only group names containing the supplied string will be returned#### Example Usage

[](#example-usage-115)

```
$projectKey = 'projectKey';
$filter = 'filter';

$result = $project->getProjectGroupsWithAnyPermission($projectKey, $filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.updateSetProjectPermissionForGroups")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateSetProjectPermissionForGroups

[](#-updatesetprojectpermissionforgroups)

> Promote or demote a group's permission level for the specified project. Available project permissions are:
>
> - PROJECT\_READ
> - PROJECT\_WRITE
> - PROJECT\_ADMIN
>
>  See the [Stash documentation](https://confluence.atlassian.com/display/STASH/Managing+permissions+for+a+project) for a detailed explanation of what each permission entails.  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.

```
function updateSetProjectPermissionForGroups(
        $projectKey,
        $permission = null,
        $name = null)
```

#### Parameters

[](#parameters-110)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionpermission`Optional`the permission to grantname`Optional`the names of the groups#### Example Usage

[](#example-usage-116)

```
$projectKey = 'projectKey';
$permission = 'permission';
$name = 'name';

$result = $project->updateSetProjectPermissionForGroups($projectKey, $permission, $name);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.deleteRevokeProjectPermissionsForGroup")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteRevokeProjectPermissionsForGroup

[](#-deleterevokeprojectpermissionsforgroup)

> 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.

```
function deleteRevokeProjectPermissionsForGroup(
        $projectKey,
        $name = null)
```

#### Parameters

[](#parameters-111)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionname`Optional`the name of the group#### Example Usage

[](#example-usage-117)

```
$projectKey = 'projectKey';
$name = 'name';

$result = $project->deleteRevokeProjectPermissionsForGroup($projectKey, $name);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.getProjectGroupsWithoutAnyPermission")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getProjectGroupsWithoutAnyPermission

[](#-getprojectgroupswithoutanypermission)

> 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.

```
function getProjectGroupsWithoutAnyPermission(
        $projectKey,
        $filter = null)
```

#### Parameters

[](#parameters-112)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionfilter`Optional`if specified only group names containing the supplied string will be returned#### Example Usage

[](#example-usage-118)

```
$projectKey = 'projectKey';
$filter = 'filter';

$result = $project->getProjectGroupsWithoutAnyPermission($projectKey, $filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.getProjectUsersWithAnyPermission")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getProjectUsersWithAnyPermission

[](#-getprojectuserswithanypermission)

> 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.

```
function getProjectUsersWithAnyPermission(
        $projectKey,
        $filter = null)
```

#### Parameters

[](#parameters-113)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionfilter`Optional`if specified only group names containing the supplied string will be returned#### Example Usage

[](#example-usage-119)

```
$projectKey = 'projectKey';
$filter = 'filter';

$result = $project->getProjectUsersWithAnyPermission($projectKey, $filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.updateSetProjectPermissionForUsers")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateSetProjectPermissionForUsers

[](#-updatesetprojectpermissionforusers)

> Promote or demote a user's permission level for the specified project. Available project permissions are:
>
> - PROJECT\_READ
> - PROJECT\_WRITE
> - PROJECT\_ADMIN
>
>  See the [Stash documentation](https://confluence.atlassian.com/display/STASH/Managing+permissions+for+a+project) for a detailed explanation of what each permission entails.  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.

```
function updateSetProjectPermissionForUsers(
        $projectKey,
        $name = null,
        $permission = null)
```

#### Parameters

[](#parameters-114)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionname`Optional`the names of the userspermission`Optional`the permission to grant#### Example Usage

[](#example-usage-120)

```
$projectKey = 'projectKey';
$name = 'name';
$permission = 'permission';

$result = $project->updateSetProjectPermissionForUsers($projectKey, $name, $permission);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.deleteRevokeProjectPermissionsForUser")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteRevokeProjectPermissionsForUser

[](#-deleterevokeprojectpermissionsforuser)

> 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.

```
function deleteRevokeProjectPermissionsForUser(
        $projectKey,
        $name = null)
```

#### Parameters

[](#parameters-115)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionname`Optional`the name of the user#### Example Usage

[](#example-usage-121)

```
$projectKey = 'projectKey';
$name = 'name';

$result = $project->deleteRevokeProjectPermissionsForUser($projectKey, $name);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.getProjectUsersWithoutPermission")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getProjectUsersWithoutPermission

[](#-getprojectuserswithoutpermission)

> 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.

```
function getProjectUsersWithoutPermission(
        $projectKey,
        $filter = null)
```

#### Parameters

[](#parameters-116)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionfilter`Optional`if specified only group names containing the supplied string will be returned#### Example Usage

[](#example-usage-122)

```
$projectKey = 'projectKey';
$filter = 'filter';

$result = $project->getProjectUsersWithoutPermission($projectKey, $filter);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.getHasProjectAllUserPermission")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getHasProjectAllUserPermission

[](#-gethasprojectalluserpermission)

> Check whether the specified permission is the default permission (granted to all users) for a project. Available project permissions are:
>
> - PROJECT\_READ
> - PROJECT\_WRITE
> - PROJECT\_ADMIN
>
>  The authenticated user must have **PROJECT\_ADMIN** permission for the specified project or a higher global permission to call this resource.

```
function getHasProjectAllUserPermission(
        $projectKey,
        $permission)
```

#### Parameters

[](#parameters-117)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionpermission`Required`the permission to grant#### Example Usage

[](#example-usage-123)

```
$projectKey = 'projectKey';
$permission = 'permission';

$result = $project->getHasProjectAllUserPermission($projectKey, $permission);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.modifyProjectAllUserPermission")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) modifyProjectAllUserPermission

[](#-modifyprojectalluserpermission)

> Grant or revoke a project permission to all users, i.e. set the default permission. Available project permissions are:
>
> - PROJECT\_READ
> - PROJECT\_WRITE
> - PROJECT\_ADMIN
>
>  The authenticated user must have **PROJECT\_ADMIN** permission for the specified project or a higher global permission to call this resource.

```
function modifyProjectAllUserPermission(
        $projectKey,
        $permission,
        $allow = null)
```

#### Parameters

[](#parameters-118)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptionpermission`Required`the permission to grantallow`Optional`*true* to grant the specified permission to all users, or *false* to revoke it#### Example Usage

[](#example-usage-124)

```
$projectKey = 'projectKey';
$permission = 'permission';
$allow = true;

$result = $project->modifyProjectAllUserPermission($projectKey, $permission, $allow);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.createProject")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createProject

[](#-createproject)

> 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.

```
function createProject($dynamic)
```

#### Parameters

[](#parameters-119)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-125)

```
$dynamic = array('key' => 'value');

$result = $project->createProject($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.getProjects")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getProjects

[](#-getprojects)

> Retrieve a page of projects.
>
>  Only projects for which the authenticated user has the **PROJECT\_VIEW** permission will be returned.

```
function getProjects(
        $name = null,
        $permission = null)
```

#### Parameters

[](#parameters-120)

ParameterTagsDescriptionname`Optional`TODO: Add a parameter descriptionpermission`Optional`TODO: Add a parameter description#### Example Usage

[](#example-usage-126)

```
$name = 'name';
$permission = 'permission';

$result = $project->getProjects($name, $permission);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.deleteProject")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteProject

[](#-deleteproject)

> Delete the project matching the supplied **projectKey**.
>
>  The authenticated user must have **PROJECT\_ADMIN** permission for the specified project to call this resource.

```
function deleteProject($projectKey)
```

#### Parameters

[](#parameters-121)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-127)

```
$projectKey = 'projectKey';

$result = $project->deleteProject($projectKey);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.updateProject")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateProject

[](#-updateproject)

> 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.

```
function updateProject(
        $dynamic,
        $projectKey)
```

#### Parameters

[](#parameters-122)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptionprojectKey`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-128)

```
$dynamic = array('key' => 'value');
$projectKey = 'projectKey';

$result = $project->updateProject($dynamic, $projectKey);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.getProject")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getProject

[](#-getproject)

> Retrieve the project matching the supplied **projectKey**.
>
>  The authenticated user must have **PROJECT\_VIEW** permission for the specified project to call this resource.

```
function getProject($projectKey)
```

#### Parameters

[](#parameters-123)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-129)

```
$projectKey = 'projectKey';

$result = $project->getProject($projectKey);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.getProjectAvatar")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getProjectAvatar

[](#-getprojectavatar)

> 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.

```
function getProjectAvatar(
        $projectKey,
        $s = 0)
```

#### Parameters

[](#parameters-124)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter descriptions`Optional` `DefaultValue`The desired size of the image. The server will return an image as close as possible to the specified```
         size. |

```

#### Example Usage

[](#example-usage-130)

```
$projectKey = 'projectKey';
$s = 0;

$result = $project->getProjectAvatar($projectKey, $s);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProjectController.uploadProjectAvatar")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) uploadProjectAvatar

[](#-uploadprojectavatar)

> 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.
>
>  An example [curl](http://curl.haxx.se/) request to upload an image name 'avatar.png' would be:
>
> ```
>  curl -X POST -u username:password 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.

```
function uploadProjectAvatar($projectKey)
```

#### Parameters

[](#parameters-125)

ParameterTagsDescriptionprojectKey`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-131)

```
$projectKey = 'projectKey';

$result = $project->uploadProjectAvatar($projectKey);
```

[Back to List of Controllers](#list_of_controllers)

### [![Class: ](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67 ".TaskController")](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67) TaskController

[](#-taskcontroller)

#### Get singleton instance

[](#get-singleton-instance-5)

The singleton instance of the `TaskController` class can be accessed from the API Client.

```
$task = $client->getTask();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".TaskController.createTask")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createTask

[](#-createtask)

> Create a new task.

```
function createTask($dynamic)
```

#### Parameters

[](#parameters-126)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-132)

```
$dynamic = array('key' => 'value');

$result = $task->createTask($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".TaskController.deleteTask")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteTask

[](#-deletetask)

> 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.

```
function deleteTask($taskId)
```

#### Parameters

[](#parameters-127)

ParameterTagsDescriptiontaskId`Required`the id identifying the task to delete#### Example Usage

[](#example-usage-133)

```
$taskId = 192;

$result = $task->deleteTask($taskId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".TaskController.updateTask")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateTask

[](#-updatetask)

> 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.

```
function updateTask(
        $dynamic,
        $taskId)
```

#### Parameters

[](#parameters-128)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptiontaskId`Required`the id identifying the task to delete#### Example Usage

[](#example-usage-134)

```
$dynamic = array('key' => 'value');
$taskId = 192;

$result = $task->updateTask($dynamic, $taskId);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".TaskController.getTask")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getTask

[](#-gettask)

> Retrieve a existing task.

```
function getTask($taskId)
```

#### Parameters

[](#parameters-129)

ParameterTagsDescriptiontaskId`Required`the id identifying the task to delete#### Example Usage

[](#example-usage-135)

```
$taskId = 192;

$result = $task->getTask($taskId);
```

[Back to List of Controllers](#list_of_controllers)

### [![Class: ](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67 ".GroupController")](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67) GroupController

[](#-groupcontroller)

#### Get singleton instance

[](#get-singleton-instance-6)

The singleton instance of the `GroupController` class can be accessed from the API Client.

```
$group = $client->getGroup();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".GroupController.getGroups")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getGroups

[](#-getgroups-1)

> Retrieve a page of group names.
>
>  The authenticated user must have **PROJECT\_ADMIN** permission or higher to call this resource.

```
function getGroups($filter = null)
```

#### Parameters

[](#parameters-130)

ParameterTagsDescriptionfilter`Optional`if specified only group names containing the supplied string will be returned#### Example Usage

[](#example-usage-136)

```
$filter = 'filter';

$result = $group->getGroups($filter);
```

[Back to List of Controllers](#list_of_controllers)

### [![Class: ](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67 ".ProfileController")](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67) ProfileController

[](#-profilecontroller)

#### Get singleton instance

[](#get-singleton-instance-7)

The singleton instance of the `ProfileController` class can be accessed from the API Client.

```
$profile = $client->getProfile();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ProfileController.getProfileRepositoriesRecentlyAccessed")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getProfileRepositoriesRecentlyAccessed

[](#-getprofilerepositoriesrecentlyaccessed)

> 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.

```
function getProfileRepositoriesRecentlyAccessed($permission = null)
```

#### Parameters

[](#parameters-131)

ParameterTagsDescriptionpermission`Optional`(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. |

```

#### Example Usage

[](#example-usage-137)

```
$permission = 'permission';

$result = $profile->getProfileRepositoriesRecentlyAccessed($permission);
```

[Back to List of Controllers](#list_of_controllers)

### [![Class: ](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67 ".ApplicationController")](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67) ApplicationController

[](#-applicationcontroller)

#### Get singleton instance

[](#get-singleton-instance-8)

The singleton instance of the `ApplicationController` class can be accessed from the API Client.

```
$application = $client->getApplication();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".ApplicationController.getApplicationProperties")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getApplicationProperties

[](#-getapplicationproperties)

> Retrieve version information and other application properties.
>
>  No authentication is required to call this resource.

```
function getApplicationProperties()
```

#### Example Usage

[](#example-usage-138)

```
$result = $application->getApplicationProperties();
```

[Back to List of Controllers](#list_of_controllers)

### [![Class: ](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67 ".LogController")](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67) LogController

[](#-logcontroller)

#### Get singleton instance

[](#get-singleton-instance-9)

The singleton instance of the `LogController` class can be accessed from the API Client.

```
$log = $client->getLog();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".LogController.getRootLevel")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getRootLevel

[](#-getrootlevel)

> Retrieve the current log level for the root logger.
>
>  The authenticated user must have **ADMIN** permission or higher to call this resource.

```
function getRootLevel()
```

#### Example Usage

[](#example-usage-139)

```
$result = $log->getRootLevel();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".LogController.updateSetRootLevel")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateSetRootLevel

[](#-updatesetrootlevel)

> Set the current log level for the root logger.
>
>  The authenticated user must have **ADMIN** permission or higher to call this resource.

```
function updateSetRootLevel($levelName)
```

#### Parameters

[](#parameters-132)

ParameterTagsDescriptionlevelName`Required`the level to set the logger to. Either TRACE, DEBUG, INFO, WARN or ERROR#### Example Usage

[](#example-usage-140)

```
$levelName = 'levelName';

$result = $log->updateSetRootLevel($levelName);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".LogController.getLevel")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getLevel

[](#-getlevel)

> Retrieve the current log level for a given logger.
>
>  The authenticated user must have **ADMIN** permission or higher to call this resource.

```
function getLevel($loggerName)
```

#### Parameters

[](#parameters-133)

ParameterTagsDescriptionloggerName`Required`the name of the logger.#### Example Usage

[](#example-usage-141)

```
$loggerName = 'loggerName';

$result = $log->getLevel($loggerName);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".LogController.updateSetLevel")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateSetLevel

[](#-updatesetlevel)

> Set the current log level for a given logger.
>
>  The authenticated user must have **ADMIN** permission or higher to call this resource.

```
function updateSetLevel(
        $levelName,
        $loggerName)
```

#### Parameters

[](#parameters-134)

ParameterTagsDescriptionlevelName`Required`the level to set the logger to. Either TRACE, DEBUG, INFO, WARN or ERRORloggerName`Required`the name of the logger.#### Example Usage

[](#example-usage-142)

```
$levelName = 'levelName';
$loggerName = 'loggerName';

$result = $log->updateSetLevel($levelName, $loggerName);
```

[Back to List of Controllers](#list_of_controllers)

### [![Class: ](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67 ".UserController")](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67) UserController

[](#-usercontroller)

#### Get singleton instance

[](#get-singleton-instance-10)

The singleton instance of the `UserController` class can be accessed from the API Client.

```
$user = $client->getUser();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".UserController.getUsers")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getUsers

[](#-getusers-1)

> Retrieve a page of users, optionally run through provided filters.
>
>  Only authenticated users may call this resource.
>
> ### Supported Filters
>
> [](#supported-filters)
>
>  Filters are provided in query parameters in a standard `name=value` fashion. The following filters are currently supported:
>
> - {@code filter} - return only users, whose username, name or email address *contain* the {@code filter} value
> - {@code permission} - 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 with `permission.`. See the section "Permission Filters" below for more details.
> - {@code permission.N} - the "root" of a single permission filter, similar to the {@code permission} parameter, where "N" is a natural number starting from 1. This allows clients to specify multiple permission filters, by providing consecutive filters as {@code permission.1}, {@code 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
>
> [](#permission-filters)
>
>  The following three sub-sections list parameters supported for permission filters (where `[root]` is the root permission filter name, e.g. {@code permission}, {@code permission.1} etc.) depending on the permission resource. The system determines which filter to apply (Global, Project or Repository permission) based on the `[root]` permission value. E.g. {@code ADMIN} is a global permission, {@code PROJECT\_ADMIN} is a project permission and {@code REPO\_ADMIN} is a repository permission. Note that the parameters for a given resource will be looked up in the order as they are listed below, that is e.g. for a project resource, if both {@code projectId} and {@code projectKey} are provided, the system will use {@code projectId} for the lookup.
>
> #### Global permissions
>
> [](#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
>
> [](#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
>
> [](#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`.

```
function getUsers()
```

#### Example Usage

[](#example-usage-143)

```
$result = $user->getUsers();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".UserController.updateUserDetails")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateUserDetails

[](#-updateuserdetails-1)

> Update the currently authenticated user's details. Note that *the name attribute is ignored*, the update will always be applied to the currently authenticated user.

```
function updateUserDetails($dynamic)
```

#### Parameters

[](#parameters-135)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-144)

```
$dynamic = array('key' => 'value');

$result = $user->updateUserDetails($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".UserController.deleteUserAvatar")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) deleteUserAvatar

[](#-deleteuseravatar)

> 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.

```
function deleteUserAvatar($userSlug)
```

#### Parameters

[](#parameters-136)

ParameterTagsDescriptionuserSlug`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-145)

```
$userSlug = 'userSlug';

$result = $user->deleteUserAvatar($userSlug);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".UserController.uploadUserAvatar")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) uploadUserAvatar

[](#-uploaduseravatar)

> 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](http://curl.haxx.se/) 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.

```
function uploadUserAvatar($userSlug)
```

#### Parameters

[](#parameters-137)

ParameterTagsDescriptionuserSlug`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-146)

```
$userSlug = 'userSlug';

$result = $user->uploadUserAvatar($userSlug);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".UserController.getUser")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getUser

[](#-getuser)

> Retrieve the user matching the supplied **userSlug**.

```
function getUser($userSlug)
```

#### Parameters

[](#parameters-138)

ParameterTagsDescriptionuserSlug`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-147)

```
$userSlug = 'userSlug';

$result = $user->getUser($userSlug);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".UserController.updateUserPassword")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateUserPassword

[](#-updateuserpassword-1)

> Update the currently authenticated user's password.

```
function updateUserPassword($dynamic)
```

#### Parameters

[](#parameters-139)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-148)

```
$dynamic = array('key' => 'value');

$result = $user->updateUserPassword($dynamic);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".UserController.getUserSettings")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) getUserSettings

[](#-getusersettings)

> Retrieve a map of user setting key values for a specific user identified by the user slug.

```
function getUserSettings($userSlug)
```

#### Parameters

[](#parameters-140)

ParameterTagsDescriptionuserSlug`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-149)

```
$userSlug = 'userSlug';

$result = $user->getUserSettings($userSlug);
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".UserController.updateUserSettings")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) updateUserSettings

[](#-updateusersettings)

> Update the entries of a map of user setting key/values for a specific user identified by the user slug.

```
function updateUserSettings(
        $dynamic,
        $userSlug)
```

#### Parameters

[](#parameters-141)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptionuserSlug`Required`TODO: Add a parameter description#### Example Usage

[](#example-usage-150)

```
$dynamic = array('key' => 'value');
$userSlug = 'userSlug';

$result = $user->updateUserSettings($dynamic, $userSlug);
```

[Back to List of Controllers](#list_of_controllers)

### [![Class: ](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67 ".MarkupController")](https://camo.githubusercontent.com/ec8022a6fb768aa7d81b8226237aadf63b8a726efab75a8314b224e54194c885/68747470733a2f2f617069646f63732e696f2f696d672f636c6173732e706e67) MarkupController

[](#-markupcontroller)

#### Get singleton instance

[](#get-singleton-instance-11)

The singleton instance of the `MarkupController` class can be accessed from the API Client.

```
$markup = $client->getMarkup();
```

#### [![Method: ](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67 ".MarkupController.createPreviewMarkup")](https://camo.githubusercontent.com/501a7bfa57a34ebbde43bfe00d7218a47c0a18eae15acb62480b8716f604ee87/68747470733a2f2f617069646f63732e696f2f696d672f6d6574686f642e706e67) createPreviewMarkup

[](#-createpreviewmarkup)

> Preview the generated html for given markdown contents.
>
>  Only authenticated users may call this resource.

```
function createPreviewMarkup(
        $dynamic,
        $urlMode = null,
        $hardwrap = null,
        $htmlEscape = null)
```

#### Parameters

[](#parameters-142)

ParameterTagsDescriptiondynamic`Required`TODO: Add a parameter descriptionurlMode`Optional`TODO: Add a parameter descriptionhardwrap`Optional`TODO: Add a parameter descriptionhtmlEscape`Optional`TODO: Add a parameter description#### Example Usage

[](#example-usage-151)

```
$dynamic = array('key' => 'value');
$urlMode = 'urlMode';
$hardwrap = true;
$htmlEscape = true;

$result = $markup->createPreviewMarkup($dynamic, $urlMode, $hardwrap, $htmlEscape);
```

[Back to List of Controllers](#list_of_controllers)

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b3584fec74a542231a7b5a2c85ed5a63c83cc57bec69735990607b7df3c6a28?d=identicon)[dario\_swain](/maintainers/dario_swain)

---

Top Contributors

[![IlyaPokamestov](https://avatars.githubusercontent.com/u/2771864?v=4)](https://github.com/IlyaPokamestov "IlyaPokamestov (3 commits)")

### Embed Badge

![Health badge](/badges/dario-swain-stash-api/health.svg)

```
[![Health](https://phpackages.com/badges/dario-swain-stash-api/health.svg)](https://phpackages.com/packages/dario-swain-stash-api)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
