Skip to content

Branches


JSON Object Structure for Branch Description

Field Type Description
name String Branch name
fullName String Full branch name
lastCommit Object Last commit
default Boolean Default branch
merged Boolean Merged branch
work Boolean Working branch

JSON Object Structure for Branch Protection Rule

Field Type Description
id String UUID of the branch protection rule
branchTemplate String Branch name pattern the protection will apply to
allowedToPush String Who can edit files in the branch: NO_ONE, DEVELOPER (and up), ADMINS (admins only)
allowedToMerge String Who can merge: NO_ONE, DEVELOPER (and up), ADMINS (admins only)
allowForcePush Boolean Whether push --force is allowed: true or false
codeOwnerApprovalRequired Boolean Require code owner approval for merging: true or false
autoMergeByDefault Boolean Enable auto-merge by default: true or false

See the structure of the commit JSON object here


Method to Get All Project Branches

GET /project/{ownerAlias}/{projectAlias}/branch

The request returns an array of all branches. You can configure the number of objects per page.

Path Variable Type Description
ownerAlias String Project owner alias
projectAlias String Project alias

Responses

STATUS 200 – List of branches returned.

Example Response
    
{
    "_embedded": {
        "branchList": [
            {
                "name": "compareBranch",
                "fullName": "refs/heads/compareBranch",
                "lastCommit": {
                    "hash": "01baf9f63e0060aaaaaaaaaaaab8b1cb3afa683c",
                    "message": "Commit\n",
                    "shortMessage": "Commit",
                    "createdAt": "2022-04-26T13:38:14Z",
                    "committerIdent": {
                        "name": "User",
                        "avatar": "/static/image/avatar.jpg",
                        "emailAddress": "user@gmail.com",
                        "when": "2022-04-26T13:38:14Z"
                    },
                    "authorIdent": {
                        "name": "User",
                        "avatar": "/static/image/avatar.jpg",
                        "emailAddress": "user@gmail.com",
                        "when": "2022-04-26T13:38:14Z"
                    },
                    "user": {
                        "id": "a10b86a3-aaaa-aaaa-aaaa-cea3dd8b6073",
                        "username": "user",
                        "name": name,
                        "surname": surname,
                        "fullName": "name surname",
                        "avatar": "https://gitflic.ru/upload/img/d67527fd-aaaa-aaaa-aaaa-6269d204abe6.jpg"
                    },
                    "verificationResult": null
                },
                "default": false,
                "merged": false,
                "work": false
            },
            {
                "name": "newBranch",
                "fullName": "refs/heads/newBranch",
                "lastCommit": {
                    "hash": "bfeeb9719fa590aaaaaaaaaaaab99186dba14f82",
                    "message": "init\n",
                    "shortMessage": "init",
                    "createdAt": "2022-05-05T13:19:01Z",
                    "committerIdent": {
                        "name": "Ivan Ivanov",
                        "avatar": "/static/image/avatar.jpg",
                        "emailAddress": "user@mail.ru",
                        "when": "2022-05-05T13:19:01Z"
                    },
                    "authorIdent": {
                        "name": "Ivan Ivanov",
                        "avatar": "/static/image/avatar.jpg",
                        "emailAddress": "user@mail.ru",
                        "when": "2022-05-05T13:19:01Z"
                    },
                    "user": {
                        "id": "a10b86a3-aaaa-aaaa-aaaa-cea3dd8b6073",
                        "username": "user",
                        "name": name,
                        "surname": surname,
                        "fullName": "name surname",
                        "avatar": "https://gitflic.ru/upload/img/d67527fd-aaaa-aaaa-aaaa-6269d204abe6.jpg"
                    },
                    "verificationResult": null
                },
                "default": false,
                "merged": false,
                "work": false
            }
        ]
    },
    "page": {
        "size": 10,
        "totalElements": 2,
        "totalPages": 1,
        "number": 0
    }
}
    
  

STATUS 403 – No access rights.

STATUS 404 – No data found.


