Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section


Column
width50%


Expand
titleGet project settings

Returns the project settings of the plug-in.

Responses

Status
colourGreen
titleSTATUS 200
 - application/json Project settings found

Example:

Code Block
languagejs
{
  "templateFeatureEnabled": true,
  "allowUsersToChooseTemplate": false,
  "defaultTemplateRepositoryId": null,
  "repoMirrorEnabled": false,
  "settingsToUse": {
    "repositoryDetails": true,
    "repositoryHooks": false,
    "repositoryHooksToIgnore": [
      "com.atlassian.bitbucket.server.bitbucket-bundled-hooks:force-push-hook"
    ],
    "repositoryPermissions": false,
    "branchPermissions": false,
    "pullRequestSettings": true,
    "webhooks": true,
    "accessKeys": true
  },
  "cronExpression": "0 0 3 1/1 * ? *"
}


Status
colourRed
titleSTATUS 401
 The currently authenticated user does not have PROJECT_ADMIN settings for this project

Status
colourRed
titleSTATUS 404
 The given project does not exist or there are no settings for this project



Column
width50%
GET /rest/templates4stash/1.0/projects/PROJECT{project_1key}/settings



Section


Column
width50%


Expand
titleUpdate project settings

Updates the project settings of the plug-in.

Request

Query parameters:

parametertypedescription
defaultTemplateRepositoryId
int, (default: null)the ID of the repository which should be the template for all new repositories in this project
allowUsersToChooseTemplate
boolean, (default: false)true if a user is allowed to choose another template than the default when creating a new repository
repoMirrorEnabled
boolean, (default: true)true if you want the content of a template being mirrored to a repository on its creation
repositoryDetails
boolean, (default: true)true if the repository details (default branch and "Allow forks" setting) of the template should be applied to associated repositories
repositoryHooks
boolean, (default: true)true if the hook settings of the template should be applied to associated repositories
repositoryHooksToIgnore
lista list of Stash hook keys for which settings should not get overwritten by the ones from the template
repositoryPermissions
boolean, (default: true)true if the repository permissions of the template should be applied to associated repositories
branchPermissions
boolean, (default: true)true if the branch permissions of the template should be applied to associated repositories
pullRequestSettings
boolean, (default: true)true if the pull request settings of the template should be applied to associated repositories
branchModel
boolean, (default: true)(not available anymore since 2.2.0) true if the branch model of the template should be applied to associated repositories
webhooks
boolean, (default: false)(since version 2.2.0) true if the webhooks of the template should be applied to associated repositories
accessKeys
boolean, (default: false)(since version 2.2.0) true if the access keys of the template should be applied to associated repositories
cronExpression
string, (default: null)the cron expression to use for resetting the settings of associated repositories to the one of the configured template (use null to deactivate the periodic reset)

Example:

Code Block
languagejs
{
  "templateFeatureEnabled": true,
  "allowUsersToChooseTemplate": false,
  "defaultTemplateRepositoryId": null,
  "repoMirrorEnabled": false,
  "settingsToUse": {
    "repositoryDetails": true,
    "repositoryHooks": false,
    "repositoryHooksToIgnore": [
      "com.atlassian.bitbucket.server.bitbucket-bundled-hooks:force-push-hook"
    ],
    "repositoryPermissions": false,
    "branchPermissions": false,
    "pullRequestSettings": true,
    "webhooks": true,
    "accessKeys": true
  },
  "cronExpression": "0 0 3 1/1 * ? *"
}


Responses

Status
colourGreen
titleSTATUS 200
 Project settings saved

Status
colourRed
titleSTATUS 401
 The repository for the given template does not exist

Status
colourRed
titleSTATUS 401
 The currently authenticated user does not have PROJECT_ADMIN settings for this project

Status
colourRed
titleSTATUS 404
 The given project does not exist or there are no settings for this project



Column
width50%
PUT /rest/templates4stash/1.0/projects/PROJECT{project_1key}/settings


Anchor
AssignTemplate
AssignTemplate

/rest/templates4stash/1.0/projects/{

...

project_key}/repos/{

...

repo_slug}/template

Section


Column
width50%


Expand
titleGet repository settings

Gets the ID of the currently associated template for the given repository.

Responses

Status
colourGreen
titleSTATUS 200
 - application/json Repository settings found

Example:

Code Block
languagejs
{
    "templateRepositoryId": 1
}


Status
colourRed
titleSTATUS 401
 The currently authenticated user does not have REPOSITORY_ADMIN settings for this repository

Status
colourRed
titleSTATUS 404
 The given repository with this slug does not exist



Column
width50%
GET /rest/templates4stash/1.0/projects/PROJECT{project_KEYkey}/repos/REPO{repo_SLUGslug}/settings



Section


Column
width50%


Expand
titleUpdate repository settings

Updates the template for the given repository.

Request

Query parameters:

parametertypedescription
templateRepositoryId
int, (default: null)the ID of the repository template which this repository should use

Example:

Code Block
languagejs
{
    "templateRepositoryId": 1
}


Responses

Status
colourGreen
titleSTATUS 200
 Repository settings saved

Status
colourRed
titleSTATUS 401
 The repository for the given templateRepositoryId does not exist or it is equivalent with the repository of the request URL which is not allowed because a repository cannot be a template of itself

Status
colourRed
titleSTATUS 401
 The currently authenticated user does not have REPOSITORY_ADMIN settings for this repository

Status
colourRed
titleSTATUS 404
 The given repository with repositorySlug does not exist



Column
width50%
PUT /rest/templates4stash/1.0/projects/PROJECT{project_KEYkey}/repos/REPO{repo_SLUGslug}/settings