The CDN API is a RESTful Endpoint that grants you full control over every aspect of your CDN Zones. This includes purging, hostname management, and stat retrieval, all in JSON format.
Table of Contents
List CDN Zones
Returns a list of all CDN Zones for your account.
GET | https://cachegenie.com/api/cdn
Response Parameters
- CODE (Integer): Represents the status code of the API response.
- MESSAGE (String): A description detailing the result or status of the API request.
- DATA (Object): Contains the data returned by the API request.
- CDN_ZONES (Array): Contains a list of CDN zones for the account.
View CDN Zone
Returns a CDN Zone, as defined by the ZONE_ID path parameter.
GET | https://cachegenie.com/api/cdn/{ZONE_ID}
Response Parameters
- CODE (Integer): Represents the status code of the API response.
- MESSAGE (String): A description detailing the result or status of the API request.
- DATA (Object): Contains the data returned by the API request.
- ID (String): Unique identifier for the CDN zone.
- ZONE_NAME (String): Name assigned to the CDN zone.
- ORIGIN_URL (String): The URL from which the CDN Zone will fetch files.
- HOST_HEADER (String): The Host HTTP Header that will be sent to the origin, if specified.
- CACHE_EXP (String): Cache expiration time in seconds (See Valid Inputs).
- VERIFY_ORIGIN_SSL (Integer): Indicates whether SSL verification is enabled for the origin (1 or 0).
- ADD_HOST_HEADER (Integer): Indicates whether to add the original host header to requests (1 or 0).
- FOLLOW_REDIRECTS (Integer): Indicates whether we should follow redirects returned by the origin (1 or 0).
- OPTIMIZE_VIDEO (Integer): Indicates whether Optimize for Video Delivery is enabled (1 or 0).
- STRIP_COOKIES (Integer): Indicates whether to strip cookies from requests (1 or 0).
- BLOCK_ROOT (Integer): Indicates whether root access is blocked (1 or 0).
- BLOCK_POST (Integer): Indicates whether POST requests are blocked (1 or 0).
- ADD_CANONICAL_HEADER (Integer): Specifies if a canonical link header is added to responses (1 or 0).
- ADD_CORS_HEADER (Integer): Indicates whether to add CORS headers to responses (1 or 0).
- MONTHLY_BANDWIDTH_LIMIT (String): Monthly Limit of Bandwidth in GB (0 for unlimited).
- TIMESTAMP (String): Unix timestamp indicating when the CDN zone was created.
Create CDN Zone
Create a new CDN Zone with the specified request parameters on your account.
POST | https://cachegenie.com/api/cdn
Request Parameters
- ZONE_NAME (String, required): Name assigned to the CDN zone.
- ORIGIN_URL (String, required): The URL from which the CDN Zone will fetch files.
- HOST_HEADER (String, optional): The Host HTTP Header that will be sent to the origin, if specified.
- CACHE_EXP (String, optional): Cache expiration time in seconds (See Valid Inputs).
- VERIFY_ORIGIN_SSL (Integer, optional): Indicates whether SSL verification is enabled for the origin (1 or 0).
- ADD_HOST_HEADER (Integer, optional): Indicates whether to add the original host header to requests (1 or 0).
- FOLLOW_REDIRECTS (Integer, optional): Indicates whether we should follow redirects returned by the origin (1 or 0).
- OPTIMIZE_VIDEO (Integer, optional): Indicates whether Optimize for Video Delivery is enabled (1 or 0).
- STRIP_COOKIES (Integer, optional): Indicates whether to strip cookies from requests (1 or 0).
- BLOCK_ROOT (Integer, optional): Indicates whether root access is blocked (1 or 0).
- BLOCK_POST (Integer, optional): Indicates whether POST requests are blocked (1 or 0).
- ADD_CANONICAL_HEADER (Integer, optional): Specifies if a canonical link header is added to responses (1 or 0).
- ADD_CORS_HEADER (Integer, optional): Indicates whether to add CORS headers to responses (1 or 0).
- MONTHLY_BANDWIDTH_LIMIT (String, optional): Monthly Limit of Bandwidth in GB (0 for unlimited).
Response Parameters
- CODE (Integer): Represents the status code of the API response.
- MESSAGE (String): A description detailing the result or status of the API request.
- DATA (Object): Contains the data returned by the API request.
Update CDN Zone
Update a CDN Zone, with the specified request parameters, as defined by the ZONE_ID path parameter.
POST | https://cachegenie.com/api/cdn/{ZONE_ID}
Request Parameters
- ORIGIN_URL (String, optional): The URL from which the CDN Zone will fetch files.
- HOST_HEADER (String, optional): The Host HTTP Header that will be sent to the origin, if specified.
- CACHE_EXP (String, optional): Cache expiration time in seconds (See Valid Inputs).
- VERIFY_ORIGIN_SSL (Integer, optional): Indicates whether SSL verification is enabled for the origin (1 or 0).
- ADD_HOST_HEADER (Integer, optional): Indicates whether to add the original host header to requests (1 or 0).
- FOLLOW_REDIRECTS (Integer, optional): Indicates whether we should follow redirects returned by the origin (1 or 0).
- OPTIMIZE_VIDEO (Integer, optional): Indicates whether Optimize for Video Delivery is enabled (1 or 0).
- STRIP_COOKIES (Integer, optional): Indicates whether to strip cookies from requests (1 or 0).
- BLOCK_ROOT (Integer, optional): Indicates whether root access is blocked (1 or 0).
- BLOCK_POST (Integer, optional): Indicates whether POST requests are blocked (1 or 0).
- ADD_CANONICAL_HEADER (Integer, optional): Specifies if a canonical link header is added to responses (1 or 0).
- ADD_CORS_HEADER (Integer, optional): Indicates whether to add CORS headers to responses (1 or 0).
- MONTHLY_BANDWIDTH_LIMIT (String, optional): Monthly Limit of Bandwidth in GB (0 for unlimited).
Response Parameters
- CODE (Integer): Represents the status code of the API response.
- MESSAGE (String): A description detailing the result or status of the API request.
- DATA (Object): Contains the data returned by the API request.
Delete CDN Zone
Delete a CDN Zone, as defined by the ZONE_ID path parameter.
DELETE | https://cachegenie.com/api/cdn/{ZONE_ID}
Response Parameters
- CODE (Integer): Represents the status code of the API response.
- MESSAGE (String): A description detailing the result or status of the API request.
- DATA (Object): Empty response data.
Purge CDN Zone (Full or URL)
Purge a CDN Zone, If the PURGE_URL request parameter is set, only the specified URL will be purged, if not set, the entire CDN Zone will be purged, as defined by the ZONE_ID path parameter.
POST | https://cachegenie.com/api/cdn/{ZONE_ID}/purge
Request Parameters
-
PURGE_URL (String, optional): The URL that you want to purge (e.g. "https://cdn.example.com/image.png").
Response Parameters
- CODE (Integer): Represents the status code of the API response.
- MESSAGE (String): A description detailing the result or status of the API request.
- DATA (Object): Empty response data.
CDN Zone Statistics
Get statistics for the requested CDN Zone, as defined by the ZONE_ID path parameter. You can specify FROM_TIMESTAMP for the start date, and TO_TIMESTAMP for the end date, in the request body. If no start date is set, stats will be returned starting 28 days from the date the request is made.
GET | https://cachegenie.com/api/cdn/{ZONE_ID}/stats
Request Parameters
- FROM_TIMESTAMP (String, optional): The timestamp that you want the statistics to start from.
- TO_TIMESTAMP (String, optional): The timestamp that you want the statistics to end on.
Response Parameters
- CODE (Integer): Represents the status code of the API response.
- MESSAGE (String): A description detailing the result or status of the API request.
- DATA (Object): Contains the data returned by the API request.
- CDN_DAILY_STATS (Array): Contains a list of daily statistics for the CDN zone.
- DAY_TIMESTAMP (String): Unix timestamp indicating the specific day for the statistics.
- CACHE_HITS (String): Number of cache hits
- CACHE_MISS (String): Number of cache misses.
- BANDWIDTH_BYTES (String): Total bandwidth used, measured in bytes.
List CDN Zone Hostnames
Returns a list of all CDN Hostnames for the given CDN Zone, as defined by the ZONE_ID path parameter.
GET | https://cachegenie.com/api/cdn/{ZONE_ID}/hostnames
Response Parameters
- CODE (Integer): Represents the status code of the API response.
- MESSAGE (String): A description detailing the result or status of the API request.
- DATA (Object): Contains the data returned by the API request.
- CDN_HOSTNAMES (Array): Contains a list of CDN Hostnames for the given CDN Zone.
View CDN Zone Hostname
Returns a CDN Hostname, as defined by the HOSTNAME_ID path parameter, for the given CDN Zone, as defined by the ZONE_ID path parameter.
GET | https://cachegenie.com/api/cdn/{ZONE_ID}/hostnames/{HOSTNAME_ID}
Response Parameters
- CODE (Integer): Represents the status code of the API response.
- MESSAGE (String): A description detailing the result or status of the API request.
- DATA (Object): Contains the data returned by the API request.
- ID (String): Unique identifier for the CDN Hostname.
- HOSTNAME (String): The domain name for this CDN Hostname.
- SSL_ENABLED (Integer): Indicates if SSL is enabled for the hostname (1 or 0).
- FORCE_SSL (Integer): Indicates if SSL is enforced for the hostname (1 or 0).
- DEFAULT (Integer): Indicates if this hostname is the default (1 or 0).
- TIMESTAMP (String): Unix timestamp indicating when this CDN Hostname was created.
Create CDN Zone Hostname
Create a new CDN Zone Hostname, with the specified request parameters, for the given CDN Zone, as defined by the ZONE_ID path parameter.
POST | https://cachegenie.com/api/cdn/{ZONE_ID}/hostnames
Request Parameters
- HOSTNAME (String, required): The domain name for this CDN Hostname.
Response Parameters
- CODE (Integer): Represents the status code of the API response.
- MESSAGE (String): A description detailing the result or status of the API request.
- DATA (Object): Contains the data returned by the API request.
Update CDN Zone Hostname
Update a CDN Zone Hostname, as defined by the HOSTNAME_ID path parameter, with the specified request parameters, for the given CDN Zone, as defined by the ZONE_ID path parameter.
POST | https://cachegenie.com/api/cdn/{ZONE_ID}/hostnames/{HOSTNAME_ID}
Request Parameters
- SSL_ENABLED (Integer, optional): Indicates if SSL is enabled for the hostname (1 or 0).
- FORCE_SSL (Integer, optional): Indicates if SSL is enforced for the hostname (1 or 0).
Response Parameters
- CODE (Integer): Represents the status code of the API response.
- MESSAGE (String): A description detailing the result or status of the API request.
- DATA (Object): Contains the data returned by the API request.
Delete CDN Zone Hostname
Delete a CDN Hostname, as defined by the HOSTNAME_ID path parameter, for the given CDN Zone, as defined by the ZONE_ID path parameter.
DELETE | https://cachegenie.com/api/cdn/{ZONE_ID}/hostnames/{HOSTNAME_ID}
Response Parameters
- CODE (Integer): Represents the status code of the API response.
- MESSAGE (String): A description detailing the result or status of the API request.
- DATA (Object): Empty response data.