Skip to main content
Skip table of contents

How to manage configurations using Jigit APIs?

Jigit APIs are used to manage configurations for GitLab or GitHub repositories, projects or groups.

Jigit APIs

These APIs are used by the UI, feel free to review the Network Tab in your browser to explore more details on how the UI uses them.

URL: {JIRA_BASE_URL}/rest/jigit/1.0/repo

HTTP verb: POST

Request headers:

  • Content-Type: application/x-www-form-urlencoded; charset=UTF-8

Response headers:

  • Content-Type: text/html;charset=UTF-8

Add a configuration

URL: {JIRA_BASE_URL}/rest/jigit/1.0/repo/add

Form parameters (encoded):repo_name=test&url=https%3A%2F%2Fgitlab.com&service_type=GitLab&token=TOKEN&repository_id=GROUP%2FREPO&repo_type=SingleRepository&def_branch=master&branches_strategy=all&request_timeout=10&sleep_timeout=10&sleep_requests=100

Parameter name

Description

Possible value/Default value

Requirements

repo_name

String name that represents a configuration

Required

url

GitLab/GitHub url

Required

service_type

Predefined value

GitLab
GitLab8
GitHub

Required

token

Authentication token

Required

repository_id

Repository/group id like
”project/repository”

Required

repo_type

Predefined value

SingleRepository
GroupOfRepositories

Required

def_branch

Default branch name to scan

Required

branches_strategy

A strategy to scan branches in a repository or a group of repositories

