• 3
    • 9
    • We collect Jira feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      Currently, the act of adding a DVCS account from Github Cloud, Github Enterprise, GitLab or Bitbucket Cloud to Jira requires manual intervention and is embedded in Javascript, it would be nice to create a REST API endpoint for Jira to allow automated integration.

      For example:

      • Taking some of the time out if you have lots of accounts to add. 
      • A unique REST API to trigger manual sync such as soft/full sync to an individual failed to be sync repository.

          Form Name

            [JSWSERVER-20504] Allow DVCS account to be automated via REST API

            Erik Saline added a comment - - edited

            I have used the REST API Browser Plugin to see the

            rest/bitbucket/1.0/organization/{id}/credential POST API.  
            

            First you use the previous comment's API to create the org, then you use the credential API to set the creds.

            We still need to manually get the key and secret from Github as I was not able find an API for that. The token should be the PAT of the GitHub account you use to authorize the integration via the Jira UI.

            # Set Jira Org Creds.
            def set_organization_creds(set_org_id, set_cred_key, set_cred_secret, set_cred_token):
                json_data = {
                    "key": set_cred_key,
                    "secret": set_cred_secret,
                    "token": set_cred_token,
                }
                headers = {'Content-type': 'application/json'}
                set_organization_creds_api = jira_api_url + "organization/" + set_org_id + "/credential"
                print("Running POST for URL: " + set_organization_creds_api)
                json_response = requests.post(set_organization_creds_api, json=json_data, headers=headers, auth=(jira_user_name,
                                                                                                     jira_password))
                if json_response.status_code == 200:
                    return 1
                else:
                    return 0
            

            Erik Saline added a comment - - edited I have used the REST API Browser Plugin to see the rest /bitbucket/1.0/organization/{id}/credential POST API. First you use the previous comment's API to create the org, then you use the credential API to set the creds. We still need to manually get the key and secret from Github as I was not able find an API for that. The token should be the PAT of the GitHub account you use to authorize the integration via the Jira UI. # Set Jira Org Creds. def set_organization_creds(set_org_id, set_cred_key, set_cred_secret, set_cred_token): json_data = { "key" : set_cred_key, "secret" : set_cred_secret, "token" : set_cred_token, } headers = { 'Content-type' : 'application/json' } set_organization_creds_api = jira_api_url + "organization/" + set_org_id + "/credential" print( "Running POST for URL: " + set_organization_creds_api) json_response = requests.post(set_organization_creds_api, json=json_data, headers=headers, auth=(jira_user_name, jira_password)) if json_response.status_code == 200: return 1 else : return 0

            erik.saline120625773 how do you add the oauthClientConfig

            {
                "hostUrl": "https://self.hosted.gitlab.com",
                "name": "test-jira",
                "dvcsType": "gitlabselfmanaged",
                "autolinkNewRepos": true,
                "smartcommitsOnNewRepos": true
            }
            

            Works but the synchronization does not work

            Atlassian Partner Account added a comment - erik.saline120625773 how do you add the oauthClientConfig { "hostUrl" : "https: //self.hosted.gitlab.com" , "name" : "test-jira" , "dvcsType" : "gitlabselfmanaged" , "autolinkNewRepos" : true , "smartcommitsOnNewRepos" : true } Works but the synchronization does not work

            I was able to use REST API to create an integration using the API below with a POST function.

            https://jira.your-host.com/rest/bitbucket/1.0/organization

            Erik Saline added a comment - I was able to use REST API to create an integration using the API below with a POST function. https://jira.your-host.com/rest/bitbucket/1.0/organization

              Unassigned Unassigned
              rvolkmar Ronnie Volkmar
              Votes:
              12 Vote for this issue
              Watchers:
              14 Start watching this issue

                Created:
                Updated: