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

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


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
Community Members
Community Events
Community Groups

Adding Users to group using rest API - Powershell



I am running into an issue trying to call the Rest API Method using Powershell. I am sure I am calling the URL properly with my access token and other info. Although I am running into an issue. 

I have a script that can Grab the users ID and Group Id I want to add them too. The Last step is confusing me.

$gId = $group.groupId

$aId = $user.accountId

$Headers = @{"Authorization"="Basic $($authinfo)"}

$id = @{
          accountId = "$aId"

$body = $id | ConvertTo-Json

params = @{
Uri = "$gId"
Method = 'POST'
Body = $body
ContentType = 'application/json'

Invoke-RestMethod @params -Headers $Headers



Invoke-RestMethod : The remote server returned an error: (400) Bad Request.


Changed URL to default - I replace my site in the script. 

3 answers

1 accepted

1 vote
Answer accepted

Not sure what the issue was. It started working the next day. Might be a limit how many times API is called? 

0 votes
Nik Thumma
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Mar 22, 2023

@Anthony Brunocan you provide the part of the script to pull users & their ID's?  Thanks

If I find the output of the Uri it is this:
"accountId": "5f31c34f1ac29c00458906f5"

 so the Account ID / group Ids should be valid. 

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events