cli4 - Man Page
Command line access to Cloudflare v4 API
Synopsis
cli4 [-V|--version] [-h|--help] [-v|--verbose] [-q|--quiet] [-j|--json] [-y|--yaml] [-n|--ndjson] [-r|--raw] [-d|--dump] [-p profile-name|--profile profile-name] [item=value ...] [item=@filename ...] [-G|--get] [-P|--patch] [-O|--post] [-U|--put] [-D|--delete] /command...
Description
cli4 provides command line access to Cloudflare v4 API
Options
- [-V, --version]
Display program version number and exit.
- [-h, --help]
This information (in a terse form).
- [-v, --verbose]
Provide some protcol debugging information.
- [-q, --quiet]
Don't output any JSON/YAML responses.
- [-j, --json]
Output response data in JSON format (the default).
- [-y, --yaml]
Output response data in YAML format (if yaml package installed).
- [-n, --ndjson]
Output response data in NDJSON format (if jsonlines package installed).
- [-r, --raw]
Output JSON results in raw mode without splitting out the errors and results.
- [-d, --dump]
Output a list of all API calls included in the code.
- [-p profile-name, --profile profile-name]
Select a profile-name from the configuration file (hence select custom email/token values).
- --get
Send HTTP request as a GET (the default).
- --patch
Send HTTP request as a PATCH.
- --post
Send HTTP request as a POST.
- --put
Send HTTP request as a PUT.
- --delete
Send HTTP request as a DELETE.
- item=value
Set a paramater or data value to send with a GET, PATCH, POST, PUT or DELETE command. The value is sent as a string.
- item:=value
Set a paramater or data value to send with a GET, PATCH, POST, PUT or DELETE command. The value is sent as an interger.
- item=@filename
Set a paramater or data value to send with a POST or PUT command. The value is based on the content of the file.
- /command ...
The API command(s) to execute.
Command(s)
The command string uses slash (/) to seperate the verbs in the same way that the Cloudflare v4 API documentation does. Any verb starting with colon (:) is either converted to zone_id, user_id, organtization_id, or otherwise. Any verb starting with two colons (::) is passed thru raw.
Results
The output is either JSON or YAML formatted.
Examples
cli4 /zones List infomation for all zones.
cli4 /zones/:example.com List specific zone info.
cli4 /zones/:example.com/settings List settings for a specific zone.
cli4 --delete purge_everything=true /zones/:example.com/purge_cache Purge cache for a specific zone.
cli4 --delete files='[http://example.com/css/styles.css]' /zones/:example.com/purge_cache Purge cache for a specific zone.
cli4 --delete files='[http://example.com/css/styles.css,http://example.com/js/script.js] /zones/:example.com/purge_cache Purge cache for a specific zone.
cli4 --delete tags='[tag1,tag2,tag3]' /zones/:example.com/purge_cache Purge cache for a specific zone.
cli4 /zones/:example.com/available_plans List available plans for a zone.
cli4 --patch status=active /zones/:example.com/dnssec Make DNSSEC active for specfic zone.
cli4 /zones/:example.com/dnssec List DNSSEC infomation and status for a specific zone.
See Also
The Cloudflare API can be found https://api.cloudflare.com/. Each API call is provided via a similarly named function within the Cloudflare class.