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

Want to add/remove users from team on jira align using API

Want to know the API for users to add team and remove users from team in jira align.

4 answers

2 accepted

2 votes
Answer accepted
Rodrigo Cortez
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Mar 29, 2021

Hi @Mohamed Musheer !

Assuming you have a valid API 2.0 token, and corresponding grants in UI to perform this operation....

 

To add a user to a team, by using Jira Align API 2.0, make the following call:

PATCH https://instance.jiraalign.com/rest/align/api/2/Users/<id>

Where <id> is the userId of your user.

As request body, use the following JSON:

[
{
"op": "add",
"path": "/teams/0",
"value": {
"teamId": 1385,
"roleId": 6
}
}
]

Notice teamId and roleId are mandatory fields.  Each team has its own set of valid roles.  Check your team type and corresponding valid values before issuing this call.

The property path is also important.  As path is an array, you must clearly declare which position (index) you're filling.  So if the user doesn't belong yet to any team, then you must use position (index) 0 (as in the example).  If the user already belongs to, let's say, only one team, then you must use position (index) 1 (the second position, as they start counting from zero) and so on.

 

Removing a team assignment, in turn, is a simpler operation.

Just make the following call:

PATCH https://instance.jiraalign.com/rest/align/api/2/Users/<id>

Where <id> is the userId of your user.

As request body, use the following JSON:

[
{
"op": "remove",
"path": "/teams/0"
}
]

The property path determines which team assignment (index) you want to remove.

0 votes
Answer accepted
Rich Sparks
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Mar 29, 2021

In addition to @Rodrigo Cortez 's answer about the specifics, I assume you've read this already and looked at the specific documentation that's available in your Jira Align instance:

https://help.jiraalign.com/hc/en-us/articles/360045371954-Getting-started-with-the-REST-API-2-0

This also works without roleId if you want the user to have the default Team Role for the Team.

{
"op":"add",
"path":"/teams/-",
"value":{
"teamId":1385
}
0 votes
Heidi Hendry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 25, 2022

If you ended up here and want to know more about the roleId :
What are the role IDs for different team types when adding users to Teams using APIs?

Dan Tombs
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 02, 2022

Hey @Heidi Hendry

This is really useful. This is definitely something I was getting a little lost on.

Dan

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events