reply
Change an Account's Password — passwd
This function changes the password of a domain owner (cPanel) or reseller (WHM) account.
Calling Functions
Using the XML API
Using the JSON API
Variables
Input
Output
Examples
XML API
JSON API
Calling Functions
Using the XML API
Show Hide To use the XML API to perform the passwd function from within your custom script:
•Append the /xml-api/passwd function call name, plus the required variables (see below), to a URL which includes the address of your server.
•For example, on a server whose hostname is example.com, you would include the following string in your script:
https://example.com:2087/xml-api/passwd
•You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.
•You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.
Using the JSON API
Show Hide To use the JSON API to perform the passwd function from within your custom script:
Append the /json-api/passwd function call name, plus the required variables (see below), to a URL which includes the address of your server.
For example, on a server whose hostname is example.com, you would include the following string in your script:
https://example.com:2087/json-api/passwd
You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.
You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.
Variables
Input
The passwd function takes the following variables as input. Both variables are required:
•user (string) — Name of the user whose password should be changed.
•pass (string) — New password for the user.
Output
Show Hide
•passwd — Root-level tag for the output of the passwd function.
◦rawout — Raw message output.
◦services — List of services for which the password has been updated.
■app — Service for which the password was updated. Should include the following:
■system
■ftp
■mail
■mysql
◦status — Whether or not the operation completed successfully.
■1 — yes.
■0 — no.
◦statusmsg — Details of the success or failure.
Examples
XML API
Show Hide Calling the following function:
https://example.com:2087/xml-api/passwd?user=bob&pass=r3allyc0pml3xp@ss!234
in WebHost Manager will produce output similar to:
<passwd>
<passwd>
<rawout>
Changing password for bob
Password for bob has been changed
Updating ftp passwords for bob
Ftp password files updated.
Ftp vhost passwords synced
</rawout>
<services>
<app>system</app>
</services>
<services>
<app>ftp</app>
</services>
<services>
<app>mail</app>
</services>
<services>
<app>mySQL</app>
</services>
<status>1</status>
<statusmsg>Password changed for user bob</statusmsg>
</passwd>
</passwd>