Website Exclusion Rules

A Website resource can have a number of Rules associated with it. These Rules dictate which files or folders are excluded from the backup process.

The exclusion rules follow simple wildcard-style pattern matching. For example, to exclude all .log files in a particular directory, you can construct a rule like /path/to/folder/*.log to prevent those log files from being backed up. Absolute paths for directories and files are also acceptable. In the case of directories, those rules must end with /* to ensure all content within the directory is not inspected. For example, /path/to/excluded_folder/*.

Website Exclusion Rules must be modified as a set.

Attributes

The following are the attributes associated with the Rules resource. Whether they are required or optional is specified in the sections that follow.

include_rules

This attribute is not modifiable by the API at this time.

exclude_rules

An array of file and folder paths to exclude from a Website backup. Wildcard pattern matching is supported.

Get Website Exclusion Rules

This method will return an array of rules Rules associated with the specified Website record.

URI: /websites/<WEBSITE ID>/rules

Method: GET

Required Attributes

The request will not succeed without these attributes.

Optional Attributes

None

Example Request
curl -v -H "Content-type: application/json" -H "Accept: application/json" -X GET 'https://api.codeguard.com/websites/15434/rules?oauth_consumer_key=u1xe85RrWhpJim3xslJb9GI9ENms6PmFjYDeTOgc&oauth_nonce=1234&oauth_signature=JxkBWtFneUDx02ArD1ZBR7NGmWs%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1307966160&oauth_token=qFFTIQszYZwHc4KmeZciyFjHT9XdcsRGrgkgwPQr&oauth_version=1.0'
        
Example Response
(
            [include_rules] => Array
            (
            )

            [exclude_rules] => Array
            (
                [0] => *access-logs/*
                [1] => *error_log*
                [2] => *stats/*
                [3] => *proc/*
                [4] => *dbcache/*
                [5] => /path/to/a/folder/*
                [6] => /path/to/a/file.txt
            )
        )
        

Set Website Exclusion Rules

This method will set the array of Rules associated with the specified Website record. This will overwrite all existing Rules previously associated with a Website record.

URI: /websites/<WEBSITE ID>/rules

Method: POST

Required Attributes

The request will not succeed without these attributes.

Optional Attributes

None

Example Request
curl -v -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{"exclude_rules" : ["\/path\/to\/a\/folder\/*","\/path\/to\/a\/file.txt"]} 'https://api.codeguard.com/websites/15434/rules?oauth_consumer_key=u1xe85RrWhpJim3xslJb9GI9ENms6PmFjYDeTOgc&oauth_nonce=1234&oauth_signature=JxkBWtFneUDx02ArD1ZBR7NGmWs%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1307966160&oauth_token=qFFTIQszYZwHc4KmeZciyFjHT9XdcsRGrgkgwPQr&oauth_version=1.0'
        
Example Response
(
            [include_rules] => Array
            (
            )

            [exclude_rules] => Array
            (
                [0] => *access-logs/*
                [1] => *error_log*
                [2] => *stats/*
                [3] => *proc/*
                [4] => *dbcache/*
                [5] => /path/to/a/folder/*
                [6] => /path/to/a/file.txt
            )
        )