Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,817
Community Members
 
Community Events
184
Community Groups

How to sync Jira and Confluence directories with API call ?

Hi experts, 

I am trying to synchronize Jira and Confluence directories with an API call.

I wrote a powershell script but it is not working 

 

$TLS12Protocol = [System.Net.SecurityProtocolType] 'Ssl3 , Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $TLS12Protocol

$username = "toto"
$password = "xxxxx"
$baseurl = "https://myURL"

# Configuration de l'en-tête de la requête
$headers = @{
"Content-Type" = "application/json"
#"Authorization" = "Basic"
}

############### JIRA Synchro ##################
# Configuration de l'URL de l'API REST pour créer un projet
$jiraUrl = $baseurl + "/jira/plugins/servlet/embedded-crowd/directories/sync"
$directoryId = 10700

# Configuration des données du projet pour l'envoi à l'API REST
$syncBody = @{
"directoryId" = $directoryId
} | ConvertTo-Json


# Envoi de la requête à l'API REST pour créer le projet
$responseJira = Invoke-RestMethod -Uri $jiraUrl -Method Post -Headers $headers -Body $syncBody -Credential (New-Object System.Management.Automation.PSCredential ($username, (ConvertTo-SecureString $password -AsPlainText -Force)))

 I have an error 401 unauthorized 

 

Do you have an idea ?

1 answer

0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 07, 2023

Hi @Rash ,

you can use JIRA as user management and syn users and groups in Confluence using a bultin feature (https://confluence.atlassian.com/doc/synchronizing-data-from-external-directories-229838498.html). Why don't you use this approach?

Fabio

Hi @Fabio Racobaldo _Herzum_ 

Thanks for your answer;

I can't use this approch because we use Crowd as user management. I want to sync Jira and Confluence after creation of new groups in Crowd.

I know that sync can be scheduled every x minutes but i want to automate it.

My initial need is to automate creation of new project (Group creation in Crowd, Jira directory sync, Jira project creation, Configuration of permissions in Jira project, Confluence space creation, Configuration of permissions in Confluence space...)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events