selected - scan only selected branch
all - scan all branches in repository
mask - scan repositories by pattern defined in “def_branch”(bug/*)

Default value : selected

request_timeout

Request timeout in seconds

Default: 10 sec

Optional

sleep_timeout

Timeout in seconds to wait between each batch of requests defined in sleep_requests

Default: 10 sec

Optional

sleep_requests

Count of requests before waiting “sleep_timeout” seconds. This and previous parameters are used to reduce load on GitLab/GitHub and Jira, especially during initial indexing

Default: 100

Optional

include_subgroups

Flag which indicates to include all sub-groups and repositories in a group

Default: ““
To enable should be equal to “on“

Optional.
It’s taken into account only for
repo_type=GroupOfRepositories

Test a configuration

URL: {JIRA_BASE_URL}/rest/jigit/1.0/repo/test

Form parameters(encoded):url=https%3A%2F%2Fgitlab.com&service_type=GitLab&token=TOKEN&change_token=on&repository_id=alex_p1%2Ftest&repo_type=SingleRepository&def_branch=master&include_subgroups=on&branches_strategy=all&request_timeout=10&sleep_timeout=10&sleep_requests=100&repo_name=test

Parameter name

Description

Possible value/Default value

Requirements

repo_name

String name represents configuration

Required

url

GitLab/GitHub url

Required

service_type

Predefined value

GitLab
GitLab8
GitHub

Required

token

Authentication token

Optional

repository_id

Repository/group id like
”project/repository”

Required

repo_type

Predefined value

SingleRepository
GroupOfRepositories

Required

def_branch

Default branch name to scan

Required

request_timeout

Request timeout in seconds

Default: 10 sec

Optional

include_subgroups

Flag which indicates to include all sub-groups and repositories in a group

Default: ““
To enable should be equal to “on“

Optional.
It’s taken into account only for
repo_type=GroupOfRepositories

change_token

Flag which indicates to use provided token instead of existing one

Default: ““
To enable should be equal to “on“

Optional

Edit configuration

URL: {JIRA_BASE_URL}/rest/jigit/1.0/repo/edit

Form parameters(encoded):url=https%3A%2F%2Fgitlab.com&service_type=GitLab&token=TOKEN&change_token=on&repository_id=&repo_type=SingleRepository&def_branch=master&include_subgroups=on&branches_strategy=mask&request_timeout=10&sleep_timeout=10&sleep_requests=100&repo_name=test

Parameter name

Description

Possible value/Default value

Requirements

repo_name

String name represents configuration

Required

url

GitLab/GitHub url

Required

service_type

Predefined value

GitLab
GitLab8
GitHub

Required

token

Authentication token

Optional

repository_id

Repository/group id like
”project/repository”

Required

def_branch

Default branch name to scan

Required

branches_strategy

Predefined value

selected - scan only selected branch
all - scan all branches in repository
mask - scan repositories by pattern defined in “def_branch”(bug/*)

Default value : selected

request_timeout

Request timeout in seconds

Default: 10 sec

Optional

sleep_timeout

Timeout in seconds to wait between each batch of requests defined in sleep_requests

Default: 10 sec

Optional

sleep_requests

Count of requests before waiting “sleep_timeout” seconds

Default: 100

Optional

change_token

Flag which indicates to use provided token instead of existing one

Default: ““
To enable should be equal to “on“

Optional

Remove configuration

URL: {JIRA_BASE_URL}/rest/jigit/1.0/repo/remove

Parameter name

Description

Requirement

repo

the name of the configuration

Required

Clear data

URL: {JIRA_BASE_URL}/rest/jigit/1.0/repo/clear

Parameter name

Description

Requirement

repo

the name of the configuration

Required

Disable/Enable configuration

URL: {JIRA_BASE_URL}/rest/jigit/1.0/repo/activity

Parameter name

Description

Requirement

enabled

true or false

Required

repo

the name of the configuration

Required

Add a branch to a configuration

URL: {JIRA_BASE_URL}/rest/jigit/1.0/repo/branch/add

Parameter name

Description

Requirement

branch

branch name

Required

repo

the name of the configuration

Required

Remove branch from configuration

URL: {JIRA_BASE_URL}/rest/jigit/1.0/repo/branch/remove

Parameter name

Description

Requirement

branch

the branch name

Required

repo

the name of the configuration

Required

Jigit REST APIs

There are REST endpoints for reading data

Only system administrators can call these endpoints.

URL: {JIRA_BASE_URL}/rest/jigit/1.0/configurations
HTTP verb: GET

Request headers:

  • Content-Type: application/json

Response headers:

  • Content-Type: application/json

Get configurations

URL: {JIRA_BASE_URL}/rest/jigit/1.0/configurations

Get a configuration

URL: {JIRA_BASE_URL}/rest/jigit/1.0/configurations?repoName={repoName}

Where:

  • repoName is the repoName of the configuration rule (it should be URL encoded).

Get Gerrit changes for an issue

URL: {JIRA_BASE_URL}/rest/jigit/1.0/gerrit/changes/{issueKey}

Where

  • issueKey is the issue key

CODE
{
   "id":"Combiner1~TEST-10_test1~I7759e29c79da78887d931700ee54814f1f28a114",
   "project":"Combiner1",
   "branch":"TEST-10_test1",
   "changeId":"I7759e29c79da78887d931700ee54814f1f28a114",
   "number":8,
   "subject":"second review",
   "owner":{
      "id":1000000,
      "name":"Administrator",
      "userName":"admin"
   },
   "assignee":{
      "id":1000001,
      "name":"Admin Admin",
      "userName":"Admin"
   },
   "submitter":{
      "id":1000003,
      "name":"name-submitter",
      "userName":"username-submitter"
   },
   "created":1643862494000,
   "updated":1644815007000,
   "submitted":1644778743000,
   "reviewers":{
      "accounts":[
         {
            "id":1000003,
            "name":"name-submitter",
            "userName":"submitter-submitter"
         }
      ]
   },
   "status":"MERGED",
   "messages":[
      {
         "id":"8bda6ec9030bcad40f85d2295a523e885018a5af",
         "tag":"autogenerated:gerrit:newWipPatchSet",
         "author":{
            "id":1000000,
            "name":"Administrator",
            "userName":"admin"
         },
         "realAuthor":{
            "id":1000000,
            "name":"Administrator",
            "userName":"admin"
         },
         "date":1643862494000,
         "message":"Uploaded patch set 1.",
         "revisionNumber":1
      },
      {
         "id":"cf7b4d2a1694b12392cd8d9a16baf4246b4f08dd",
         "author":{
            "id":1000003,
            "name":"name-submitter",
            "userName":"username"
         },
         "realAuthor":{
            "id":1000003,
            "name":"alex",
            "userName":"alex"
         },
         "date":1644778679000,
         "message":"Patch Set 1: Code-Review+2\n\nGood TEST-10",
         "revisionNumber":1
      },
      {
         "id":"e3269cacd262603d727101bfd7fa5705ab2d2d43",
         "tag":"autogenerated:gerrit:setAssignee",
         "author":{
            "id":1000003,
            "name":"alex",
            "userName":"alex"
         },
         "realAuthor":{
            "id":1000003,
            "name":"alex",
            "userName":"alex"
         },
         "date":1644815007000,
         "message":"Assignee added: Admin Admin <alex@gmail.com>",
         "revisionNumber":1
      }
   ],
   "url":"http://localhost:8080/c/Combiner1/+/8"
}

Updated:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.