Method to Create a Project Branch

POST /project/{ownerAlias}/{projectAlias}/branch

The request creates a project branch and returns its info.

Path Variable Type Description
ownerAlias String Project owner alias
projectAlias String Project alias

Request

Supported JSON format:

{
    "newBranch": "newBranch",
    "originBranch": "master"
}

Responses

STATUS 200 – Branch created successfully.

Example Response
    
    {
                "name": "newBranch",
                "fullName": "refs/heads/newBranch",
                "lastCommit": {
                    "hash": "bfeeb9719fa590aaaaaaaaaaaab99186dba14f82",
                    "message": "init\n",
                    "shortMessage": "init",
                    "createdAt": "2022-05-05T13:19:01Z",
                    "committerIdent": {
                        "name": "Ivan Ivanov",
                        "avatar": "/static/image/avatar.jpg",
                        "emailAddress": "user@mail.ru",
                        "when": "2022-05-05T13:19:01Z"
                    },
                    "authorIdent": {
                        "name": "Ivan Ivanov",
                        "avatar": "/static/image/avatar.jpg",
                        "emailAddress": "user@mail.ru",
                        "when": "2022-05-05T13:19:01Z"
                    },
                    "user": {
                        "id": "a10b86a3-aaaa-aaaa-aaaa-cea3dd8b6073",
                        "username": "user",
                        "name": name,
                        "surname": surname,
                        "fullName": "name surname",
                        "avatar": "https://gitflic.ru/upload/img/d67527fd-aaaa-aaaa-aaaa-6269d204abe6.jpg"
                    },
                    "verificationResult": null
                },
                "default": false,
                "merged": false,
                "work": false
            }
    
  

STATUS 403 – No access rights.

STATUS 404 – No data found.


Method to Get Branch Info

GET /project/{ownerAlias}/{projectAlias}/branch?branchName={branchName}

Returns branch info.

Path Variable Type Description
ownerAlias String Project owner alias
projectAlias String Project alias
branchName String Branch name

Responses

STATUS 200 – Branch info returned.

Example Response
    
    {
                "name": "newBranch",
                "fullName": "refs/heads/newBranch",
                "lastCommit": {
                    "hash": "bfeeb9719fa590aaaaaaaaaaaab99186dba14f82",
                    "message": "init\n",
                    "shortMessage": "init",
                    "createdAt": "2022-05-05T13:19:01Z",
                    "committerIdent": {
                        "name": "Ivan Ivanov",
                        "avatar": "/static/image/avatar.jpg",
                        "emailAddress": "user@mail.ru",
                        "when": "2022-05-05T13:19:01Z"
                    },
                    "authorIdent": {
                        "name": "Ivan Ivanov",
                        "avatar": "/static/image/avatar.jpg",
                        "emailAddress": "user@mail.ru",
                        "when": "2022-05-05T13:19:01Z"
                    },
                    "user": {
                        "id": "a10b86a3-aaaa-aaaa-aaaa-cea3dd8b6073",
                        "username": "user",
                        "name": name,
                        "surname": surname,
                        "fullName": "name surname",
                        "avatar": "https://gitflic.ru/upload/img/d67527fd-aaaa-aaaa-aaaa-6269d204abe6.jpg"
                    },
                    "verificationResult": null
                },
                "default": false,
                "merged": false,
                "work": false
            }
    
  

STATUS 403 – No access rights.

STATUS 404 – No data found.


Method to Get Default Branch

GET /project/{ownerAlias}/{projectAlias}/branch/default

Returns the default branch.

Path Variable Type Description
ownerAlias String Project owner alias
projectAlias String Project alias

Responses

STATUS 200 – Default branch returned.

