Cache is not clearing, receiving a blank response from Cloudflare API when using API Token credentials to purge all files from a zone.
-
Created an API Token granting Zone.Cache Purge
-
Submit a CURL request (XXXXXXX represents API Token ID, ZZZZZZZZZ represents valid Zone ID):
curl -X POST “https://api.cloudflare.com/client/v4/zones/ZZZZZZZZZ/purge_cache” -H “Authorization: Bearer XXXXXXX” -H “Content-Type:application/json” --data ‘{“purge_everything”:true}’
This returns nothing.
- However, if we were to change the zone ID to an incorrect zone, we receive back a typical response:
{“success”:false,“errors”:[{“code”:7003,“message”:“Could not route to /zones/ZZZZZZZZZZ/purge_cache, perhaps your object identifier is invalid?”},{“code”:7000,“message”:“No route for that URI”}],“messages”:,“result”:null}
- According to the API reference (Cloudflare API v4 Documentation), permissions need are “#zone:edit” – I have added Zone.Zone (edit) to the API Token permissions, but still the same “blank” result.
Seems to me that the “blank” response indicates an issue with the Cloudflare response.