Hello Community!
I need some help with adding multiple users to a group.
When I send the request only one of the users is added.
What am I doing wrong?
I'm afraid this only works for a single user, if you have multiple users, we would need to make multiple calls
Thanks,
Pramodh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I used the api to add user to the group. it responded nothing and didn't add the user to the group. "get user from group api" works fine. accountId and group id are exported from jira. any idea?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey, @Marina Vital
I, too, was in a similar predicament. Here's what I was able to do.
I created a .sh script to add multiple users to a group.
Here's my approach.
⚠️ These are already created users.
#!/bin/bash
# Define the API endpoint and group ID
API_ENDPOINT='https:/your-domain.net/wiki/rest/api/group/userByGroupId?groupId=9366eda7-cbde-41f6-8b6d-27fad9219e3c'
# Define the user account IDs to be added
USER_ACCOUNT_IDS=(
"612498b165129802006af619ef"
"612498b165129802006af619eg"
"612498b165129802006af619eh"
"612498b165129802006af619ei"
"612498b165129802006af619ej"
)
# Loop through the user account IDs and send a curl request for each
for USER_ACCOUNT_ID in "${USER_ACCOUNT_IDS[@]}"; do
curl --request POST \
--url "$API_ENDPOINT" \
--user 'email@example.com:<api_token>' \
--header 'Content-Type: application/json' \
--data "{\"accountId\":\"$USER_ACCOUNT_ID\"}"
done
Next, you can check if it was successful by using the following curl command.
curl --request GET \
--url 'https://your-domain.atlassian.net/wiki/rest/api/group/member?name={name}' \
--user 'email@example.com:<api_token>' \
--header 'Accept: application/json' | jq .
If you need to get the name of your group, run this curl command:
curl --request GET \
--url 'https://your-domain.atlassian.net/wiki/rest/api/group/by-id?id={id}' \
--user 'email@example.com:<api_token>' \
--header 'Accept: application/json' | jq .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.