I have site admin access, but for two groups they keep returning
"Specified user does not exist or you do not have required permissions" using Rest API
Currently the API works with adding users to other groups, but for some reason these two are not playing ball.
In Jira Automation
Web Request
Get
https://myinstance.atlassian.net/rest/api/3/user/search?query='{{Issue.Email}}'
user xxxxx:xxxx
Content-Type application/json
Authorization Basic xxxx
Accept application/json
This works
Status 200s returned and Account ID is then grabbed as a variable and recoded in audit to confirm it has been grabbed
Variable name
* AccIDAccess your variable in other actions by using {{AccID}}
Smart value*
{{WebResponse.body.accountId}}
Log message* {{AccID}}
Web Request
Post
https://myinstance.atlassian.net/rest/api/3/group/user?groupId=zzzzzzz
user xxxxx:xxxx
Content-Type application/json
Authorization Basic xxxx
Accept application/json
{
"accountId": "{{AccID}}"
}
For every other group bar two this works
But for 2 groups it returns either
400
{errorMessages=[Cannot add user. User is already a member of '{1}'], errors={}}
This is OK as means someone has manually put them in the relevant group
Or
404
{errorMessages=[Specified user does not exist or you do not have required permissions], errors={}}
But
- user exists as they were found via their email and the account ID returned, so that rules out Specified user does not exist part of the error
- I have the permissions as, 1) the user n Auth work on the Get and on other group adds, 2) I am site admin
So not sure why this is glitching on two of the groups.