Real-Time Purge

Edit on GitHub

If you need to delete an object from the Azion cache before it expires, you can use the Real-Time Purge API. If you like, you can integrate your Azion API with your CMS to automate your content update processes.

Have a look at how to do the following:

  1. Create a request for a URL Purge
  2. Create a request for a Cache Key Purge
  3. Create a request for a Wildcard Purge

1. Create a request for a URL Purge

To delete a list of objects from your Azion Cache, using your URLs, you can use the endpoint:

POST /purge/url

Permission necessary: Purge

Parameter Description Type of Parameter Type of Data
Authorization (mandatory) Authentication through the Token, previously created through the endpoint of Token Creation.

e.g.:

Authorization: Token
583f8a9ca8d6d5ff2cb50f1d3c4d35cb8939f1bf
header string
Content-Type (mandatory) The type of coding used in the Body (application/json).

e.g.:

Content-Type: application/json
header string
Body (mandatory) List of URLs you want to remove from your Azion Edge Servers cache.

urls (array): a list of up to 50 URLs that will be removed from the cache, per request.

method (choice): purging method, use the value “delete” to remove.
body json

Example Request

POST /purge/url
Accept: application/json; version=1
Authorization: Token 583f8a9ca8d6d5ff2cb50f1d3c4d35cb8939f1bf
Content-Type: application/json
{
    "urls": [
       "http://www.domain.com/", 
       "http://www.domain.com/test.js", 
       "http://static.mistaken-domain.com/image1.jpg"
    ],
    "method": "delete"
}

Example Response

HTTP/1.1 207 MULTI-STATUS
[
   {
      "status": "HTTP/1.1 201 CREATED",
      "urls": [
         "http://www.domain.com/", 
         "http://www.domain.com/test.js"
      ],
      "details": "Purge request successfully created"
   },
   {
      "status": "HTTP/1.1 403 FORBIDDEN",
      "urls": ["http://static.mistaken-domain.com/image1.jpg"],
      "details": "Unauthorized domain for your account"
   }
]

2. Create a request for a Cache Key Purge

To delete a list of objects from your Azion Cache, using your Cache Keys, you can use the endpoint:

POST /purge/cachekey

Permission necessary: Purge

Parameter Description Type of Parameter Type of Data
Authorization (mandatory) Authentication through the Token, previously created through the endpoint of Token Creation.

e.g.:

Authorization: Token
583f8a9ca8d6d5ff2cb50f1d3c4d35cb8939f1bf
header string
Content-Type (mandatory) The type of coding used in the Body (application/json).

e.g.:

Content-Type: application/json
header string
Body (mandatory) List of Cache Keys you want to remove from your Azion Edge Servers cache.

urls (array): a list of up to 50 Cache Keys that will be removed from the cache, per request.

method (choice): purging method, use the value “delete” to remove.
body json

Example Request

POST /purge/cachekey
Accept: application/json; version=1
Authorization: Token 583f8a9ca8d6d5ff2cb50f1d3c4d35cb8939f1bf
Content-Type: application/json
{
    "urls": [
       "http://www.domain.com/@@cookie_name=cookie_value", 
       "http://www.domain.com/test.js", 
       "http://static.domain.com/image1.jpg?ims=arguments@@variants"
    ],
    "method": "delete"
}

Example Response

HTTP/1.1 201 CREATED
{
    "details": "Purge request successfully created"
}

3. Create a request for a Wildcard Purge

To delete a list of objects from your Azion Cache, using a Wildcard URL or Wildcard Cache Key, you can use the endpoint:

POST /purge/wildcard

Permission necessary: Purge

Parameter Description Type of Parameter Type of Data
Authorization (mandatory) Authentication through the Token, previously created through the endpoint of Token Creation.

e.g.:

Authorization: Token
583f8a9ca8d6d5ff2cb50f1d3c4d35cb8939f1bf
header string
Content-Type (mandatory) The type of coding used in the Body (application/json).

e.g.:

Content-Type: application/json
header string
Body (mandatory) The Wildcard expression that represents the list of objects you want to remove from your Azion Edge Servers cache.

urls (array): the Wildcard URL or Wildcard Cache Key that represents the list of objects that you want to remove. You can only use one Wildcard expression per request.

method (choice): purging method, use the value “delete” to remove.
body json

Example Request

POST /purge/wildcard
Accept: application/json; version=1
Authorization: Token 583f8a9ca8d6d5ff2cb50f1d3c4d35cb8939f1bf
Content-Type: application/json
{
    "urls": ["http://www.domain.com/path/image.jpg*"],
    "method": "delete"
}

Example Response

HTTP/1.1 201 CREATED
{
    "detail": "Purge request successfully created"
}

Didn’t find what you were looking for? Open a ticket.