Work with Users
With HAPI, you can create scripts to gather lists of users based on different criteria and deactivate users.
Tip: Expanding on these scripts
You can use the methods outlined on this page with other HAPI methods.
Get user by name
To get a user by username and return their email address, enter a script like this in the Script Console:
Enter a script like this in the Script Console:
Users.getByName('USERNAME').emailAfter you run this script, the user email is printed in the log:
Deactivate users
To deactivate a user, enter a script like this in the Script Console:
Enter a script like the following in the Script Console:
Users.getByName('USERNAME').deactivate()After you run this script, the user is deactivated. When you navigate to the Users screen, you can see the disabled flag next to the user:
Get inactive users
Get logged in user
To get the current logged in user, use a script like this in the Script Console:
Use a script like the following in the Script Console:
Users.getLoggedInUser()After running this script, you get a list of users who are logged in: