Child pages
  • WHM API 1 Functions - forcepasswordchange
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

 

Description

This function forces a user to change the account password after the next login attempt.

Warning:

This function does not change the account's password. It only forces the user to change the account password at the next login attempt. 

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/forcepasswordchange?api.version=1&users_json=%7B%22user1%22%3A1%2C%22user2%22%3A1%2C%22user3%22%3A1%7D%0A&stop_on_failure=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/forcepasswordchange?api.version=1&users_json=%7B%22user1%22%3A1%2C%22user2%22%3A1%2C%22user3%22%3A1%7D%0A&stop_on_failure=1
 Command Line
whmapi1 forcepasswordchange users_json=%7B%22user1%22%3A1%2C%22user2%22%3A1%2C%22user3%22%3A1%7D stop_on_failure=1


Notes:

  • Unless otherwise noted, you must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
  "data": {
    "updated": [
      "user"
    ]
  },
  "metadata": {
    "version": 1,
    "reason": "OK",
    "result": 1,
    "command": "forcepasswordchange"
  }
}
 Output (XML)
<result>
    <data>
        <updated>user</updated>
    </data>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>forcepasswordchange</command>
    </metadata>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

   

Parameters

ParameterTypeDescriptionPossible valuesExample

users_json

string

Required

The list of users. The system will force each user that you specify to change their account's password the next time that they log in.

A JSON-formatted list of one or more users, where each username is a named parameter with a value of 1.

For example, to force a password change for the user1, user2, and user3 accounts, use the following string: {"user1":1,"user2":1,"user3":1}

{"user1":1,"user2":1,"user3":1}
stop_on_failureBoolean

Whether to halt the function if it experiences an error.

This parameter defaults to 0.

  • 1 — Halt on error.
  • 0 — Continue on error.
1

Returns

ReturnTypeDescriptionPossible valuesExample
updatedarrayAn array of usernames that the system will force to change their passwords.One or more valid usernames.user
  • No labels