Problem clearing cache from Curl

Hi,

About 5 days ago this was all working fine, its been working fine for the past few months, then a few days ago it stopped working:

Clearing cache using CURL

"curl -X POST “https://api.cloudflare.com/client/v4/zones/editedzoneout/purge_cache” \ -H “X-Auth-Email: editedemailout” \ -H “X-Auth-Key: ediedauthkeyout” \ -H “Content-Type: application/json” \ --data ‘{“purge_everything”:true}’" completed with error in 0 seconds, output:

{“success”:false,“errors”:[{“code”:9106,“message”:“Missing X-Auth-Key, X-Auth-Email or Authorization headers”}]}

Error 411 (Length Required)!!1 *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}

411. That’s an error.

POST requests require a Content-length header. That’s all we know.

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
100 113 0 113 0 0 896 0 --:–:-- --:–:-- --:–:-- 896
curl: (3) URL using bad/illegal format or missing URL
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
100 1564 100 1564 0 0 169k 0 --:–:-- --:–:-- --:–:-- 169k
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL

I just tested mine and it still works:

[email protected] ~ % curl -X POST "https://api.cloudflare.com/client/v4/zones/MY_ZONE/purge_cache" -H "X-Auth-Email: MY_EMAIL" -H "X-Auth-Key: MY_KEY" -H "Content-Type: application/json" --data '{"purge_everything":true}'
{
  "result": {
    "id": "RETURN_ID"
  },
  "success": true,
  "errors": [],
  "messages": []
}

You’ll notice that my curl command doesn’t have smart quotes, while yours appears to have them. That’s what usually messes mine up.

2 Likes

Thank you, that worked, but i believe it was the \ never the less, i copied what you wrote and put my details in and it worked. thank you!

That was very kind of you to give the solution saved me a lot of headache. thank you very much.

1 Like

You’re very welcome.

The \ is just to break up the lines, and Terminals are usually ok with that.

1 Like

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