Example Response
    
    {
                "name": "newBranch",
                "fullName": "refs/heads/newBranch",
                "lastCommit": {
                    "hash": "bfeeb9719fa590aaaaaaaaaaaab99186dba14f82",
                    "message": "init\n",
                    "shortMessage": "init",
                    "createdAt": "2022-05-05T13:19:01Z",
                    "committerIdent": {
                        "name": "Ivan Ivanov",
                        "avatar": "/static/image/avatar.jpg",
                        "emailAddress": "user@mail.ru",
                        "when": "2022-05-05T13:19:01Z"
                    },
                    "authorIdent": {
                        "name": "Ivan Ivanov",
                        "avatar": "/static/image/avatar.jpg",
                        "emailAddress": "user@mail.ru",
                        "when": "2022-05-05T13:19:01Z"
                    },
                    "user": {
                        "id": "a10b86a3-aaaa-aaaa-aaaa-cea3dd8b6073",
                        "username": "user",
                        "name": name,
                        "surname": surname,
                        "fullName": "name surname",
                        "avatar": "https://gitflic.ru/upload/img/d67527fd-aaaa-aaaa-aaaa-6269d204abe6.jpg"
                    },
                    "verificationResult": null
                },
                "default": true,
                "merged": false,
                "work": false
            }
    
  

STATUS 403 – No access rights.

STATUS 404 – No data found.


Method to Compare Branches by Files

GET /project/{ownerAlias}/{projectAlias}/branch/compare?compare={compareBranch}&base={baseBranch}

Compares branches and returns an array of changed files.

Path Variable Type Description
ownerAlias String Project owner alias
projectAlias String Project alias
compareBranch String Branch to compare (Required)
baseBranch String Base branch (Optional; uses default branch if omitted)

Responses

STATUS 200 – Comparison result returned successfully.

Example Response
    
    [
        {
            "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f",
            "newMode": "100644",
            "oldMode": "0",
            "newPath": "zzzz.txt",
            "oldPath": "/dev/null",
            "lastCommit": null,
            "addedLinesCount": 16,
            "removedLinesCount": 0,
            "fileName": "zzzz.txt",
            "filePath": "zzzz.txt",
            "fileExtension": "txt",
            "isImg": false,
            "isCollapsed": false,
            "isLarge": false,
            "isBinary": false,
            "changeType": null,
            "headers": [
                "diff --git a/zzzz.txt b/zzzz.txt",
                "new file mode 100644",
                "index 0000000..6ac4b12",
                "--- /dev/null",
                "+++ b/zzzz.txt"
            ],
            "lines": [
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-1-separator",
                    "body": "@@ -0,0 +1,16 @@",
                    "highLightBody": "@ -0,0 +1,16 @@",
                    "addLineNumber": null,
                    "removeLineNumber": null,
                    "op": "none",
                    "type": "separator",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-1",
                    "body": "+rewe",
                    "highLightBody": "rewe",
                    "addLineNumber": 1,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-2",
                    "body": "+\\wqe",
                    "highLightBody": "\\wqe",
                    "addLineNumber": 2,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-3",
                    "body": "+q",
                    "highLightBody": "q",
                    "addLineNumber": 3,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-4",
                    "body": "+eqw",
                    "highLightBody": "eqw",
                    "addLineNumber": 4,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-5",
                    "body": "+ew",
                    "highLightBody": "ew",
                    "addLineNumber": 5,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-6",
                    "body": "+qewwweeeeeee",
                    "highLightBody": "qewwweeeeeee",
                    "addLineNumber": 6,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-7",
                    "body": "+",
                    "highLightBody": "",
                    "addLineNumber": 7,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-8",
                    "body": "+eeee",
                    "highLightBody": "eeee",
                    "addLineNumber": 8,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-9",
                    "body": "+e",
                    "highLightBody": "e",
                    "addLineNumber": 9,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-10",
                    "body": "+e",
                    "highLightBody": "e",
                    "addLineNumber": 10,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-11",
                    "body": "+e",
                    "highLightBody": "e",
                    "addLineNumber": 11,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-12",
                    "body": "+e",
                    "highLightBody": "e",
                    "addLineNumber": 12,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-13",
                    "body": "+e",
                    "highLightBody": "e",
                    "addLineNumber": 13,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-14",
                    "body": "+e",
                    "highLightBody": "e",
                    "addLineNumber": 14,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-15",
                    "body": "+e",
                    "highLightBody": "e",
                    "addLineNumber": 15,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                },
                {
                    "id": "e4f732276a7f7029f3c8cc69cfaaaaaaaaaaaa15d3148ab6755ff796aafefa6f-0-16",
                    "body": "+e",
                    "highLightBody": "e",
                    "addLineNumber": 16,
                    "removeLineNumber": null,
                    "op": "add",
                    "type": "line",
                    "links": []
                }
            ],
            "links": []
        }
    ]
    
  

