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:
- "originSource" describes content or a list of content you want to replicate.
- "originUrl" is the publicly accessible URL of a piece of content hosted on your origin server that you want to replicate.
- "title" is the title of the content. The maximum length allowed for the title field is 100 characters.
- "description" is a textual description of the content to be replicated. The maximum length allowed for the description field is 500 characters.
-
"hostUtil" is the date you want the deployment to be terminated, after which
any replicas that have been created will be deleted. If you omit this field the
content will be hosted until you request its deletion.
- "duplicates" is a boolean value that specifies whether you want multiple replicas deployed in each specified location if available.
- "tags" is a list of descriptive tags you want associated with your content.
- When creating content, "originUrl" is sent back to the caller in the response. The originUrl can be used to unambiguously map originSource entries to contentInfo response entries.
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:
- "contentStatus" can be in the following states: INITIATING, ACTIVE, DEL_SCHED, INACTIVE, ERROR
- "replicationStatus" can be in the following states: INITIATING, PENDING, QUEUED, SUBMITTED, INPROGRESS, COMPLETED, FAILED
- If the content does not have a "hostUntil" (expiry) date, that field will not be present in the response.
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:
- "Location" will resolve to the optimal replica of the origin content. In the event there is no replica, it will revert to the "originUrl"
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:
- To remove a content's expiry date, set the "hostUntil" value of an update request to an empty string.
- To refresh (reload) content from its existing "originUrl", set the "refreshOrigin" value to true.
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
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"] }
- "originUrl" is the publicly accessible URL of a piece of content hosted on your origin server that you want to replicate.
- "title" is the title of the content. The maximum length allowed for the title field is 100 characters.
- "description" is a textual description of the content to be replicated. The maximum length allowed for the description field is 500 characters.
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"] }
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" }] }
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"] }
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 /api/users/{username}/content/{contentkey} HTTP/1.1 Accept: application/json
GET /api/users/mcdnuser/content/KULk HTTP/1.1 Accept: application/json
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" }
GET /api/users/mcdnuser/content/Jnjr 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: 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" }
GET /api/users/{username}/content HTTP/1.1 Accept: application/json
GET /api/users/mcdnuser/content 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: 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" }]
GET /api/users/mcdnuser/content/Jnjr HTTP/1.1
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
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 }
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" }
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
PUT /api/users/jumipqxo/content/1bzxCh HTTP/1.1 Content-Type: application/json { "refreshOrigin": true }
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 /api/users/{username}/content/{contentkey} HTTP/1.1
DELETE /api/users/mcdnuser/content/Jnjr HTTP/1.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