Re this Cloudflare API v4 Documentation
curl -X POST "https://api.cloudflare.com/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/purge_cache" \
-H "X-Auth-Email: [email protected]" \
-H "X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41" \
-H "Content-Type: application/json" \
--data '{"files":["http://www.example.com/css/styles.css",{"url":"http://www.example.com/cat_picture.jpg","headers":{"Origin":"https://www.cloudflare.com","CF-IPCountry":"US","CF-Device-Type":"desktop"}}]}
What is “files” vs “url” in this?
The file URL is http://www.example.com/css/styles.css, so whats the url field of http://www.example.com/cat_picture.jpg
So confusing.
First I tried to purge a particular resource as follows:
{
"files":["<some cached URL here>"
]
}
This returned success:true, but there was still a cache HIT. So this actually didnt work.
Next I tried with:
{
"files":["<some cached URL here>",
{
"headers": {
"Origin": "https://www<domain>"
}
}
]
}
This gave an error: “message”: “Request must contain one of "purge_everything", "files", "tags", "hosts" or "prefixes"”
Finally I tried with:
{
"files":["<some cached URL here>",
{
"url": "<some cached URL here>",
"headers": {
"Origin": "https://www<domain>"
}
}
]
}
This returned success:true, and resulted in a cache MISS (yah!).
So the Q is, whats the difference between files and url?