CacheFly offers an API for purging objects cached by our reverse proxy service.
You can view and generate your API key from within the customer portal here.
How it Works
Grab your key from your account's portal in Account Settings -> API Key. This key can be thought of as a username when interfacing with the API.
An example of an API key will look like;
The purge call is a HTTP POST request made to https://api.cachefly.com/1.0/purge.purge.file.
This POST will contain a comma separated list of base64 encoded paths to purge.
An example post can be issued by the following command;
curl --data files=L2ltZy90ZXN0LnBuZw==,L2ltYWdlcy9sb2dvLmpwZw== https://email@example.com/1.0/purge.purge.file
Taking another look at the above command can be simplified by;
[post issuing program] [base64 file path] [https://API-KEY @ API-URL]
In this example, L2ltZy90ZXN0LnBuZw== is the base64 of /img/test.png as L2ltYWdlcy9sb2dvLmpwZw== is the base64 of /images/logo.jpg.
The end result being /img/test.png and /images/logo.jpg being purged from the CDN.
Once the POST has been accepted by the API, an XML response is returned with either an OK status or an error message.
Purge All Content
CacheFly's purge API also allows you to purge all cached objects in one single call. This can be accomplished by issuing a argument-less GET request to purge.purge.all. An example of a GET request that would purge all objects looks like the following.
Note: If you have a large amount of objects you may want to reconsider using the purge all feature.