How Do You Deactivate a HipChat User with Only His/Her Email Address Using the REST API?

Problem scenario
You have email addresses of users that you want deactivated. You do not want to use the GUI for HipChat. How do you invoke REST APIs to deactivate a user?

Prerequisite
You need an API token for HipChat. If you have this, start with the Procedures below. Otherwise keep reading this "Prerequisite" section. You need several scopes for the API token authorize you to be able to deactivate a user. Once you have the alphanumeric string of an unexpired token that has sufficient privileges to delete users, you can craft a curl command.

To generate a token, log into the HipChat web UI. Go to the upper right hand corner and click on your icon, then click on "Account". See these directions and start on step #5:
https://community.frontapp.com/t/186p1p/how-to-enable-and-use-the-hipchat-integration

Procedures
Here is how to deactivate a user based on email address using the REST API:

curl -H "Authorization:Bearer abcd1234" -X DELETE http://hipchatservername.com/v2/user/jdoe@acme.com --insecure

# The command is "DELETE", but it does not delete the user.  It deactivates the user.

# If you want to learn more about how passing an API token works, you may want to read this link https://stackoverflow.com/questions/22229996/basic-http-and-bearer-token-authentication

Leave a comment

Your email address will not be published. Required fields are marked *