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

 

Description

This function changes the order of script hooks.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/reorder_hooks?api.version=1&id=HzEpGvT6QGUYwxuX3hWB8AUq%2CUNs8a8IbbAVf5oi_hXbcEw5a
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/reorder_hooks?api.version=1&id=HzEpGvT6QGUYwxuX3hWB8AUq%2CUNs8a8IbbAVf5oi_hXbcEw5a
 Command Line
whmapi1 reorder_hooks id=HzEpGvT6QGUYwxuX3hWB8AUq%2CUNs8a8IbbAVf5oi_hXbcEw5a


Notes:

  • 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. 

 Output (JSON)
{
  "data": {
    "hook_order": [
      {
        "weight": 100,
        "id": "HzEpGvT6QGUYwxuX3hWB8AUq"
      },
      {
        "weight": 200,
        "id": "UNs8a8IbbAVf5oi_hXbcEw5a"
      }
    ]
  },
  "metadata": {
    "reason": "OK",
    "version": 1,
    "result": 1,
    "command": "reorder_hooks"
  }
}
 Output (XML)
<result>
    <data>
        <hook_order>
            <id>HzEpGvT6QGUYwxuX3hWB8AUq</id>
            <weight>100</weight>
        </hook_order>
        <hook_order>
            <id>UNs8a8IbbAVf5oi_hXbcEw5a</id>
            <weight>200</weight>
        </hook_order>
    </data>
    <metadata>
        <reason>OK</reason>
        <result>1</result>
        <version>1</version>
        <command>reorder_hooks</command>
    </metadata>
</result>


Note:

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

   

Parameters

ParameterTypeDescriptionPossible valuesExample

id

string

Required

A list of script hook IDs in order of priority.

Note:

To retrieve a hook's ID, use the list_hooks function.

A comma-separated and uuencoded list of strings.

 

HzEpGvT6QGUYwxuX3hWB8AUq%2CUNs8a8IbbAVf5oi_hXbcEw5a

Returns

ReturnTypeDescriptionPossible valuesExample

hook_order

hash

A hash of the script hook details.

This hash includes the id and weight returns. 

id

string

The script hook's ID.

The function returns this value in the hook_order hash.

A valid string.

HzEpGvT6QGUYwxuX3hWB8AUq

weight

integer

The script hook's weight.

The function returns this value in the hook_order hash.

A positive integer, where lower numbers represent greater priority.100