Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Trying to call REST API to remove a user.

I'm trying to create a python script that will deactivate a jira user if they have left our employment. I'm trying to call the Jira cloud REST API but when I call the users/email?accountId I get returned a 404 error, it's specifically odd because I start off the fuction with a call that lists all the users, then I pull that data into a for loop which will start using the accountID and I don't get a 404 error there... what am I doing wrong?

here is a github gist to show you what I'm trying to accomplish... hopefully it helps...

https://gist.github.com/reubendevries-cta/1b1edf6000ad10278e15ac8173e745a3

1 answer

0 votes
carlosughini Community Leader Mar 15, 2021

Hi Reuben,

Welcome to the community! I hope you are having a nice day.

I'm not able to completely test your script, but from what it seems, I believe that the issue might be associated with the URL.

You can check the documentation here.

Please correct me in case I'm wrong, but apparently, you are building the URL like the following:

https://organizationspace.atlassian.net/rest/api/3/ + users/email + params

However, instead of users/email, the right format would be something like the following:

https://organizationspace.atlassian.net/rest/api/3/user? + accountId=

Could you please check the documentation and give it a try and let us know how it goes?

Looking forward to hearing from you.

Regards,

Carlos 

Hi @carlosughini ,

Thanks for the reply. Your looking at the delete user call. At this exact moment I want the person's email - eventually after I've matched the email address (which I will be passing through a python argument parse command), then I will use the delete curl request command a bit lower down in the function (I've yet to complete that part) . The reason for this is that a person's email is usually a pretty good unique identifier across multiple different platforms (O365, AWS, GitLab, and Atlassian) that we utilize. I hope this helps you understand my process. That being said if you look at the params section in the requests: http for humans documentation it will automatically append the "?" to the query portion of the API call.

carlosughini Community Leader Mar 17, 2021

Hi Reuben,

Are you still facing this issue?

Could you please get one specific use as an example and try to perform the request maybe using postman or the terminal by using the accountId?

I understand that using an email address is easier, however, some changes were made, for privacy reasons, which removed certain details that used to work on API calls. The E-mail address is one of them, so I think if you could try the request directly via postman or terminal and using one user as an example you could confirm if the issue is in the script, params or even the endpoint.

Looking forward to hearing from you.

@carlosughiniI'll look at it tomorrow morning, my workday is done for the day- so from what I am understanding from you the API call to grab the user's email address is no longer valid? That's disappointing... I guess I could try add another parameter in my script and user the username...

@carlosughinicould you clarify a bit further here... what I am doing is created a python script that will deactivate a user if they leave our company. Which parameter do you suggest I pass through to the python script. Using the very specific account guid wouldn't make sense because if I have to manually look that up, I might as well deactivate them from the console - bypassing any need for the script. It seems like Atlassian broke a major functionality of the API, without really thinking about it and just said it was for privacy... can you explain further...

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you