Purging Content Tutorial

The purpose of this tutorial is to demonstrate how to purge content through the Purge Content endpoint.

Step 1: Copy a Token

Almost all requests to our REST API services require authorization. Authorization is granted by passing a REST API token via the Authorization request header using the following syntax:

TOK: REST-API-Token

Learn more.

Copy your REST API token from the Web Service REST API Token section of the My Settings page.

If the Web Service REST API Token section is not present on the My Settings page, then you are not authorized to access our REST API services. Please contact your CDN administrator to gain access.

Step 2: Choose a Purge URL

Identify the CDN or edge CNAME URL that will be purged.

Forward slashes must be escaped with a backslash when submitting purge requests in JSON.

Sample Purge URL (Individual File):

The following sample edge CNAME URL may be used to purge an asset called "brochure.pdf."

http://cdn.example.com/marketing/brochure.pdf

The JSON equivalent of the above URL is provided below.

http:\/\/cdn.example.com\/marketing\/brochure.pdf

Sample Purge URL (Recursive):

The following sample edge CNAME URL may be used to recursively purge a folder called "marketing."

http://cdn.example.com/marketing/*

The JSON equivalent of the above URL is provided below.

http:\/\/cdn.example.com\/marketing\/*

Step 3: Submit a curl Request

Submit the following curl request:

curl -sk -X PUT -H "Authorization: TOK:12345678-1234-1234-1234-1234567890ab" -H "Content-Type: application/json" -H "Accept: application/json" -d "{ \"MediaPath\":\"http:\/\/can.0001.transactcdn.com\/000001\/folder1\/file.htm\", \"MediaType\":14}" "https://api.transactcdn.com/v2/mcc/customers/0001/edge/purge"

Make sure to replace the highlighted text with the appropriate values.

More Information