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

Description

This function discards the staged ModSecurity™ rule changes, if present, for all of the configuration files.

Important:

In cPanel & WHM version 76 and later, when you disable the WebServer role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/modsec_discard_all_rule_changes?api.version=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/modsec_discard_all_rule_changes?api.version=1 
 Command Line
whmapi1 modsec_discard_all_rule_changes


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.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
 {
    "data": {
        "outcomes": [
            {
                "ok": 1,
                "config": "modsec2.user.conf"
            },
            {
                "ok": 1,
                "config": "modsec_vendor_configs/MyVendor/one.conf"
            }
        ]
    },
    "metadata": {
        "version": 1,
        "reason": "OK",
        "result": 1,
        "command": "modsec_discard_all_rule_changes"
    }
}
 Output (XML)
 <result>
    <data>
        <outcomes>
            <ok>1</ok>
            <config>modsec2.user.conf</config>
        </outcomes>
        <outcomes>
            <ok>1</ok>
            <config>modsec_vendor_configs/MyVendor/one.conf</config>
        </outcomes>
    </data>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>modsec_discard_all_rule_changes</command>
    </metadata>
</result>


Note:

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

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
outcomesarray of hashesAn array of hashes that contains information about the discarded configuration changes.Each hash includes the config, ok, and exception returns. 

config

string

The file path to the configuration file.

The function returns this value in the outcomes array.

  • EasyApache 3 — A valid path, relative to the/usr/local/apache/conf/ directory.  
  • EasyApache 4 and cPanel & WHM version 56 or earlier — A valid path, relative to the /etc/apache2/conf.d/ directory.
  • EasyApache 4 and cPanel & WHM version 58 or later — A valid path, relative to the /etc/apache2/conf.d/modsec/ directory.
modsec_vendor_configs/MyVendor/one.conf

ok

Boolean

Whether the system successfully discarded the rule change.

The function returns this value in the outcomes array.

  • 1 — Success.
  • 0 — Failure.
1

exception

string

The error message for a failed discard.

The function returns this value in the outcomes array.

Note:

The function only returns this value if an error occurs.

The reason for failure.
 Click to view...

The system could not remove the file “/usr/local/apache/conf/modsec_vendor_configs/MyVendor/one.conf.STAGE”: Invalid argument\n

failedarray

The list of configuration files that contain changes that the system could not discard.

Note:

The function only returns this value if an error occurs.

A list of one or more configuration files. modsec_vendor_configs/MyVendor/one.conf