Content API

The Content API can be used to create, read, update and delete content.

By default MetaCDN stores your content in "CDN" MetaCDN locations, where content is dynamically replicated based on popularity. Alternatively content may be replicated in a number of "core" MetaCDN locations, where your content is guaranteed to be durably and persistently stored based on your preferences, which may suit some special types of deployment.

Create (register) content

HTTP Operation:POST
URL: POST https://secure.metacdn.com/api/users/{username}/content
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}/content HTTP/1.1
Content-Type: application/json {
"originSource": [{
    "originUrl": "",
    "title": "",
    "description": ""
},
...,
{
    "originUrl": "",
    "title": "",             
    "description": ""
}],
    "hostUntil":"DD Mon YYYY HH:MM:SS GMT",
    "tags": ["TAG1", "TAG2", "TAG3", ..., "TAGN"]
}
Notes:
Example Call #1:
POST /api/users/mcdnuser/content HTTP/1.1
Content-Type: application/json {
    "originSource": [{
        "originUrl": "http://localhost:8888/img/icon/google_engine_icon.png",
        "title": "MetaCDN Sample",
        "description": "MetaCDN logo"        
    }],
    "hostUntil": "",
    "tags": ["gif", "speedtest", "image"]
}
Expected Response #1:
HTTP/1.1 201 Created
Content-Type: application/json; charset=UTF-8
Date: Mon, 12 Sep 2011 03:13:36 GMT
Accept-Ranges: bytes
Server: Restlet-Framework/2.0.8
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Content-Length: 187
Connection: close {
    "contentInfo": [{
        "metaCdnDnsUrl": "http://cdn-1.metacdn.net/mcdnuser/google_engine_icon.png",
        "keyName": "HZK3",
        "fileName": "google_engine_icon.png",
        "metaCdnUrl": "http://localhost:8888/r/c/5L4lDoyc/HZK3",
        "metaCdnApiUrl": "http://localhost:8888/api/users/mcdnuser/content/hpYr/HZK3"
    }]
}
Example Call #2:
POST /api/users/mcdnuser/content HTTP/1.1
Content-Type: application/json {
    "originSource": [{
        "originUrl": "http://www.metacdn.com/img/icon/azure_icon.png",
        "title": "Azure Icon",
        "description" :"Azure Logo"
    }],
    "hostUntil":"10 Sep 2012 08:00:25 GMT",
    "tags": ["png", "logo", "image"]
}
Expected Response #2:
HTTP/1.1 201 Created
Content-Type: application/json; charset=UTF-8
Content-Length: 191
Accept-Ranges: bytes
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Date: Mon, 12 Sep 2011 02:54:23 GMT
Server: Restlet-Framework/2.0.8
Connection: close {
    "contentInfo": [{
        "keyName": "Jnjr",
        "fileName": "azure_icon.png",
        "metaCdnUrl": "http://www.metacdn.com/r/c/5L4lDoyc/Jnjr",
        "metaCdnApiUrl": "http://www.metacdn.com/api/users/mcdnuser/content/Jnjr"
    }]
}

Get content

