WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function disables a ModSecurity™ rule.
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_disable_rule
- A server running WHM.
https://whm-server.tld:2087/json-api/modsec_disable_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_disable_rule?config=modsec_vendor_configs%2Fexample.conf&id=1234567890'{ "metadata": { "command": "modsec_disable_rule", "reason": "OK", "result": 1, "version": 1 } }
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 } }