The Site API can also be used to create invalidation objects, which force CDN cached files to be refreshed from the origin website.
Create (register) site
HTTP Operation: POSTURL: POST https://secure.metacdn.com/api/users/{username}/site
Auth: HTTP digest authentication (User)
"Content-Type" header: application/json
Expected HTTP response: HTTP/1.1 201 Created
Expected Format (mandatory, optional):
POST /api/users/{username}/site HTTP/1.1
Content-Type: application/json {
"name": "",
"domain": ""
"description": ""
"cnames": ["", ..., ""]
}
Notes:- "name" is the site's identifier and will be used to generate the accelerated domain name.
- "domain" is the origin domain name of your site without any protocol (http:// or https://) and without any path (/index.html)
- You can have up to 5 CNAMEs for a site, please contact us if you need more than 5.
- You will get an error if you have reached your plan's allocated quota.
POST /api/users/mcdnuser/site HTTP/1.1
Content-Type: application/json {
"name": "metacdn",
"domain": "www.metacdn.com"
"description": "Site acceleration for MetaCDN.com",
"cnames": ["cdn.metacdn.com","cdn-2.metacdn.com"]
}
Expected Response #1:HTTP/1.1 201 Created Content-Type: text/plain; charset=UTF-8 Content-Length: 12 Accept-Ranges: bytes Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept Date: Tue, 24 Jul 2012 06:41:23 GMT Server: Restlet-Framework/2.0.13 Connection: close Site created
Get site
HTTP Operation: GETURL: GET https://secure.metacdn.com/api/users/{username}/site/{siteName}
Auth: HTTP digest authentication (User)
"Accept" header: application/json
Expected HTTP response: HTTP/1.1 200 OK
Expected Format (mandatory, optional):
GET /api/users/{username}/site/{siteName} HTTP/1.1
Accept: application/json
Example Call #1:Expected Response #1:GET /api/users/mcdnuser/site/metacdn HTTP/1.1 Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Accept-Ranges: bytes
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Date: Tue, 24 Jul 2012 06:43:33 GMT
Server: Restlet-Framework/2.0.8
Content-Length: 197
Cache-Control: private, x-gzip-ok=""
Connection: close {
"name": "sitetest2",
"description": "Site acceleration for MetaCDN.com",
"username": "mcdnuser",
"siteStatus": "READY",
"originUrl": "www.metacdn.com",
"useSSL": true,
"cnames": [{
"cname": "cdn.metacdn.com",
"active": "true",
"disableTimestamp": null
}, {
"cname": "cdn-2.metacdn.com",
"active": "true",
"disableTimestamp": null
}
]}
Notes:- "siteStatus" can be in the following states: PENDING, PROVISIONING, READY, DELETING, CANCELLED, UPDATING, ERROR
- Secure shared SSL will be supported when "useSSL" is enabled.
URL: GET https://secure.metacdn.com/api/users/{username}/site
Auth: HTTP digest authentication (User)
"Accept" header: application/json
Expected HTTP response: HTTP/1.1 200 OK
Expected Format (mandatory, optional):
GET /api/users/{username}/site HTTP/1.1
Accept: application/json
Example Call #3:Expected Response #3:GET /api/users/mcdnuser/site HTTP/1.1 Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Accept-Ranges: bytes
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Date: Tue, 24 Jul 2012 06:54:18 GMT
Server: Restlet-Framework/2.0.13
Content-Length: 383
Cache-Control: private, x-gzip-ok=""
Connection: close {
"sites": [{
"name": "metacdn",
"description": "Site acceleration for MetaCDN.com",
"username": "mcdnuser",
"siteStatus": "READY",
"originUrl": "www.metacdn.com",
"useSSL": true,
"cnames": [{
"cname": "cdn.metacdn.com",
"active": "true",
"disableTimestamp": null
}, {
"cname": "cdn-2.metacdn.com",
"active": "true",
"disableTimestamp": null
}]
}, {
"name": "sitetest",
"description": "Site acceleration for test.com",
"username": "mcdnuser",
"siteStatus": "READY",
"originUrl": "www.test.com",
"useSSL": false,
"cnames": []
}]
}
Update site
HTTP Operation:PUTURL: PUT https://secure.metacdn.com/api/users/{username}/site/{siteName}
Auth: HTTP digest authentication (User)
"Content-Type" header: application/json
Expected HTTP response: HTTP/1.1 202 Accepted
Expected Format (mandatory, optional):
PUT /api/users/{username}/site/{siteName} HTTP/1.1
Content-Type: application/json {
"description": "",
"useSSL": true/false,
"cnames": ["", "", ..., ""]
}
Notes:- Secure shared SSL will be supported when "useSSL" is enabled.
PUT /api/users/test/site/testSite HTTP/1.1
Accept: application/json {
"description": "This site will enable SSL support",
"useSSL": true,
"cnames": [
"css.test.com",
"js.test.com"
]
}
Expected Response #1:HTTP/1.1 202 Accepted Accept-Ranges: bytes Vary: Accept-Charset, Accept-Encoding, Accept-Language. Accept Date: Mon, 22 Apr 2013 07:11:20 GMT Content-Type: text/html Server: Google Frontend Site update is processing now
Delete site
HTTP Operation: DELETEURL: DELETE https://secure.metacdn.com/api/users/{username}/site/{siteName}
Auth: HTTP digest authentication (User)
Expected HTTP response: HTTP/1.1 202 Updated
Expected Format (mandatory, optional):
DELETE /api/users/{username}/site/{siteName} HTTP/1.1
Example Call #1:Expected Response #1:DELETE /api/users/mcdnuser/site/testsite HTTP/1.1
HTTP/1.1 202 Accepted Content-Type text/plain; charset=UTF-8 Date: Tue, 24 Jul 2012 06:57:28 GMT Accept-Ranges: bytes Server: Restlet-Framework/2.0.13 Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept Content-Length: 25 Connection: close Site scheduled for deletion
Create invalidation object
HTTP Operation:POSTURL: POST https://secure.metacdn.com/api/users/{username}/site/{siteName}/invalidation
Auth: HTTP digest authentication (User)
"Content-Type" header: application/json
Expected HTTP response: HTTP/1.1 201 Created
Expected Format (mandatory, optional):
POST /api/users/{username}/site/{siteName}/invalidation HTTP/1.1
Content-Type: application/json {
"objectPaths": ["", ""]
}
Invalidated objects are removed from MetaCDN caches, and refreshed from your origin site.Notes:
- "objectPaths" is a list of paths to the objects will be invalidated. It should start with "/" without any protocol (http:// or https://)
- You must explicitly invalidate every object and every directory that you want MetaCDN to refresh.
- You cannot use wildcards to invalidate groups of objects, and you cannot invalidate all of the objects in a directory by specifying the directory path.
- Invalidate all cached objects by specifying '*' as the path.
POST /api/users/mcdnuser/site/metacdn/invalidation HTTP/1.1
Content-Type: application/json {
"objectPaths": ["/logo.png", "/index.html"]
}
Expected Response #1:HTTP/1.1 201 Created Content-Type: text/plain; charset=UTF-8 Content-Length: 12 Accept-Ranges: bytes Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept Date: Tue, 24 Jul 2012 07:32:10 GMT Server: Restlet-Framework/2.0.13 Connection: close Invalidation objects created