Is it possible to manage Ezeelogin users via API?
Managing users in Ezeelogin via API
Overview: This article explains how to manage Ezeelogin users through API.
To use the API feature, login to the Ezeelogin GUI, navigate to Settings → API, and set a new API secret and Save it.
The API script can be executed as:
For Help
1. Suspend User
root@gateway:~# php /usr/local/ezlogin/ezwapi.php -help suspend_user
Usage:
ezwapi.php suspend_user -api_url <API URL> -secret <API secret> -user <username>
Example:
root@gateway:~# php /usr/local/ezlogin/ezwapi.php suspend_user -api_url http://192.168.1.9/ezlogin -secret zxcvbnm -user john
2. Unsuspend User
root@gateway:~# php /usr/local/ezlogin/ezwapi.php -help unsuspend_user
Usage:
ezwapi.php unsuspend_user -api_url <API URL> -secret <API secret> -user <username>
Example:
root@gateway:~# php /usr/local/ezlogin/ezwapi.php unsuspend_user -api_url http://192.168.1.9/ezlogin -secret zxcvbnm -user john
3. Force password change
root@gateway:~# php /usr/local/ezlogin/ezwapi.php -help force_user_password_change
Usage:
ezwapi.php force_user_password_change -api_url <API URL> -secret <API secret> -user <username>
Example:
root@gateway:~# php /usr/local/ezlogin/ezwapi.php force_user_password_change -api_url http://192.168.1.9/ezlogin -secret zxcvbnm -user john
This feature is only available from Ezeelogin version 7.32.0
4. Set user expiry
root@gateway:~# php /usr/local/ezlogin/ezwapi.php -help set_user_expiry
Usage:
ezwapi.php set_user_expiry -api_url <API URL> -secret <API secret> -user <username> -expiry <YYYY-MM-DD>
Refer to the example below to set expiry for user ’John’. Setting expiry will also make the user active if suspended.
root@gateway:~# php /usr/local/ezlogin/ezwapi.php set_user_expiry -api_url http://192.168.1.38/ezlogin -secret ’zjdfji@#$!’ -user john -expiry "2025-01-30"
200: {"status":"success","data":"Success"}
If the user is already suspended the above API script will unsuspend the user and will set the new expiry date.
Setting user expiry via API is only available from Ezeelogin version 7.40.0
5. Reset_user_password
To reset a user’s password, enable the "Password Reset API" by going to Settings → Security → Enable Password Reset API.
root@gateway:~# php /usr/local/ezlogin/ezwapi.php -help reset_user_password
Usage:
ezwapi.php reset_user_password -api_url <API URL> -secret <API secret> -user <username>
Refer to the example below to reset password of user ’John’.
root@gateway:~# php /usr/local/ezlogin/ezwapi.php reset_user_password -api_url http://192.168.1.38/ezlogin -secret ’zjdfji@#$!’ -user john
200: {"status":"success","data":"zm3Kw*aDZ"}
Log in to the web GUI using the newly generated password "zm3Kw*aDZ" of user 'john' and reset it from the UI.
This feature is only available from Ezeelogin version 7.41.0
How can we view API logs?
Step 1(A): To view all the actions performed via API navigate to Users → Web Activity → Who and select API. This will display a list of logs for all the actions executed through API.
Step 1(B): From the drop-down menu for the Section, select "Users" which will display the list of logs for all the user actions performed via API.
This feature to list the logs for the actions performed via API is available from Ezeelogin version 7.40.0
Related Articles: