Site API

The Site API can be used to create, read and delete accelerated web sites.

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: POST
URL: 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:
Example Call #1:
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: GET
URL: 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:
GET /api/users/mcdnuser/site/metacdn HTTP/1.1
Accept: application/json
Expected Response #1:
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:
HTTP Operation: GET
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:
GET /api/users/mcdnuser/site HTTP/1.1
Accept: application/json
Expected Response #3:
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:PUT
URL: 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:
Example Call #1:
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: DELETE
URL: 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:
DELETE /api/users/mcdnuser/site/testsite HTTP/1.1
Expected Response #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:POST
URL: 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:
Example Call #1:
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