WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function discards the staged ModSecurity™ rule changes, if present, for all of the configuration files.
Important:
When you disable the Web Server role, the system disables this function.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_discard_all_rule_changes
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_discard_all_rule_changes
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_discard_all_rule_changes{ "data": { "failed": [ … ], "outcomes": [ … ] }, "metadata": { "command": "modsec_discard_all_rule_changes", "reason": "OK", "result": 1, "version": 1 } }
Request
This function discards staged rule changes for a ModSecurity™ configuration file. Staged rule changes reside in a .STAGE file (for example, the staged changes for the example.conf file exist in the example.conf.STAGE file). This function deletes the .STAGE file that corresponds to the configuration file that you specify.
Note:
To stage rule changes, call WHM API 1's modsec_add_rule function.
Important:
When you disable the Web Server role, the system disables this function.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_discard_rule_changes
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_discard_rule_changes
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_discard_rule_changes?config=modsec2.example.conf'{ "data": {}, "metadata": { "command": "modsec_discard_rule_changes", "reason": "OK", "result": 1, "version": 1 } }
Request
This function stages edits to a ModSecurity™ rule. The system does not save changes directly to the configuration file. Instead, it stages the changes to the configuration file's .STAGE file (for example, for the example.conf file, the system stages changes in the example.conf.STAGE file).
Important:
When you disable the Web Server role, the system disables this function.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_edit_rule
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_edit_rule
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/modsec_edit_rule?config=modsec_vendor_configs%2Fexample.conf&id=1234567&rule=SecAction+%22pass%2Cid%3A1234567%22'{ "data": { "rule": { … } }, "metadata": { "command": "modsec_edit_rule", "reason": "OK", "result": 1, "version": 1 } }