HTTP Operation: GET
URL: GET https://secure.metacdn.com/api/users/{username}/content/{contentkey}
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}/content/{contentkey} HTTP/1.1
Accept: application/json
Example Call #1:
GET /api/users/mcdnuser/content/KULk HTTP/1.1
Accept: application/json
Expected Response #1:
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Date: Mon, 12 Sep 2011 03:30:19 GMT
Accept-Ranges: bytes
Server Restlet-Framework/2.0.8
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Content-Length: 730
Connection: close {
    "contentStatus": "ACTIVE",
    "contentUser": "mcdnuser",
    "createdTime": "12 Sep 2011 03:13:36 GMT",
    "description": "cloudclimate.com CDN speed test",
    "downloadCount": 0,
    "duplicates": true,
    "fileName": "sample.gif",
    "fileSize": 64469,
    "keyName": "KULk",
    "lastUpdateTime": "12 Sep 2011 03:13:36 GMT",
    "locations": ["CDN"],
    "mediaKeyString": "",
    "metaCdnDnsUrl": "http://cdn-1.metacdn.net/mcdnuser/sample.gif",
    "metaCdnUrl": "http://www.metacdn.com/r/c/5L4lDoyc/KULk",
    "originUrl": "http://www.metacdn.org/sample.gif",
    "replicationStatus": "PENDING",
    "tags": [
        "gif",
        "speedtest",
        "image"
    ],
    "title": "MetaCDN Sample"
}
Example Call #2:
GET /api/users/mcdnuser/content/Jnjr HTTP/1.1
Accept: application/json
Expected Response #2:
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Accept-Ranges: bytes
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Date: Mon, 12 Sep 2011 03:39:41 GMT
Server: Restlet-Framework/2.0.8
Content-Length: 821
Cache-Control: private, x-gzip-ok=""
Connection: close {
    "contentStatus": "ACTIVE",
    "contentUser": "mcdnuser",
    "createdTime": "12 Sep 2011 02:54:23 GMT",
    "description": "Azure Logo",
    "downloadCount": 0,
    "duplicates": true,
    "fileName": "azure_icon.png",
    "fileSize": 7366,
    "hostUntil": "10 Sep 2012 08:00:25 GMT",
    "keyName": "Jnjr",
    "lastUpdateTime": "12 Sep 2011 02:54:23 GMT",
    "locations": ["CDN"],
    "mediaKeyString": "",
    "metaCdnUrl": "http://www.metacdn.com/r/c/5L4lDoyc/Jnjr",
    "originUrl": "http://www.metacdn.com/img/icon/azure_icon.png",
    "replicationStatus": "PENDING",
    "tags": [
        "png",
        "logo",
        "image"
    ],
    "title": "Azure Icon"
}
Notes:
HTTP Operation:GET
URL: GET https://secure.metacdn.com/api/users/{username}/content
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}/content HTTP/1.1
Accept: application/json
Example Call #3:
GET /api/users/mcdnuser/content 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: Mon, 12 Sep 2011 03:49:00 GMT
Server: Google Frontend
Content-Length: 1734
Cache-Control: private, x-gzip-ok=""
Connection: close [{
    "contentStatus": "ACTIVE",
    "contentUser": "mcdnuser",
    "createdTime": "12 Sep 2011 02:54:23 GMT",
    "description": "Azure Logo",
    "downloadCount": 0,
    "duplicates": true,
    "fileName": "azure_icon.png",
    "fileSize": 7366,
    "hostUntil": "10 Sep 2012 08:00:25 GMT",
    "keyName": "Jnjr",
    "lastUpdateTime": "12 Sep 2011 02:54:23 GMT",
    "locations": ["CDN"],
    "mediaKeyString": "",
    "metaCdnUrl": "http://www.metacdn.com/r/c/5L4lDoyc/Jnjr",
    "originUrl": "http://www.metacdn.com/img/icon/azure_icon.png",
    "replicationStatus": "PENDING",
    "tags": [
        "png",
        "logo",
        "image"
    ],
    "title": "Azure Icon"
}, {
    "contentStatus": "ACTIVE",
    "contentUser": "mcdnuser",
    "createdTime": "12 Sep 2011 03:13:36 GMT",
    "description": "cloudclimate.com CDN speed test",
    "downloadCount": 0,
    "duplicates": true,
    "fileName": "sample.gif",
    "fileSize": 64469,
    "hostUntil": "10 Sep 2012 08:00:25 GMT",
    "keyName": "KULk",
    "lastUpdateTime": "12 Sep 2011 03:13:36 GMT",
    "locations": ["CDN"],
    "mediaKeyString": "",
    "metaCdnDnsUrl": "http://cdn-1.metacdn.net/mcdnuser/sample.gif",
    "metaCdnUrl": "http://www.metacdn.com/r/c/5L4lDoyc/KULk",
    "originUrl": "http://www.metacdn.org/sample.gif",
    "replicationStatus": "PENDING",
    "tags": [
        "gif",
        "speedtest",
        "image"
    ],
    "title": "MetaCDN Sample"
}]
HTTP Operation: GET
URL: GET https://secure.metacdn.com/api/users/{username}/content/{contentkey}
Auth: None
Expected HTTP response: HTTP/1.1 307 TEMPORARY_REDIRECT
Expected Format (mandatory, optional):

Example Call #4:
GET /api/users/mcdnuser/content/Jnjr HTTP/1.1
Expected Response #4:
HTTP/1.1 307 OK
Accept-Ranges: bytes
Location: http://aus-east-1.metacdn.com:8773/services/Walrus/metacdn/mcdnuser/azure_icon.png
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Date: Wed, 29 Sep 2010 04:35:52 GMT
Content-Type: text/html
Server: Google Frontend
Content-Length: 0
Connection: close
Notes:

Update content

HTTP Operation: PUT
URL: PUT https://secure.metacdn.com/api/users/{username}/content/{contentkey}
Auth: HTTP digest authentication (User)
"Content-Type" header: application/json
Expected HTTP response: HTTP/1.1 202 Updated
Expected Format (mandatory, optional):
POST /api/users/{username}/content HTTP/1.1
Content-Type: application/json {
    "hostUntil": "DD Mon YYYY HH:MM:SS GMT",
    "tags": ["TAG1", "TAG2", ..., "TAGN"], 
    "description": "",
    "title": "",
    "refreshOrigin": true/false
}
Notes:
Example Call #1:
PUT /api/users/mcdnuser/content/Jnjr HTTP/1.1
Content-Type: application/json {
    "hostUntil": "12 Oct 2011 02:54:23 GMT",
    "tags": ["azure", "logo", "small"],
    "description": "Azure Logo Small",
    "title": "Azure Icon Small"
}
Expected Response #1:
HTTP/1.1 202 Accepted
Content-Type: text/plain; charset=UTF-8
Accept-Ranges: bytes
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Date: Wed, 29 Sep 2010 05:34:39 GMT
Server: Google Frontend
Content-Length: 15
Cache-Control: private, x-gzip-ok=""
Connection: close
Content updated
Example Call #2:
PUT /api/users/jumipqxo/content/1bzxCh HTTP/1.1
Content-Type: application/json {
    "refreshOrigin": true
}
Expected Response #2:
HTTP/1.1 202 Accepted
Content-Type: text/plain; charset=UTF-8
Accept-Ranges: bytes
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Date: Tue, 06 Nov 2012 06:50:06 GMT
Server: Google Frontend
Cache-Control: private
Connection: close
Content updated

Delete content

HTTP Operation: DELETE
URL: DELETE https://secure.metacdn.com/api/users/{username}/content/{contentkey}
Auth: HTTP digest authentication (User)
Expected HTTP response: HTTP/1.1 202 Updated
Expected Format (mandatory, optional):
DELETE /api/users/{username}/content/{contentkey} HTTP/1.1
Example Call #1:
DELETE /api/users/mcdnuser/content/Jnjr HTTP/1.1
Expected Response #1:
HTTP/1.1 202 Accepted
Content-Type text/plain; charset=UTF-8
Date: Thu, 11 Feb 2010 04:51:37 GMT
Accept-Ranges: bytes
Server: Restlet-Framework/2.0.8
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Content-Length: 30
Connection: close
Content scheduled for deletion