Hi @labboy0276,
As I’m not any good at cURL commands and API requests, I use Postman to make pretty much all my Cloudflare API requests. Looking at your question and @sdayman answer, I got curious about how the app handled this, as I have been using for a while a command to purge all pages from specific hosts within some of my zones.
All the Cloudflare API requests I make were imported from the Cloudflare collection for Postman, then adjusted with my API keys, email etc.
Both the Cloudflare collection for Postman and the API documentation have this command with POST as the method, but somehow I now noticed that it’s changed in the Postman app to a DELETE.
And the list of files is included as the “Body” in a comma-separated list. Notice that the “files” object does not contain the URL part. Yet it works, at least from within the Postman app:
{
"files":[
"https://www.example.com/",
"https://www.example.com/some-post/",
"https://www.example.com/another-post/",
"https://www.example.com/some-file.js",
"https://www.example.com/another-file.css"]
}
Postman itself translates this back to curl as the following (I have removed the Postman token line):
curl -X DELETE \
https://api.cloudflare.com/client/v4/zones/{{zone_id}}/purge_cache \
-H 'Content-Type: application/json' \
-H 'X-Auth-Email: [email protected]' \
-H 'X-Auth-Key: {{auth_key}}' \
-H 'cache-control: no-cache' \
-d '{
"files":[
"https://www.example.com/",
"https://www.example.com/some-post/",
"https://www.example.com/another-post/",
"https://www.example.com/some-file.js",
"https://www.example.com/another-file.css"]
}'
(I tried this, but got all kinds of error msgs, all related to “bad request”, so I guess my inexperience with handling curl won’t let me test this)