STATUS 403 – No access rights.

STATUS 404 – No data found.


Method to View File Changes Between Commits

GET /project/{ownerAlias}/{projectAlias}/branch/compare/file?filePath={filePath}&baseHash={baseHash}&compareHash={compareHash}

Compares changes in a file between different commits. Returns an array of changed lines in the file.

Path Variable Type Description
ownerAlias String Project owner alias
projectAlias String Project alias
filePath String File path (Required)
baseHash String Base commit (Required)
compareHash String Compared commit (Required)

Responses

STATUS 200 – List of changes returned successfully.

Example Response
    
    [
    {
        "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc",
        "newMode": "100644",
        "oldMode": "100644",
        "newPath": "some_File.txt",
        "oldPath": "some_File.txt",
        "lastCommit": null,
        "addedLinesCount": 2,
        "removedLinesCount": 9,
        "fileName": "some_File.txt",
        "filePath": "some_File.txt",
        "fileExtension": "txt",
        "isImg": false,
        "isCollapsed": false,
        "isLarge": false,
        "isBinary": false,
        "changeType": null,
        "headers": [
            "diff --git a/some_File.txt b/some_File.txt",
            "index a763375..4232afa 100644",
            "--- a/some_File.txt",
            "+++ b/some_File.txt"
        ],
        "lines": [
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-14-14-separator",
                "body": "@@ -14,13 +14,6 @@",
                "highLightBody": "@ -14,13 +14,6 @@",
                "addLineNumber": null,
                "removeLineNumber": null,
                "op": "none",
                "type": "separator",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-14-14",
                "body": " as",
                "highLightBody": "as",
                "addLineNumber": 14,
                "removeLineNumber": 14,
                "op": "none",
                "type": "line",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-15-15",
                "body": " ea",
                "highLightBody": "ea",
                "addLineNumber": 15,
                "removeLineNumber": 15,
                "op": "none",
                "type": "line",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-16-16",
                "body": " e",
                "highLightBody": "e",
                "addLineNumber": 16,
                "removeLineNumber": 16,
                "op": "none",
                "type": "line",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-17-17",
                "body": "-ase",
                "highLightBody": "ase",
                "addLineNumber": null,
                "removeLineNumber": 17,
                "op": "remove",
                "type": "line",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-18-17",
                "body": "-a",
                "highLightBody": "a",
                "addLineNumber": null,
                "removeLineNumber": 18,
                "op": "remove",
                "type": "line",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-19-17",
                "body": "-e",
                "highLightBody": "e",
                "addLineNumber": null,
                "removeLineNumber": 19,
                "op": "remove",
                "type": "line",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-20-17",
                "body": "-ae",
                "highLightBody": "ae",
                "addLineNumber": null,
                "removeLineNumber": 20,
                "op": "remove",
                "type": "line",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-21-17",
                "body": "-aeeeeeeeeeeeeeeeeeeeweqew",
                "highLightBody": "aeeeeeeeeeeeeeeeeeeeweqew",
                "addLineNumber": null,
                "removeLineNumber": 21,
                "op": "remove",
                "type": "line",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-22-17",
                "body": "-qe",
                "highLightBody": "qe",
                "addLineNumber": null,
                "removeLineNumber": 22,
                "op": "remove",
                "type": "line",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-23-17",
                "body": "-qw",
                "highLightBody": "qw",
                "addLineNumber": null,
                "removeLineNumber": 23,
                "op": "remove",
                "type": "line",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-24-17",
                "body": "-eqweqweqeqwe",
                "highLightBody": "eqweqweqeqwe",
                "addLineNumber": null,
                "removeLineNumber": 24,
                "op": "remove",
                "type": "line",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-25-17",
                "body": "-:wq",
                "highLightBody": ":wq",
                "addLineNumber": null,
                "removeLineNumber": 25,
                "op": "remove",
                "type": "line",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-26-17",
                "body": "+asea",
                "highLightBody": "asea",
                "addLineNumber": 17,
                "removeLineNumber": null,
                "op": "add",
                "type": "line",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-26-18",
                "body": "+",
                "highLightBody": "",
                "addLineNumber": 18,
                "removeLineNumber": null,
                "op": "add",
                "type": "line",
                "links": []
            },
            {
                "id": "eb418131bbe25cb0c386ef9d67aaaaaaaaaaaa521e0cb185b3906a909c0f0dcc-26-19",
                "body": " ",
                "highLightBody": "",
                "addLineNumber": 19,
                "removeLineNumber": 26,
                "op": "none",
                "type": "line",
                "links": []
            }
        ],
        "links": []
      }
    ]
    
  

