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

Description

This function edits a script hook.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/edit_hook?api.version=1&id=HzEpGvT6QGUYwxuX3hWB8AUq&enabled=0
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/edit_hook?api.version=1&id=HzEpGvT6QGUYwxuX3hWB8AUq&enabled=0

Important:

cPanel & WHM version 66 deprecated XML output.

 Command Line
whmapi1 edit_hook id=HzEpGvT6QGUYwxuX3hWB8AUq enabled=0


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)
{
 "metadata": {
    "result": 1,
    "reason": "OK",
    "version": 1,
    "command": "edit_hook"
  }
}
 Output (XML)
    <metadata>
        <reason>OK</reason>
        <result>1</result>
        <version>1</version>
        <command>edit_hook</command>
    </metadata>

Important:

cPanel & WHM version 66 deprecated XML output.


Note:

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


Parameters

ParameterTypeDescriptionPossible valuesExample

id

string

Required

The script hook's ID.

Note:

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

A valid string.

HzEpGvT6QGUYwxuX3hWB8AUq
check string

A script that runs after the hook script to check the results.

Note:

We added this function in cPanel & WHM version 84.

A valid absolute file path./scripts/postcourier-authlibup
description
                
string

The hook scripts's description.

A valid string.TestHook
enabledBoolean

Whether the hook script is enabled.

  • 1 — Enabled.
  • 0 — Disabled.
1
exectypestring

The type of function that the script hook launches.

Note:

We added this function in cPanel & WHM version 84.

  • script — Runs a script.
  • module — Calls a function in a module.
script 
hook 

string

The hook script.

Note:

We added this function in cPanel & WHM version 84.

A valid absolute file path or module::subroutine invocation.

/scripts/postcourier-authlibup

notesstringThe script hook's notes.A valid string.
Note
rollback string 

A script that rolls back the hook script.

Note:

We added this function in cPanel & WHM version 84.

A valid absolute file path. /scripts/postcourier-authlibup
stage string 

The condition when the hook script executes.

Note:

We added this function in cPanel & WHM version 84.

  • pre — The script runs before the function.
  • post — The script runs after the function.
post 
weightinteger 

The script hook's priority in the hook's stage.

Note:

We added this function in cPanel & WHM version 84.

A valid positive integer, where lower values run before higher values.100 

Returns

This function only returns metadata.