Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation

Generate or Retrieve an Access Hash — accesshash

For WHM version 11.32 and later

You can use this function to retrieve an access hash for the root user. Authenticated resellers may also retrieve an access hash if he or she has the all ACL.

You can also use this function to generate or regenerate an access hash.

Calling Functions

Using the XML API

To use the XML API to perform the accesshash function from within your custom script:

  • Append the /xml-api/accesshash 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/accesshash

  • 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

To use the JSON API to perform the accesshash function from within your custom script:

  • Append the /json-api/accesshash 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/accesshash

  • 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 following parameter is required:

  • api.version (integer) — The version of the API to use. When using the accesshash function, this parameter should always be passed 1.

Both of the following parameters are optional.

  • generate (boolean) — Select whether or not the access hash should be regenerated.
  • user (string) — The name of the user whose access should be generate or retrieved.

Output

  • results — The results container.
    • data — The data container.
      • accesshash (hash) — The hash that was generated or returned.
    • metadata — The metadata results container.
      • result (boolean) — A boolean value that indicates whether or not the function completed successfully. A value of 1 indicates that the function ran successfully.
      • reason (string) — A message of success (OK) or a reason for failure.
      • version (integer) — The version of the API used. This result should always be 1.
      • command (string) — The API function that was executed. This result should always be accesshash.

Examples

XML API

Calling the following function in WebHost Manager:

https://example.com:2087/xml-api/accesshash?api.version=1&user=reseller1

<result>
   <data>
      <accesshash>
cb523f89e9a31123fde7c6f93b580ac05bf00a2804d4febe6667ab9917a14baa1c4914da209bf55c862999ea51983a117a4d2f238140200b1e5b270b94b2c52492747e5ebfdeddb8abf4e1b0c428c6c68b701b48e13dbe39da49450e7a8e5422e18ab3b6290b5b6556bd82ee21d9c1103e7a51d1e94f2ac0c4dcc6a10954b8634c6db16a541660c3c89e10254f05583f4167adfcff7781090ea930647b46e5b981f3e16c7723ca4e12dc4b54a778dc66a28df73632a0d3a8e01e207b9fd6b555b72936a903af014f30061d712d736176a87fb5333c5b90cf0bb4f3c6735f2b45929ac79fb1184045a5f4c20bfcc553f5ab760eec077c0d6096e54d02724201281e441e7b0f642370a63f61c68766e224c8510bc32b0316780660c34352cbfeeccfee9d4f02e20ba7b664d3e84e9419ca386c41df07613f8af252aba8626a8b54796bbe616f41af1e6f11a3d0327f7608d23666fca64e6ebe899f7479a5fb0aea008b1e7a41890c9c58037682450febf91b7aa1c080d31d834b0ae466f8533df838ab271b26a7fb7de96402ad4a818d6b786af92c38414d2ef6c88deb7c685a1e60c3cbcfbf20cf6d2a00dd50d2be9bc1824d91284ec6842dd7db42564dfc3ecb75c1a9bc775c45c5f08784b9e2885c2d
      </accesshash>
   </data>
   <metadata>
      <result>1</result>
      <reason>OK</reason>
      <version>1</version>
      <command>accesshash</command>
   </metadata>
</result>
<!--
WebHost Manager 11.31.0.16 (c) cPanel, Inc. 2011 http://cpanel.net/ Unauthorized copying is prohibited.
-->

JSON API

Calling the following function in WebHost Manager:

https://example.com:2087/xml-api/

{ "data" : { "accesshash" : "cb523f89e9a31123fde7c6f93b580ac05bf00a2804d4febe6667ab9917a14baa1c4914da209bf55c862999ea51983a117a4d2f238140200b1e5b270b94b2c52492747e5ebfdeddb8abf4e1b0c428c6c68b701b48e13dbe39da49450e7a8e5422e18ab3b6290b5b6556bd82ee21d9c1103e7a51d1e94f2ac0c4dcc6a10954b8634c6db16a541660c3c89e10254f05583f4167adfcff7781090ea930647b46e5b981f3e16c7723ca4e12dc4b54a778dc66a28df73632a0d3a8e01e207b9fd6b555b72936a903af014f30061d712d736176a87fb5333c5b90cf0bb4f3c6735f2b45929ac79fb1184045a5f4c20bfcc553f5ab760eec077c0d6096e54d02724201281e441e7b0f642370a63f61c68766e224c8510bc32b0316780660c34352cbfeeccfee9d4f02e20ba7b664d3e84e9419ca386c41df07613f8af252aba8626a8b54796bbe616f41af1e6f11a3d0327f7608d23666fca64e6ebe899f7479a5fb0aea008b1e7a41890c9c58037682450febf91b7aa1c080d31d834b0ae466f8533df838ab271b26a7fb7de96402ad4a818d6b786af92c38414d2ef6c88deb7c685a1e60c3cbcfbf20cf6d2a00dd50d2be9bc1824d91284ec6842dd7db42564dfc3ecb75c1a9bc775c45c5f08784b9e2885c2d" },
  "metadata" : { "command" : "accesshash",
      "reason" : "OK",
      "result" : 1,
      "version" : 1
    }
}

Topic revision: r1 - 14 Feb 2012 - 16:59:47 - Main.RosieArcelay