CDN
The CDN API lets your server clear and purge cached content on the Ezoic CDN. Its endpoints live under /cdnservices/.
See API for how to enable the service, your base URL, and authentication. Every request takes your developerKey.
Every endpoint returns the same response shape:
{"Success":true,"Error":""}
Ping
Verify the server is responding.
curl -X POST "https://api-gateway.ezoic.com/cdnservices/ping/?developerKey=YOUR_API_KEY"import requests
url = "https://api-gateway.ezoic.com/cdnservices/ping/?developerKey=YOUR_API_KEY"
response = requests.post(url)
print(response.json())<?php
$ch = curl_init("https://api-gateway.ezoic.com/cdnservices/ping/?developerKey=YOUR_API_KEY");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$response = curl_exec($ch);
curl_close($ch);
echo $response;Clear Cache
Clear the cache for a single URL in all regions.
curl -X POST "https://api-gateway.ezoic.com/cdnservices/clearcache?developerKey=YOUR_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"url": "https://www.example.com/"
}'import requests
url = "https://api-gateway.ezoic.com/cdnservices/clearcache?developerKey=YOUR_API_KEY"
headers = {"Content-Type": "application/json"}
payload = """{
"url": "https://www.example.com/"
}"""
response = requests.post(url, headers=headers, data=payload)
print(response.json())<?php
$ch = curl_init("https://api-gateway.ezoic.com/cdnservices/clearcache?developerKey=YOUR_API_KEY");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
"url": "https://www.example.com/"
}');
$response = curl_exec($ch);
curl_close($ch);
echo $response;| Field | Type | Description | Required |
|---|---|---|---|
url |
string | The URL whose cache to clear | required |
Bulk Clear Cache
Clear the cache for an array of URLs, in batches of 100.
curl -X POST "https://api-gateway.ezoic.com/cdnservices/bulkclearcache?developerKey=YOUR_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"urls": [
"https://www.example.com/",
"https://www.example.com/page1",
"https://www.example.com/page2"
]
}'import requests
url = "https://api-gateway.ezoic.com/cdnservices/bulkclearcache?developerKey=YOUR_API_KEY"
headers = {"Content-Type": "application/json"}
payload = """{
"urls": [
"https://www.example.com/",
"https://www.example.com/page1",
"https://www.example.com/page2"
]
}"""
response = requests.post(url, headers=headers, data=payload)
print(response.json())<?php
$ch = curl_init("https://api-gateway.ezoic.com/cdnservices/bulkclearcache?developerKey=YOUR_API_KEY");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
"urls": [
"https://www.example.com/",
"https://www.example.com/page1",
"https://www.example.com/page2"
]
}');
$response = curl_exec($ch);
curl_close($ch);
echo $response;| Field | Type | Description | Required |
|---|---|---|---|
urls |
list<string> | The URLs whose cache to clear | required |
Clear by Surrogate Keys
Clear the cache for a comma-separated list of surrogate keys.
For domain, do not include a subdomain (such as www.), a scheme (such as http:// or https://), or a path (such as /).
curl -X POST "https://api-gateway.ezoic.com/cdnservices/clearbysurrogatekeys?developerKey=YOUR_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"keys": "key1,key2,keyC",
"domain": "example.com"
}'import requests
url = "https://api-gateway.ezoic.com/cdnservices/clearbysurrogatekeys?developerKey=YOUR_API_KEY"
headers = {"Content-Type": "application/json"}
payload = """{
"keys": "key1,key2,keyC",
"domain": "example.com"
}"""
response = requests.post(url, headers=headers, data=payload)
print(response.json())<?php
$ch = curl_init("https://api-gateway.ezoic.com/cdnservices/clearbysurrogatekeys?developerKey=YOUR_API_KEY");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
"keys": "key1,key2,keyC",
"domain": "example.com"
}');
$response = curl_exec($ch);
curl_close($ch);
echo $response;| Field | Type | Description | Required |
|---|---|---|---|
keys |
string | Comma-separated surrogate keys | required |
domain |
string | The bare domain, without subdomain, scheme, or path | required |
Purge Cache
Purge the entire CDN cache for a domain.
For domain, do not include a subdomain (such as www.), a scheme (such as http:// or https://), or a path (such as /).
curl -X POST "https://api-gateway.ezoic.com/cdnservices/purgecache?developerKey=YOUR_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"domain": "example.com"
}'import requests
url = "https://api-gateway.ezoic.com/cdnservices/purgecache?developerKey=YOUR_API_KEY"
headers = {"Content-Type": "application/json"}
payload = """{
"domain": "example.com"
}"""
response = requests.post(url, headers=headers, data=payload)
print(response.json())<?php
$ch = curl_init("https://api-gateway.ezoic.com/cdnservices/purgecache?developerKey=YOUR_API_KEY");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
"domain": "example.com"
}');
$response = curl_exec($ch);
curl_close($ch);
echo $response;| Field | Type | Description | Required |
|---|---|---|---|
domain |
string | The bare domain, without subdomain, scheme, or path | required |