STATUS 403 – No access rights.

STATUS 404 – No data found.


Method to Compare Commits

GET /project/{ownerAlias}/{projectAlias}/branch/commit?compareHash={compareHash}&baseHash={baseHash}

Compares commits and returns an array of commits. You can configure the number of objects per page.

Path Variable Type Description
ownerAlias String Project owner alias
projectAlias String Project alias
baseHash String Base commit (Required)
compareHash String Compared commit (Required)

For correct operation, baseHash must be older than compareHash.

Responses

STATUS 200 – Comparison result returned successfully.

Example Response
    
    {
    "_embedded": {
        "commitList": [
            {
                "hash": "f520f268217701aaaaaaaaaaaa66f83f38faaa8d",
                "message": "test message\n",
                "shortMessage": "test message",
                "createdAt": "2022-06-14T13:36:22Z",
                "committerIdent": {
                    "name": "User User",
                    "avatar": "/static/image/avatar.jpg",
                    "emailAddress": "User@gmail.com",
                    "when": "2022-06-14T13:36:22Z"
                },
                "authorIdent": {
                    "name": "User User",
                    "avatar": "/static/image/avatar.jpg",
                    "emailAddress": "User@gmail.com",
                    "when": "2022-06-14T13:36:22Z"
                },
                "user": {
                        "id": "a10b86a3-aaaa-aaaa-aaaa-cea3dd8b6073",
                        "username": "user",
                        "name": name,
                        "surname": surname,
                        "fullName": "name surname",
                        "avatar": "https://gitflic.ru/upload/img/d67527fd-aaaa-aaaa-aaaa-6269d204abe6.jpg"
                    }
            },
            {
                "hash": "f8db2f71d39ac7aaaaaaaaaaaa1feed315e89e24",
                "message": "message\n",
                "shortMessage": "message",
                "createdAt": "2022-06-14T13:13:51Z",
                "committerIdent": {
                    "name": "User User",
                    "avatar": "/static/image/avatar.jpg",
                    "emailAddress": "User@gmail.com",
                    "when": "2022-06-14T13:13:51Z"
                },
                "authorIdent": {
                    "name": "User User",
                    "avatar": "/static/image/avatar.jpg",
                    "emailAddress": "User@gmail.com",
                    "when": "2022-06-14T13:13:51Z"
                },
                "user": {
                        "id": "a10b86a3-aaaaa-aaaa-aaaa-cea3dd8b6073",
                        "username": "user",
                        "name": name,
                        "surname": surname,
                        "fullName": "name surname",
                        "avatar": "https://gitflic.ru/upload/img/d67527fd-aaaa-aaaa-aaaa-6269d204abe6.jpg"
                    }
            }
        ]
    },
    "page": {
        "size": 20,
        "totalElements": 2,
        "totalPages": 1,
        "number": 0
    }
}
    
  

