I have site admin access, however I am unable to add an user to a group using Rest API,what can I do

Carlos_Raygoza December 18, 2018

I have site admin access, using http basic auth, I am able to create user and groups using REST API; however, when I try to add an user using the following POST resource /rest/api/2/group/user?groupname=personal2, and payload {"name": "userX"}, I get the following error.

{
"errorMessages": [
"Specified user does not exist or you do not have required permissions"
],
"errors": {}
}

Could anyone help me?

 

2 answers

1 accepted

1 vote
Answer accepted
Qu3ntin
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.
December 18, 2018

Hi,

As specify in the documentation, you should use the accountId.

I suggest you to:

  1. Use Create user endpoint and set a variable with the accountId in the response
  2. Use the Add user to group endpoint with your accountId

If the user is already created, use Find users endpoint to get the accountId

Carlos_Raygoza December 18, 2018

It works, Thanks a lot Quentin, I appreciate your help on this matter.

Regards,

Carlos

Nicholas Ayala October 31, 2023

This worked for me as well. 

I would like to note that the documentation that comes with the postman collection displays the wrong format for the accountId.

Meaning it doesnt show the example as <number>:<guid> but instead just the <guid> piece.

0 votes
Maxine Widemann December 2, 2021

What type of access token did you use to create the user? When I execute the POST request with the acces token I generated in jira, I get a'failed to create user' error message... 

Nicholas Ayala October 31, 2023

I used the API Token generated under my Atlassian Account Settings.

I know you asked this almost 2y back so the UI must be different. But for anyone else that sees this page, you will need to generate a Key there and use it for the API calls. 

You cannot use the API Key generated in admin.atlassian.com. This key is for using the admin APIs

Suggest an answer

Log in or Sign up to answer