Hey guys, I was hoping someone could help point me in the direction.
I’m trying to purge everything in a cache and I’ve spent hours trying to form a request but keep running into the same “request must contain one of purge_everything, files, tags, hosts, prefixes” error response.
I’ve googled and read dozens of different pages on the same problem but most of them are using cURL.
I can tell the “purge_everything”: “true” is being attached as a body but it doesn’t seem to work for me.
I’m using NodeJS and cannot figure out what the name of the body field should be for “purge_everything”.
I’ve tried setting a field as “body” and then “forms”, setting the “Content-Type: x-www-encoded-forms” and then “Content-Type: application/json”. I’ve tried all sorts of weird combos of random guessing in the hopes of making this work.
There was a random post on StackOverflow where someone else said “change the field name to JSON” ??? but absolutely nothing works.
Can someone tell me what I’m doing wrong?
This is what my https request options look like:
const options = {
host: “api.cloudflare.com”,
port: 443,
path: “/client/v4/zones/ZONE_ID/purge_cache”,
method: “POST”,
headers: {
“X-Auth-Email” : “[email protected]”,
“X-Auth-Key” : “AUTH_KEY_ID”,
“Content-Type”: “application/json”
},
json: {
“purge_everything”: “true”
}
}