Scroll to navigation

CLI4(1) General Commands Manual CLI4(1)

NAME

cli4 - Command line access to Cloudflare v4 API

SYNOPSIS

cli4 [-V|--version] [-h|--help] [-v|--verbose] [-e|--examples] [-q|--quiet] [-j|--json] [-y|--yaml] [-n|--ndjson] [-r|--raw] [ir|--image] [-d|--dump] [-b|--binary] [-A openapi-url|--openapi openapi-url] [-p profile-name|--profile profile-name] [item=value ...] [=value ...] [item=@filename ...] [=@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.
[-e, --example]
Show the path to the examples folder/directory.
[-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.
[-i, --image]
Output results as binary (i.e. it's an image). This isn't normally needed as the API returns a Content-Type to indicate an image is being returned. This option can be used to allow the API output to be output without any processing (i.e. JSON formatted).
[-d, --dump]
Output a list of all API calls included in the code.
[-b, --binary]
Open files in binary mode.
[-A openapi-url, --openapi openapi-url]
Decode Cloudflare's OpenAPI spec and output all the known commands.
[-p profile-name, --profile profile-name]
Select a profile-name from the configuration file (hence select custom email/token values).
Send HTTP request as a GET (the default).
Send HTTP request as a PATCH.
Send HTTP request as a POST.
Send HTTP request as a PUT.
Send HTTP request as a DELETE.
Set a paramater or data value to send with a GET, PATCH, POST, PUT or DELETE command. The value is sent as a string.
Set a paramater or data value to send with a GET, PATCH, POST, PUT or DELETE command. The value is sent as an interger.
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 coloe (:) and followed by 32 hex chracters is passed thru raw. 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.