Purge_cache issue - error 1012 || failed to open

Using the API and I am having some issues and its driving me nuts.

If I try purge cache with --data i get error 1012 (either purge everythign or array of files).
curl -X POST “https://api.cloudflare.com/client/v4/zones/MYZONEID/purge_cache” -H “X-Auth-Email: MYEMAIL” -H “X-Auth-Key: MYAUTHKEY” -H “Content-Type: application/json” --data ‘{“purge_everything”:true}’

Getting error 1012 - “Request must contain one of “purge_everything”, “files”, “tags”, “hosts” or “prefixes””

changing to -D i get different error Warning failed to open/
curl -X POST “https://api.cloudflare.com/client/v4/zones/MYZONEID/purge_cache” -H “X-Auth-Email: MYEMAIL” -H “X-Auth-Key: MYAUTHID” -H “Content-Type: application/json” -D ‘{“files”:[“MYFILE”,“MYFILE”]}’

Getting error - Warning: Failed to open Warning: '{files:[

Trying to get this to work as my app (which used to work) is now getting error 400 bad request, starting point was to check the curl request are working but am getting the above errors.

Thanks in advance

It’s possible your quotes have turned into smart quotes. Can you post a screenshot of the actual purge_everything command? And block out the sensitive data.

As @sdayman said, there appear to be some formatting issues with your command, so please take a screenshot. In particular, your quotes and apostrophes are being turned into “smart” quotes, which won’t work with the command line. That might just be Discourse auto-formatting your input, though–we have no way of telling without a screenshot or the use of code blocks (```).

You would need to use -d, not -D. -d and --data are the exact same thing, though. The part that matters is what comes after it–which appears to have smart quotes.


my syntax is (for windows):

curl -X POST “https://api.cloudflare.com/client/v4/zones/ZONE_ID/purge_cache” ^
-H “X-Auth-Email: [email protected]” ^
-H “X-Auth-Key: API_KEY” ^
-H “Content-Type: application/json”
–data ‘{“files”:[“http://www.example.com/css/styles.css”]}’

and I’m getting same error.