CLI4(1)

πŸ“¦ version 2.19.4, in epel 10, epel 9, fedora 43, fedora 44

πŸ’– CLI4 β€” bestie edition πŸ’–

okay so you found the manual page for cli4, which lives in the General Commands Manual section, and honestly? you're about to have a great time. it's a whole command line glow-up for the Cloudflare v4 API. let's get into it πŸ¦‹


✨ NAME ✨

cli4 β€” command line access to Cloudflare v4 API

like, literally, that's the whole vibe. your terminal, but make it Cloudflare.


🌸 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...

no cap, that's the whole shape of it. flags first, then your params, then the command at the end. main character energy: the command goes last. πŸ‘‘


πŸ’… DESCRIPTION πŸ’…

cli4 provides command line access to Cloudflare v4 API. that's it, that's the girl. she gives you the entire Cloudflare v4 API from your terminal and she does not gatekeep. πŸ’œ


πŸŽ€ OPTIONS πŸŽ€

  • -V, --version β€” display program version number and exit. cute, quick, done. ✨
  • -h, --help β€” this information (in a terse form). yes she's giving you the short version, don't be greedy.
  • -v, --verbose β€” provide some protocol debugging information. for when you need to see the receipts πŸ”
  • -e, --example β€” show the path to the examples folder/directory. the folder of inspiration, bestie πŸ“
  • -q, --quiet β€” don't output any JSON/YAML responses. shhh 🀫
  • -j, --json β€” output response data in JSON format (the default). she's the default for a reason πŸ’…
  • -y, --yaml β€” output response data in YAML format (if yaml package installed). conditional queen, needs her package 🧚
  • -n, --ndjson β€” output response data in NDJSON format (if jsonlines package installed). also conditional, also iconic 🌈
  • -r, --raw β€” output JSON results in raw mode without splitting out the errors and results. no filter, just vibes πŸ’€
  • -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. the full lore drop πŸ“œ
  • -b, --binary β€” open files in binary mode. 🫢
  • -A openapi-url, --openapi openapi-url β€” decode Cloudflare's OpenAPI spec and output all the known commands. hello, master list of everything ✨
  • -p profile-name, --profile profile-name β€” select a profile-name from the configuration file (hence select custom email/token values). multiple identities, one girl πŸ’–
  • --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. dramatic and necessary πŸ’…
  • item=value β€” set a parameter 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 parameter or data value to send with a GET, PATCH, POST, PUT or DELETE command. the value is sent as an integer. (note the : before the =, it's not a typo, it's a personality trait πŸ”₯)
  • item=@filename β€” set a parameter 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. this is the moment, this is the main event πŸ‘‘
also lowkey note: the synopsis up top spells the HTTP verbs as -G|--get, -P|--patch, -O|--post, -U|--put and -D|--delete. iykyk πŸ¦‹

πŸ’œ COMMAND(S) πŸ’œ

the command string uses slash (/) to separate the verbs in the same way that the Cloudflare v4 API documentation does. it's giving "same energy as the docs" and we love that for us.

  • any verb starting with colon (:) is either converted to zone_id, user_id, organtization_id, or otherwise. ✨
  • any verb starting with colon (:) and followed by 32 hex characters is passed thru raw.
  • any verb starting with two colons (::) is passed thru raw.

so like, the colons are the magic. she's doing conversions for you, periodt. πŸŽ€


🌈 RESULTS 🌈

the output is either JSON or YAML formatted. pick your fighter. πŸ’–


πŸ¦‹ EXAMPLES πŸ¦‹

okay bestie, this is the part you screenshot. πŸ“Έ

cli4 /zones β€” list information 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 specific zone.

cli4 /zones/:example.com/dnssec β€” list DNSSEC information and status for a specific zone.

not me noticing there are like four different ways to purge a cache up there. she contains multitudes πŸ’…

⭐ SEE ALSO ⭐

the Cloudflare API can be found at https://api.cloudflare.com/. each API call is provided via a similarly named function within the Cloudflare class. so if you know one, you basically know the other. obsessed. 🫢


and that's the whole page, bestie. this was CLI4(1) from the General Commands Manual, and if you ever need to look it back up, it's filed right there under CLI4(1) like the icon she is. go forth and hit that API. πŸ’–βœ¨πŸ‘‘

πŸ“¦ where this page comes from