Windows Curl not working purge_everything.,

Hello, I am facing the following problem, I do not know what to do to fix it, is like the CURL is not working

I am in the CMD in Windows

curl -X POST “https://api.cloudflare.com/client/v4/zones/1ca749b7b63e3bceb5afb50967e32a08/purge_cache” -H “X-Auth-Email: [email protected]” -H “Content-Type: application/json” -H “X-Auth-Key: 12345678910XXX777999KEY” --data ‘{“purge_everything”:true}’

{
“result”: null,
“success”: false,
“errors”: [
{
“code”: 1012,
“message”: “Request must contain one of “purge_everything”, “files”, “tags”, “hosts” or “prefixes””
}
],
“messages”:
}

Thanks for the help.

On windows I’m pretty sure single quote strings don’t work. So you need to do --data "{\"purge_everything\": true}"

I use a DELETE request:

So much for that. API docs say it’s a POST. Granted, my script is quite old and I have’t used it in a while. Could it be you’re sending smart quotes?

curl -X DELETE "https://api.cloudflare.com/client/v4/zones/ZONE_ID/purge_cache" \
-H "X-Auth-Email: EMAIL" \
-H "X-Auth-Key: AUTH_KEY" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'

I tried with this and is not working.

[email protected] MINGW64 ~/Desktop
$ curl -X POST "https://api.cloudflare.com/client/v4/zones/1ca749b7b63e3bceb5afb50967e32a08/purge_cache" -H "X-Auth-Email: [email protected]" -H "Content-Type: application/json" -H "X-Auth-Key: 345345" --data '{\"purge_everything\":true}'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   253    0   226  100    27    635     75 --:--:-- --:--:-- --:--:--   720{
  "result": null,
  "success": false,
  "errors": [
    {
      "code": 1012,
      "message": "Request must contain one of \"purge_everything\", \"files\", \"tags\", \"hosts\" or \"prefixes\""
    }
  ],
  "messages": []
}

I changed my DELETE to a POST, then updated my EMAIL and AUTH_KEY (they’ve both changed since I wrote the script), and the command works as written. No escaping the quotes.

[email protected] bin % ./clearcache.command 
{
  "result": {
    "id": "ID_STRING"
  },
  "success": true,
  "errors": [],
  "messages": []
}

Finally! :grinning:
--data '{\"purge_everything\":true}'
On Windows 10 with Windows Terminal 1.14.1861.0

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.