Versions Compared

Key

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

Please note that the REST interface is only available when you have at least version 1.3.0 of the plug-in installed.

...

/rest/templates4stash/1.0/projects/{project_key}/settings

...

width50%

...

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_key}/settings

...

width50%

...

titleUpdate project settings

Updates the project settings of the plug-in.

Request

Query parameters:

...

defaultTemplateRepositoryId

...

allowUsersToChooseTemplate

...

repoMirrorEnabled

...

repositoryDetails

...

repositoryHooks

...

repositoryHooksToIgnore

...

repositoryPermissions

...

branchPermissions

...

pullRequestSettings

...

branchModel

...

webhooks

...

accessKeys

...

cronExpression

...

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_key}/settings

...

/rest/templates4stash/1.0/projects/{project_key}/repos/{repo_slug}/template

...

width50%

...

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_key}/repos/{repo_slug}/settings

...

width50%

...

titleUpdate repository settings

Updates the template for the given repository.

Request

Query parameters:

...

templateRepositoryId

...

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

...

width50%

...

You can find the new REST API documentation on Github.