STATUS 403 – No access rights.

STATUS 404 – No data found.


Methods for Branch Protection Rules

Method to Get List of Branch Protection Rules

Project: GET /project/{ownerAlias}/{projectAlias}/branch-protection

Team: GET /team/{teamAlias}/branch-protection

Company: GET /company/{companyAlias}/branch-protection

Returns a list of all branch protection rules for the specified entity. You can configure the number of objects per page.

Path Variable Type Description
ownerAlias String Project owner alias
projectAlias String Project alias
teamAlias String Team alias
companyAlias String Company alias

Responses

STATUS 200 – Branch protection rules returned.

Example Response
    
{
    "_embedded": {
        "branchProtectionApiModelList": [
            {
                "id": "f124e616-aaaa-aaaa-aaaa-f1679de98147",
                "branchTemplate": "master",
                "allowedToPush": "NO_ONE",
                "allowedToMerge": "DEVELOPER",
                "allowForcePush": true,
                "codeOwnerApprovalRequired": true,
                "autoMergeByDefault": true
            },
            {
                "id": "18422240-aaaa-aaaa-aaaa-1768add945fd",
                "branchTemplate": "master",
                "allowedToPush": "NO_ONE",
                "allowedToMerge": "ADMINS",
                "allowForcePush": true,
                "codeOwnerApprovalRequired": true,
                "autoMergeByDefault": true
            },
            {
                "id": "52711a33-aaaa-aaaa-aaaa-de1597ac9bed",
                "branchTemplate": "omega",
                "allowedToPush": "DEVELOPER",
                "allowedToMerge": "NO_ONE",
                "allowForcePush": false,
                "codeOwnerApprovalRequired": true,
                "autoMergeByDefault": false
            }
        ]
    },
    "page": {
        "size": 10,
        "totalElements": 3,
        "totalPages": 1,
        "number": 0
    }
}
    
  

STATUS 403 – No access rights.

STATUS 404 – No data found.


Method to Get Branch Protection Rule by UUID

Project: GET /project/{ownerAlias}/{projectAlias}/branch-protection/{branchProtectionUuid}

Team: GET /team/{teamAlias}/branch-protection/{branchProtectionUuid}

Company: GET /company/{companyAlias}/branch-protection/{branchProtectionUuid}

Returns the branch protection rule for the specified entity and UUID.

Path Variable Type Description
ownerAlias String Project owner alias
projectAlias String Project alias
teamAlias String Team alias
companyAlias String Company alias
branchProtectionUuid String Branch protection rule UUID

Responses

STATUS 200 – Branch protection rule returned:

Example Response
    
{
    "id": "4ad476ab-aaaa-aaaa-aaaa-f71cfa36ba8e",
    "branchTemplate": "master",
    "allowedToPush": "DEVELOPER",
    "allowedToMerge": "ADMINS",
    "allowForcePush": true,
    "codeOwnerApprovalRequired": false,
    "autoMergeByDefault": false
}
    
  

STATUS 403 – No access rights.

STATUS 404 – No data found.


Method to Create Branch Protection Rule

Project: POST /project/{ownerAlias}/{projectAlias}/branch-protection

Team: POST /team/{teamAlias}/branch-protection

Company: POST /company/{companyAlias}/branch-protection

Creates a branch protection rule for the specified entity.

Path Variable Type Description
ownerAlias String Project owner alias
projectAlias String Project alias
teamAlias String Team alias
companyAlias String Company alias

Request

Supported JSON format:

Field Type Description
branchTemplate String Required. Branch name pattern to apply protection
allowedToPush String Required. Who can edit files: NO_ONE, DEVELOPER, ADMINS
allowedToMerge String Required. Who can merge: NO_ONE, DEVELOPER, ADMINS
allowForcePush Boolean Optional. Is push --force allowed: true or false (default: false)
codeOwnerApprovalRequired Boolean Optional. Require code owner approval: true or false (default: false)
autoMergeByDefault Boolean Optional. Enable auto-merge by default: true or false (default: false)

