Hey,
I saw in the documentation this method https://docs.atlassian.com/software/jira/docs/api/REST/7.12.0/#api/2/user-removeUser but It doesn't work for me.
I've tried to send the relevant accountId and as GET method I do get the relevant user but it doesn't work when I try to delete it.
Thanks in advance!
Hi all,
Please check this documentation if it helps:
Regards,
Igor
Hi Yuval,
Do you get a response from the server when executing the delete method? If so, what's the message and what's the response code?
If you use curl please share your command so we can troubleshoot it or share a screenshot from your Postman or any tool you might be using.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Charlie Misonne
I'm using postman+JS but I first started with postman in order to see that actually works before iterating through all the users.
This is the GET which does respond correctly:
But when I try to delete it:
it doesn't show anything and it didn't delete the user.
In addition I used the following script to delete projects and it did work ( even if the post man delete method didn't show any response):
axios
.get(
session_url,
{ auth: {
username: '****',
password: '*****'},
}
)
.then(function (response) {
let res= response.data;
let idArr=new Array();
for(var key in res){
idArr.push(res[key]['id']);
}
console.log(idArr);
for(var id in idArr){
axios.delete(
session_url+'/'+idArr[id],
{ auth: {
username: '*****',
password: '*****'},
}
)
;
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I can see a first reason already.
You were looking at the documentation for Jira SERVER and not for Jira Cloud which you seem to be using.
Cloud and Server do not share exactly the same REST endpoints.
Here is the documentation for Cloud: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-user-delete
The endpoint is /rest/api/3/user. 3 instead of 2. Can you try changing that and test again?
You also need to be a site administrator but I assume you are.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey thank you for the quick response, It didn't work either.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well that's odd. In your screenshot I see you get a 204 response and that should mean the user was removed successfully.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.