Hello all!
I have issue with removing user from group via Jira API:
curl --request GET \--url 'https://companyname.atlassian.net/rest/api/3/user?accountId=5e5e5fc13df51b0c93763279' \--user '########@mail.com:someToken' \--header 'Accept: application/json'
Returns:
{"self": "https://companyname.atlassian.net/rest/api/3/user?accountId=5e5e5fc13df51b0c93763279","accountId": "5e5e5fc13df51b0c93763279","accountType": "atlassian","avatarUrls": {"48x48": "https://secure.gravatar.com/avatar/c979c318273e0846b4e6f56ea0b60f27?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FDD-6.png","24x24": "https://secure.gravatar.com/avatar/c979c318273e0846b4e6f56ea0b60f27?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FDD-6.png","16x16": "https://secure.gravatar.com/avatar/c979c318273e0846b4e6f56ea0b60f27?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FDD-6.png","32x32": "https://secure.gravatar.com/avatar/c979c318273e0846b4e6f56ea0b60f27?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FDD-6.png"},"displayName": "Dmytro Danchenko","active": true,"timeZone": "Europe/Kiev","locale": "en_US","groups": {"size": 3,"items": []},"applicationRoles": {"size": 1,"items": []},"expand": "groups,applicationRoles"}
curl --request GET \--url 'https://companyname.atlassian.net/rest/api/3/user/groups?accountId=5e5e5fc13df51b0c93763279' \--user '########@mail.com:someToken' \--header 'Accept: application/json'
[{"name": "confluence-users","self": "https://companyname.atlassian.net/rest/api/3/group?groupname=confluence-users"},{"name": "jira-devops","self": "https://companyname.atlassian.net/rest/api/3/group?groupname=jira-devops"},{"name": "jira-software-users","self": "https://companyname.atlassian.net/rest/api/3/group?groupname=jira-software-users"}]
But:
curl --request DELETE \--url 'https://companyname.atlassian.net/rest/api/3/group/user?accountId=5e5e5fc13df51b0c93763279&groupname=jira-devops' \--user '########@mail.com:someToken' \
{"errorMessages": ["An error occurred: com.atlassian.idp.client.exceptions.UserNotFoundException: {\"schemas\":[\"urn:ietf:params:scim:api:messages:2.0:Error\"],\"status\":\"404\",\"detail\":\"A user with removed16 doesn't exists\",\"errorType\":\"UserDoesNotExist\",\"message\":\"A user with removed16 doesn't exists\",\"data\":\"removed16\"}"],"errors": {}}
What's wrong here?
Hi,
Sorry to hear about this problem. I can see that you're trying to remove a user account from a group in Jira Cloud. I tried to recreate this problem, but this appears to be working for me.
I did notice that your last query looks a bit off to me. First, it looks like it has a trailing \ character which it probably should not have as there is no other newline command to add after that one. But I also noticed that you appear to be using the username and a token (or password) form of basic auth. This form has been deprecated since last year.
Instead I used a format of
curl --request DELETE \--url 'https://[yourcloudsite].atlassian.net/rest/api/3/group/user?accountId=[AccountIdGoesHere]&groupname=badapples' \--header 'Authorization: Basic [redactedStringforBasicAuth]'
And this worked for me. I'd recommend trying to follow the steps in Basic auth for REST APIs so that you can build a string of emailaddress:API_Token and then base64 encode that string. Once you have that encoded string you can pass it in an authorization header instead of using the --user parameter to attempt to login.
Try that instead and let me know if you run into any problems.
Andy
It looks like you're new here. Sign in or register to get started.