JSON Object Example

{
    "branchTemplate": "master",
    "allowedToPush": "NO_ONE",
    "allowedToMerge": "DEVELOPER",
    "allowForcePush": true,
    "codeOwnerApprovalRequired": true,
    "autoMergeByDefault": true
}

Responses

STATUS 200 – Branch protection rule created:

Example Response
    
{
    "id": "cb28225a-aaaa-aaaa-aaaa-5e135e08f07c",
    "branchTemplate": "master",
    "allowedToPush": "NO_ONE",
    "allowedToMerge": "DEVELOPER",
    "allowForcePush": true,
    "codeOwnerApprovalRequired": true,
    "autoMergeByDefault": true
}
    
  

STATUS 403 – No access rights.

STATUS 404 – No data found.


Method to Edit Branch Protection Rule

Project: PUT /project/{ownerAlias}/{projectAlias}/branch-protection/{branchProtectionUuid}

Team: PUT /team/{teamAlias}/branch-protection/{branchProtectionUuid}

Company: PUT /company/{companyAlias}/branch-protection/{branchProtectionUuid}

Edits an existing branch protection rule for the specified entity.

Path Variable Type Description
ownerAlias String Project owner alias
projectAlias String Project alias
teamAlias String Team alias
companyAlias String Company alias
branchProtectionUuid String Branch protection rule UUID

Request

Supported JSON format:

Field Type Description
allowedToPush String Who can edit files: NO_ONE, DEVELOPER, ADMINS
allowedToMerge String Who can merge: NO_ONE, DEVELOPER, ADMINS
allowForcePush Boolean Is push --force allowed: true or false (default: false)
codeOwnerApprovalRequired Boolean Require code owner approval: true or false (default: false)
autoMergeByDefault Boolean Enable auto-merge by default: true or false (default: false)

JSON Object Example

{
    "allowedToPush": "NO_ONE",
    "allowedToMerge": "DEVELOPER",
    "allowForcePush": true,
    "codeOwnerApprovalRequired": true,
    "autoMergeByDefault": true
}

Responses

STATUS 200 – Branch protection rule edited.

Example Response
    
{
    "id": "cb28225a-aaaa-aaaa-aaaa-5e135e08f07c",
    "branchTemplate": "master",
    "allowedToPush": "NO_ONE",
    "allowedToMerge": "DEVELOPER",
    "allowForcePush": true,
    "codeOwnerApprovalRequired": true,
    "autoMergeByDefault": true
}
    
  

STATUS 403 – No access rights.

STATUS 404 – No data found.


Method to Delete Branch Protection Rule

Project: DELETE /project/{ownerAlias}/{projectAlias}/branch-protection/{branchProtectionUuid}

Team: DELETE /team/{teamAlias}/branch-protection/{branchProtectionUuid}

Company: DELETE /company/{companyAlias}/branch-protection/{branchProtectionUuid}

Deletes an existing branch protection rule for the specified entity.

Path Variable Type Description
ownerAlias String Project owner alias
projectAlias String Project alias
teamAlias String Team alias
companyAlias String Company alias
branchProtectionUuid String Branch protection rule UUID

Responses

STATUS 200 – Branch protection rule deleted successfully.

STATUS 403 – No access rights.

STATUS 404 – No data found.


Method to Apply Branch Protection Rules to Projects

Company: POST /company/{companyAlias}/branch-protection/apply-settings-to-projects

Team: POST /team/{teamAlias}/branch-protection/apply-settings-to-projects

Applies branch protection rules to all projects of the specified entity.

Path Variable Type Description
companyAlias String Company alias
teamAlias String Team alias

Responses

STATUS 204 – Protection rules applied to all child projects.

STATUS 403 – No access rights.

STATUS 404 – No data found.


Automated translation!

This page was translated using automatic translation tools. The text may contain inaccuracies.