← 返回命令列表

Linux command

cli4 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

List all zones

cli4 /zones

Get details for a specific zone

cli4 /zones/[zone_id]

Purge entire cache

cli4 --post /zones/[zone_id]/purge_cache purge_everything:=true

List DNS records

cli4 /zones/[zone_id]/dns_records

Create a DNS record

cli4 --post /zones/[zone_id]/dns_records type:='"A"' name:='"www"' content:='"192.0.2.1"'

Delete a DNS record

cli4 --delete /zones/[zone_id]/dns_records/[record_id]

Update a page rule

cli4 --put /zones/[zone_id]/pagerules/[rule_id] status:='"active"'

说明

cli4 is a command-line tool for interacting with the Cloudflare API v4. It provides direct access to all Cloudflare API endpoints, allowing management of zones, DNS records, firewall rules, page rules, and other Cloudflare features from the terminal. The tool uses a simple syntax where API endpoints are specified as paths and data is passed as key-value pairs. JSON values use the := operator for proper typing, while string assignment uses =. Authentication is handled via environment variables or a configuration file. cli4 is particularly useful for automation and scripting Cloudflare operations. It can be integrated into CI/CD pipelines for cache purging, DNS updates, or firewall rule management.

参数

--get
HTTP GET request (default).
--post
HTTP POST request.
--put
HTTP PUT request.
--patch
HTTP PATCH request.
--delete
HTTP DELETE request.
-q, --quiet
Suppress output.
-v, --verbose
Verbose output including HTTP headers.
-r, --raw
Output raw JSON without formatting.
-d, --dump
Dump the request instead of executing it.

FAQ

What is the cli4 command used for?

cli4 is a command-line tool for interacting with the Cloudflare API v4. It provides direct access to all Cloudflare API endpoints, allowing management of zones, DNS records, firewall rules, page rules, and other Cloudflare features from the terminal. The tool uses a simple syntax where API endpoints are specified as paths and data is passed as key-value pairs. JSON values use the := operator for proper typing, while string assignment uses =. Authentication is handled via environment variables or a configuration file. cli4 is particularly useful for automation and scripting Cloudflare operations. It can be integrated into CI/CD pipelines for cache purging, DNS updates, or firewall rule management.

How do I run a basic cli4 example?

Run `cli4 /zones` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --get do in cli4?

HTTP GET request (default).