Last modified November 7, 2024

manageHook

This function allows you to create/modify the Hook Object.
Parameters
Parameter name Type Description Possible Values Example
action String REQUIRED on both create/modify. The action you want to perform.
  • modify
  • create
action=create
_id String REQUIRED on action modify. The ID of the Hook.   _id=5f890a19e55cf262863522f2
name String REQUIRED on action create. The name you will like to give your hook.   name=exampleHook
script String REQUIRED on action create. Path to the script file used for your hook. Must begin with /   script=/PATH/TO/SCRIPT
position_type Integer REQUIRED on action create. When the hook should run.
  • 1 - pre
  • 2 - post
position_type=2
position Integer REQUIRED on action create. The type of Hook you wish to run.
  • 1 - Backup
  • 2 - Restore
  • 3 - Restore
  • 4 - Download
  • 5 - Reindex
  • 8 - Backup Account
  • 9 - Clone
  • 10 - Clone Account
position=1

Example Call JETAPI

jetbackup5api -F manageHook -D "action=create&name=hookexample&script=/PATH/TO/SCRIPT&position_type=1&position=1"

jetbackup5api -F manageHook -D "action=modify&_id=6509273a7cc0fb810207f612&name=hookexample&position_type=1&position=1"
success: 1
message: Hook Created/Updated Successfully
system:
  version: 5.3.3
  version_panel: 5.3.3
  tier: EDGE
  type: cPanel
  retry_ms: 0
  disableui:
  dr:
  agreement_panel:
  agreement:
  licenseIssue:
data:
  _id: 6509273a7cc0fb810207f612
  name: hookexample
  owner: 65075382d49adbd1660f06d2
  owner_name: root
  position_type: 1
  position: 1
  data_list:
  script: /PATH/TO/SCRIPT
  disabled:

Example Call HTTP

https://hostname.example.com:2087/cpsess##########/cgi/addons/jetbackup5/api.cgi?function=manageHook&action=create&name=examplehook&script=/PATH/TO/SCRIPT&position_type=1&position=1

https://hostname.example.com:2087/cpsess##########/cgi/addons/jetbackup5/api.cgi?function=manageHook&action=modify&_id=6509273a7cc0fb810207f612&name=hookexample&position_type=2&position=4