vCDN API Documentation v1.1.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Base URL để sử dụng API:
Authentication
- Mỗi API cần phải có API Key để sử dụng
- Thêm header Authorization với giá trị: Bearer
YOUR_API_KEY
Web Accelerator
the Web Accelerator API
Create Web Accelerator CDN
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/create \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"type": "webacc",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"actionName": "imgOptimize",
"value": "on",
"order": 0
},
{
"actionName": "minify",
"value": "[\"js\",\"css\",\"html\"]",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/create HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"type": "webacc",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"actionName": "imgOptimize",
"value": "on",
"order": 0
},
{
"actionName": "minify",
"value": "[\"js\",\"css\",\"html\"]",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}
const fetch = require('node-fetch');
const inputBody = {
"type": "webacc",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"actionName": "imgOptimize",
"value": "on",
"order": 0
},
{
"actionName": "minify",
"value": "[\"js\",\"css\",\"html\"]",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/create',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"type": "webacc",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"actionName": "imgOptimize",
"value": "on",
"order": 0
},
{
"actionName": "minify",
"value": "[\"js\",\"css\",\"html\"]",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/create',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"type": "webacc",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"actionName": "imgOptimize",
"value": "on",
"order": 0
},
{
"actionName": "minify",
"value": "[\"js\",\"css\",\"html\"]",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/create', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"type": "webacc",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"actionName": "imgOptimize",
"value": "on",
"order": 0
},
{
"actionName": "minify",
"value": "[\"js\",\"css\",\"html\"]",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/create', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/create");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"type\": \"webacc\",\n \"domainName\": \"abc\",\n \"sslId\": \"default\",\n \"lbType\": \"rr\",\n \"originHostHeader\": \"\",\n \"failOverErrorCode\": [\n \"500\",\n \"502\",\n \"503\",\n \"504\"\n ],\n \"upstreams\": [\n {\n \"priority\": 10,\n \"ipaddress\": \"1.1.1.1\",\n \"upstreamType\": \"httpOrigin\",\n \"originValue\": null,\n \"useSsl\": false\n }\n ],\n \"defaultRuleAction\": [\n {\n \"actionName\": \"cacheLevel\",\n \"value\": \"3\",\n \"order\": 0\n },\n {\n \"actionName\": \"hsts\",\n \"value\": \"{\\\"hsts\\\":\\\"off\\\",\\\"preload\\\":\\\"off\\\",\\\"includeSubDomains\\\":\\\"off\\\",\\\"maxAge\\\":\\\"0m\\\"}\",\n \"order\": 0\n },\n {\n \"actionName\": \"nosniff\",\n \"value\": \"on\",\n \"order\": 0\n },\n {\n \"actionName\": \"minimumTls\",\n \"value\": \"TLS 1.0\",\n \"order\": 0\n },\n {\n \"actionName\": \"serverCache\",\n \"value\": \"1d\",\n \"order\": 0\n },\n {\n \"actionName\": \"browserCache\",\n \"value\": \"1M\",\n \"order\": 0\n },\n {\n \"actionName\": \"developmentMode\",\n \"value\": \"off\",\n \"order\": 0\n },\n {\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 0\n },\n {\n \"actionName\": \"brotliResponse\",\n \"value\": \"on\",\n \"order\": 0\n },\n {\n \"actionName\": \"rewriteHttps\",\n \"value\": \"on\",\n \"order\": 0\n },\n {\n \"actionName\": \"imgOptimize\",\n \"value\": \"on\",\n \"order\": 0\n },\n {\n \"actionName\": \"minify\",\n \"value\": \"[\\\"js\\\",\\\"css\\\",\\\"html\\\"]\",\n \"order\": 0\n }\n ],\n \"childrenRule\": [\n {\n \"order\": 1,\n \"urlPattern\": [\n \"/acd\"\n ],\n \"actions\": [\n {\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 1\n },\n {\n \"actionName\": \"serverCache\",\n \"value\": \"1h\",\n \"order\": 2\n },\n {\n \"actionName\": \"browserCache\",\n \"value\": \"30m\",\n \"order\": 3\n },\n {\n \"actionName\": \"byPassByCookies\",\n \"order\": 4\n },\n {\n \"actionName\": \"byPassCacheByDeviceType\",\n \"value\": \"[\\\"test\\\"]\",\n \"order\": 5\n },\n {\n \"actionName\": \"headerOverride\",\n \"order\": 6\n },\n {\n \"actionName\": \"originOverride\",\n \"value\": \"{\\\"ip_address\\\":\\\"2.2.2.2\\\"}\",\n \"order\": 7\n },\n {\n \"actionName\": \"baseDirectory\",\n \"value\": \"{\\\"origin_directory_value\\\":\\\"/abcd\\\"}\",\n \"order\": 8\n },\n {\n \"actionName\": \"denyAccess\",\n \"value\": \"{\\\"reason\\\":\\\"deny test\\\",\\\"enabled\\\":\\\"true\\\"}\",\n \"order\": 9\n },\n {\n \"actionName\": \"byPassByCookies\",\n \"value\": \"{\\\"cookie_value\\\":\\\"test\\\",\\\"cookie_name\\\":\\\"abd\\\"}\",\n \"order\": 10\n }\n ],\n \"criterias\": [\n {\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/acd\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n },\n {\n \"order\": 2,\n \"urlPattern\": [\n \"/dtw\"\n ],\n \"actions\": [\n {\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 1\n },\n {\n \"actionName\": \"browserCache\",\n \"value\": \"3h\",\n \"order\": 2\n }\n ],\n \"criterias\": [\n {\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/dtw\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n },\n {\n \"order\": 3,\n \"urlPattern\": [\n \"/\"\n ],\n \"actions\": [\n {\n \"actionName\": \"redirect\",\n \"value\": \"{\\\"code\\\":\\\"301\\\",\\\"url\\\":\\\"https://fk.zoneplay.vn/landing\\\"}\",\n \"order\": 1\n }\n ],\n \"criterias\": [\n {\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n }\n ],\n \"cName\": []\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"type": "webacc",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"actionName": "imgOptimize",
"value": "on",
"order": 0
},
{
"actionName": "minify",
"value": "[\"js\",\"css\",\"html\"]",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/create", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/webacc/create
Create Web Accelerator CDN
Body parameter
Successfully
{
"type": "webacc",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"actionName": "imgOptimize",
"value": "on",
"order": 0
},
{
"actionName": "minify",
"value": "[\"js\",\"css\",\"html\"]",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
originHostHeader | string | false | Origin host header cần tạo hay edit | |
upstreams | List(UpStreamDto) | true | Danh sách các upstream của CDN. |
|
lbType | string | true | Load balance type của origin | |
failOverErrorCode | List(string) | true | List string một hoặc nhiều giá trị trong dãy sau:403, 404, 429, 500, 502, 503, 504 |
|
domainName | string | true | Tên domain name của CDN cần tạo hay edit, | |
cName | List(string) | false | [ ] | Danh sách các domain name thay thế của CDN |
defaultRuleAction | List(RuleAction) | true | Những rule behavior default bắt buộc của từng loại CDN | |
childrenRule | List(PageRule) | false | Danh sách các rule và behavior tùy chọn | |
sslId | string | true | default | Id của certificate |
Detailed descriptions
lbType: Load balance type của origin
rr
Round robinlc
Least Connectediph
IP Hashing
domainName: Tên domain name của CDN cần tạo hay edit,
- Nếu tạo Web Accelerator CDN phải thỏa các điều kiện sau:
- Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang
(-)
và dấu chấm.
- Đầu và đuôi từng thành phần (phân cách bởi dấu chấm
(.)
) không được xuất hiện ký tự đặc biệt(-)
. - Được phép 2 dấu gạch ngang liên tiếp
(--)
nhưng không được 2 dấu chấm liên tiếp(..)
- Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang
- Nếu tạo các CDN khác thì thỏa điều kiện sau:
- Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau:
%*,./-_()?&=:;+$[]!#~^@
- Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau:
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Create CDN data successful.",
"data": {
"message": null,
"data": null,
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "webacc",
"cdnDomain": "jftbmv73rgwebacc.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"id": "29a3eb4b-386e-48d4-b2ee-be3ca6c3a0a1",
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "9146e82a-27db-4ce6-8310-a9e852640298",
"actionName": "imgOptimize",
"value": "on",
"order": 0
},
{
"id": "af7ea270-554d-4e40-9eeb-a50eb85e19db",
"actionName": "minify",
"value": "[\"js\",\"css\",\"html\"]",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Create CDN successfully | WebAccResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Update Web Accelerator CDN
Code samples
# You can also use wget
curl -X PUT https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/update \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "webacc",
"cdnDomain": "jftbmv73rgwebacc.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"id": "29a3eb4b-386e-48d4-b2ee-be3ca6c3a0a1",
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "9146e82a-27db-4ce6-8310-a9e852640298",
"actionName": "imgOptimize",
"value": "on",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}'
PUT https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/update HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "webacc",
"cdnDomain": "jftbmv73rgwebacc.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"id": "29a3eb4b-386e-48d4-b2ee-be3ca6c3a0a1",
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "9146e82a-27db-4ce6-8310-a9e852640298",
"actionName": "imgOptimize",
"value": "on",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}
const fetch = require('node-fetch');
const inputBody = {
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "webacc",
"cdnDomain": "jftbmv73rgwebacc.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"id": "29a3eb4b-386e-48d4-b2ee-be3ca6c3a0a1",
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "9146e82a-27db-4ce6-8310-a9e852640298",
"actionName": "imgOptimize",
"value": "on",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/update',
{
method: 'PUT',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "webacc",
"cdnDomain": "jftbmv73rgwebacc.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"id": "29a3eb4b-386e-48d4-b2ee-be3ca6c3a0a1",
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "9146e82a-27db-4ce6-8310-a9e852640298",
"actionName": "imgOptimize",
"value": "on",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}
result = RestClient.put 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/update',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "webacc",
"cdnDomain": "jftbmv73rgwebacc.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"id": "29a3eb4b-386e-48d4-b2ee-be3ca6c3a0a1",
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "9146e82a-27db-4ce6-8310-a9e852640298",
"actionName": "imgOptimize",
"value": "on",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}
r = requests.put('https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/update', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "webacc",
"cdnDomain": "jftbmv73rgwebacc.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"id": "29a3eb4b-386e-48d4-b2ee-be3ca6c3a0a1",
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "9146e82a-27db-4ce6-8310-a9e852640298",
"actionName": "imgOptimize",
"value": "on",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}');
try {
$response = $client->request('PUT','https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/update', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/update");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"cdnId\": \"07fd428c-06da-4e9e-9d7c-da59d60eee97\",\n \"customerId\": \"5d9d4c8bbac45dce2dcccff8\",\n \"userUuid\": \"5d9d4c8bbac45dce2dcccff8\",\n \"type\": \"webacc\",\n \"cdnDomain\": \"jftbmv73rgwebacc.vcdn.cloud\",\n \"domainName\": \"abc\",\n \"sslId\": \"default\",\n \"status\": 1,\n \"lbType\": \"rr\",\n \"originHostHeader\": \"\",\n \"failOverErrorCode\": [\n \"500\",\n \"502\",\n \"503\",\n \"504\"\n ],\n \"upstreams\": [\n {\n \"cdnUpstreamId\": \"d98fee9c-e696-4e39-9cc2-df4e9163f556\",\n \"cdnId\": \"07fd428c-06da-4e9e-9d7c-da59d60eee97\",\n \"priority\": 10,\n \"ipaddress\": \"1.1.1.1\",\n \"status\": 1,\n \"upstreamType\": \"httpOrigin\",\n \"originValue\": null,\n \"useSsl\": false\n }\n ],\n \"defaultRuleAction\": [\n {\n \"id\": \"01911fa0-ed4d-4225-a4d9-056a1c39d99f\",\n \"actionName\": \"cacheLevel\",\n \"value\": \"3\",\n \"order\": 0\n },\n {\n \"id\": \"06017a97-ea94-4c56-b625-67c87fc9f887\",\n \"actionName\": \"hsts\",\n \"value\": \"{\\\"hsts\\\":\\\"off\\\",\\\"preload\\\":\\\"off\\\",\\\"includeSubDomains\\\":\\\"off\\\",\\\"maxAge\\\":\\\"0m\\\"}\",\n \"order\": 0\n },\n {\n \"id\": \"0ee22b8c-e595-43d6-8572-a7d6f5d6c93d\",\n \"actionName\": \"nosniff\",\n \"value\": \"on\",\n \"order\": 0\n },\n {\n \"id\": \"9e545b59-a1ef-48bd-93df-57996f218484\",\n \"actionName\": \"minimumTls\",\n \"value\": \"TLS 1.0\",\n \"order\": 0\n },\n {\n \"id\": \"ea40055f-a4fb-4df6-89f0-e795cab99ff1\",\n \"actionName\": \"serverCache\",\n \"value\": \"1d\",\n \"order\": 0\n },\n {\n \"id\": \"ec7163b4-9208-479d-ae75-9f6bff60038f\",\n \"actionName\": \"browserCache\",\n \"value\": \"1M\",\n \"order\": 0\n },\n {\n \"id\": \"f30f0d11-b0a0-4c81-b184-36a5af86bdd6\",\n \"actionName\": \"developmentMode\",\n \"value\": \"off\",\n \"order\": 0\n },\n {\n \"id\": \"80a177af-9aa7-43ad-93fb-ade89299de78\",\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 0\n },\n {\n \"id\": \"29a3eb4b-386e-48d4-b2ee-be3ca6c3a0a1\",\n \"actionName\": \"brotliResponse\",\n \"value\": \"on\",\n \"order\": 0\n },\n {\n \"id\": \"b3420658-177f-4036-86ba-40bcdcf74680\",\n \"actionName\": \"rewriteHttps\",\n \"value\": \"on\",\n \"order\": 0\n },\n {\n \"id\": \"b3420658-177f-4036-86ba-40bcdcf74680\",\n \"actionName\": \"rewriteHttps\",\n \"value\": \"on\",\n \"order\": 0\n },\n {\n \"id\": \"9146e82a-27db-4ce6-8310-a9e852640298\",\n \"actionName\": \"imgOptimize\",\n \"value\": \"on\",\n \"order\": 0\n }\n ],\n \"childrenRule\": [\n {\n \"id\": \"085df6b1-705f-488f-bd9f-3d8802c0a32e\",\n \"order\": 1,\n \"urlPattern\": [\n \"/acd\"\n ],\n \"actions\": [\n {\n \"id\": \"2f5a707f-bba6-432c-99c7-9f9053c10ba7\",\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 1\n },\n {\n \"id\": \"753a7f17-299e-45f1-b3fe-57dc5fba105f\",\n \"actionName\": \"serverCache\",\n \"value\": \"1h\",\n \"order\": 2\n },\n {\n \"id\": \"6904bc94-8dd7-414a-a2fd-346646667d88\",\n \"actionName\": \"browserCache\",\n \"value\": \"30m\",\n \"order\": 3\n },\n {\n \"id\": \"cd148324-9019-48a1-9fc4-df6a79706c8a\",\n \"actionName\": \"byPassByCookies\",\n \"value\": \"{\\\"cookie_value\\\":\\\"def\\\",\\\"cookie_name\\\":\\\"abc\\\"}\",\n \"order\": 4\n },\n {\n \"id\": \"f552edb9-f025-491d-a7e7-2ba7abe33b67\",\n \"actionName\": \"byPassCacheByDeviceType\",\n \"value\": \"[\\\"test\\\"]\",\n \"order\": 5\n },\n {\n \"id\": \"1542ddb0-7f3d-4106-9525-742b200326f1\",\n \"actionName\": \"headerOverride\",\n \"value\": \"{\\\"header_value\\\":\\\"test\\\",\\\"header_name\\\":\\\"test\\\"}\",\n \"order\": 6\n },\n {\n \"id\": \"a5707038-aae1-4848-bfda-1608d3c660ce\",\n \"actionName\": \"originOverride\",\n \"value\": \"{\\\"ip_address\\\":\\\"2.2.2.2\\\"}\",\n \"order\": 7\n },\n {\n \"id\": \"f548a897-3ffc-4265-9165-0c0f19fb2c13\",\n \"actionName\": \"baseDirectory\",\n \"value\": \"{\\\"origin_directory_value\\\":\\\"/abcd\\\"}\",\n \"order\": 8\n },\n {\n \"id\": \"8cab245e-edcb-4ca1-a76e-5605a65d9c23\",\n \"actionName\": \"denyAccess\",\n \"value\": \"{\\\"reason\\\":\\\"deny test\\\",\\\"enabled\\\":\\\"true\\\"}\",\n \"order\": 9\n },\n {\n \"id\": \"40a9988c-6c39-47d3-82cc-915eca7c0e11\",\n \"actionName\": \"byPassByCookies\",\n \"value\": \"{\\\"cookie_value\\\":\\\"test\\\",\\\"cookie_name\\\":\\\"abd\\\"}\",\n \"order\": 10\n }\n ],\n \"criterias\": [\n {\n \"id\": \"085df6b1-705f-488f-bd9f-3d8802c0a32e\",\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/acd\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n },\n {\n \"id\": \"17a2e518-d1a4-49fd-a20e-a5877b8343e9\",\n \"order\": 2,\n \"urlPattern\": [\n \"/dtw\"\n ],\n \"actions\": [\n {\n \"id\": \"f546c53c-6d7f-4b12-9c9e-2bad501e94af\",\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 1\n },\n {\n \"id\": \"408e97ef-24ac-4e2c-8ae7-58705e3af404\",\n \"actionName\": \"browserCache\",\n \"value\": \"3h\",\n \"order\": 2\n }\n ],\n \"criterias\": [\n {\n \"id\": \"17a2e518-d1a4-49fd-a20e-a5877b8343e9\",\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/dtw\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n },\n {\n \"id\": \"e5977714-b7d7-45a5-8695-9f75dd7db6c8\",\n \"order\": 3,\n \"urlPattern\": [\n \"/\"\n ],\n \"actions\": [\n {\n \"id\": \"349db4df-28de-4ea0-9d8a-402f4de1bdeb\",\n \"actionName\": \"redirect\",\n \"value\": \"{\\\"code\\\":\\\"301\\\",\\\"url\\\":\\\"https://fk.zoneplay.vn/landing\\\"}\",\n \"order\": 1\n }\n ],\n \"criterias\": [\n {\n \"id\": \"e5977714-b7d7-45a5-8695-9f75dd7db6c8\",\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n }\n ],\n \"cName\": []\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "webacc",
"cdnDomain": "jftbmv73rgwebacc.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"id": "29a3eb4b-386e-48d4-b2ee-be3ca6c3a0a1",
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "9146e82a-27db-4ce6-8310-a9e852640298",
"actionName": "imgOptimize",
"value": "on",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/update", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /v1/webacc/update
Update Web Accelerator CDN
Body parameter
Successfully
{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "webacc",
"cdnDomain": "jftbmv73rgwebacc.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"id": "29a3eb4b-386e-48d4-b2ee-be3ca6c3a0a1",
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "9146e82a-27db-4ce6-8310-a9e852640298",
"actionName": "imgOptimize",
"value": "on",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
originHostHeader | string | false | Origin host header cần tạo hay edit | |
upstreams | List(UpStreamDto) | true | Danh sách các upstream của CDN. |
|
lbType | string | true | Load balance type của origin | |
failOverErrorCode | List(string) | true | List string một hoặc nhiều giá trị trong dãy sau:403, 404, 429, 500, 502, 503, 504 |
|
cdnDomain | string | true | Domain của CDN được tạo ra bởi hệ thống. | |
cdnId | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. | |
domainName | string | true | Tên domain name của CDN cần tạo hay edit, | |
cName | List(string) | false | [ ] | Danh sách các domain name thay thế của CDN |
status | integer(int32) | true | Status của CDN: | |
defaultRuleAction | List(RuleAction) | true | Những rule behavior default bắt buộc của từng loại CDN | |
childrenRule | List(PageRule) | false | Danh sách các rule và behavior tùy chọn | |
sslId | string | true | default | Id của certificate |
Detailed descriptions
lbType: Load balance type của origin
rr
Round robinlc
Least Connectediph
IP Hashing
cdnId: Chuỗi giá trị auto generate bởi hệ thống CDN.
- Create CDN:
null
hayempty
- Update CDN: Id của CDN cần update
domainName: Tên domain name của CDN cần tạo hay edit,
- Nếu tạo Web Accelerator CDN phải thỏa các điều kiện sau:
- Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang
(-)
và dấu chấm.
- Đầu và đuôi từng thành phần (phân cách bởi dấu chấm
(.)
) không được xuất hiện ký tự đặc biệt(-)
. - Được phép 2 dấu gạch ngang liên tiếp
(--)
nhưng không được 2 dấu chấm liên tiếp(..)
- Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang
- Nếu tạo các CDN khác thì thỏa điều kiện sau:
- Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau:
%*,./-_()?&=:;+$[]!#~^@
- Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau:
status: Status của CDN:
0
: DISABLED
1
: ENABLED
2
: DELETED
3
: DEPLOYING
4
: DELETING
5
: DISABLING
6
: SUSPENDING
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Create CDN data successful.",
"data": {
"message": null,
"data": null,
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "webacc",
"cdnDomain": "jftbmv73rgwebacc.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"id": "29a3eb4b-386e-48d4-b2ee-be3ca6c3a0a1",
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "9146e82a-27db-4ce6-8310-a9e852640298",
"actionName": "imgOptimize",
"value": "on",
"order": 0
},
{
"id": "af7ea270-554d-4e40-9eeb-a50eb85e19db",
"actionName": "minify",
"value": "[\"js\",\"css\",\"html\"]",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Update CDN successfully | WebAccResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Delete Web Accelerator CDN
Code samples
# You can also use wget
curl -X DELETE https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/delete/{cdnId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
DELETE https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/delete/{cdnId} HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/delete/{cdnId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.delete 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/delete/{cdnId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.delete('https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/delete/{cdnId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('DELETE','https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/delete/{cdnId}', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/delete/{cdnId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/delete/{cdnId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /v1/webacc/delete/{cdnId}
Delete Web Accelerator CDN
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
cdnId | string | true | id của cdn |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Delete CDN successful, your CDN domain will effect after 5 minutes.",
"data": ""
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Delete CDN successful. | boolean |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Get Web Accelerator CDN detail by Id
Code samples
# You can also use wget
curl -X GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/detail/{cdnId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/detail/{cdnId} HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/detail/{cdnId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.get 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/detail/{cdnId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.get('https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/detail/{cdnId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('GET','https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/detail/{cdnId}', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/detail/{cdnId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/detail/{cdnId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /v1/webacc/detail/{cdnId}
Get Web Accelerator CDN detail by Id
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
cdnId | string | true | Id cua CDN |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Create CDN data successful.",
"data": {
"message": null,
"data": null,
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "webacc",
"cdnDomain": "jftbmv73rgwebacc.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
},
{
"id": "29a3eb4b-386e-48d4-b2ee-be3ca6c3a0a1",
"actionName": "brotliResponse",
"value": "on",
"order": 0
},
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
},
{
"id": "9146e82a-27db-4ce6-8310-a9e852640298",
"actionName": "imgOptimize",
"value": "on",
"order": 0
},
{
"id": "af7ea270-554d-4e40-9eeb-a50eb85e19db",
"actionName": "minify",
"value": "[\"js\",\"css\",\"html\"]",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": []
}
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Get CDN successfully | WebAccResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Get Web Accelerator CDN List
Code samples
# You can also use wget
curl -X GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/list \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/list HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/list',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.get 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/list',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.get('https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/list', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('GET','https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/list', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/list");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/list", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /v1/webacc/list
Get Web Accelerator CDN List
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get CDN data successful.",
"data": [
{
"cdnId": "d1139eb2",
"cName": [],
"domainName": "abc.vn",
"cdnDomain": "fuafvhqbndweb.vcdn.cloud",
"status": 0
}
]
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Get CDN data successful. | WebAccResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Change Web Accelerator CDN status from enabled to disabled or vice versa
Code samples
# You can also use wget
curl -X PUT https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/status/change/{cdnId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
PUT https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/status/change/{cdnId} HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/status/change/{cdnId}',
{
method: 'PUT',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.put 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/status/change/{cdnId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.put('https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/status/change/{cdnId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('PUT','https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/status/change/{cdnId}', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/status/change/{cdnId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/webacc/status/change/{cdnId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /v1/webacc/status/change/{cdnId}
Change Web Accelerator CDN status from enabled to disabled or vice versa
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
cdnId | string | true | id của cdn |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Update CDN successful, your CDN domain will effect after 5 minutes.",
"data": ""
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Update CDN successful. | string |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Video On Demand
the VOD API
Create Video On Demand CDN
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/create \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"type": "vod",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/create HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"type": "vod",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}
const fetch = require('node-fetch');
const inputBody = {
"type": "vod",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/create',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"type": "vod",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/create',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"type": "vod",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/create', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"type": "vod",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/create', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/create");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"type\": \"vod\",\n \"domainName\": \"abc\",\n \"sslId\": \"default\",\n \"lbType\": \"rr\",\n \"originHostHeader\": \"\",\n \"failOverErrorCode\": [\n \"500\",\n \"502\",\n \"503\",\n \"504\"\n ],\n \"upstreams\": [\n {\n \"priority\": 10,\n \"ipaddress\": \"1.1.1.1\",\n \"status\": 1,\n \"upstreamType\": \"httpOrigin\",\n \"originValue\": null,\n \"useSsl\": false\n }\n ],\n \"defaultRuleAction\": [\n {\n \"actionName\": \"cacheLevel\",\n \"value\": \"3\",\n \"order\": 0\n },\n {\n \"actionName\": \"hsts\",\n \"value\": \"{\\\"hsts\\\":\\\"off\\\",\\\"preload\\\":\\\"off\\\",\\\"includeSubDomains\\\":\\\"off\\\",\\\"maxAge\\\":\\\"0m\\\"}\",\n \"order\": 0\n },\n {\n \"actionName\": \"nosniff\",\n \"value\": \"on\",\n \"order\": 0\n },\n {\n \"actionName\": \"minimumTls\",\n \"value\": \"TLS 1.0\",\n \"order\": 0\n },\n {\n \"actionName\": \"addCors\",\n \"value\": \"{\\\"configType\\\":\\\"simple\\\",\\\"allowOrigin\\\":[],\\\"allowHeader\\\":[],\\\"allowMethod\\\":[],\\\"exposeHeader\\\":[]}\",\n \"order\": 0\n },\n {\n \"actionName\": \"serverCache\",\n \"value\": \"1d\",\n \"order\": 0\n },\n {\n \"actionName\": \"browserCache\",\n \"value\": \"1M\",\n \"order\": 0\n },\n {\n \"actionName\": \"developmentMode\",\n \"value\": \"off\",\n \"order\": 0\n },\n {\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 0\n }\n ],\n \"childrenRule\": [\n {\n \"order\": 1,\n \"urlPattern\": [\n \"/acd\"\n ],\n \"actions\": [\n {\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 1\n },\n {\n \"actionName\": \"serverCache\",\n \"value\": \"1h\",\n \"order\": 2\n },\n {\n \"actionName\": \"browserCache\",\n \"value\": \"30m\",\n \"order\": 3\n },\n {\n \"actionName\": \"byPassByCookies\",\n \"value\": \"{\\\"cookie_value\\\":\\\"def\\\",\\\"cookie_name\\\":\\\"abc\\\"}\",\n \"order\": 4\n },\n {\n \"actionName\": \"byPassCacheByDeviceType\",\n \"value\": \"[\\\"test\\\"]\",\n \"order\": 5\n },\n {\n \"actionName\": \"headerOverride\",\n \"value\": \"{\\\"header_value\\\":\\\"test\\\",\\\"header_name\\\":\\\"test\\\"}\",\n \"order\": 6\n },\n {\n \"actionName\": \"originOverride\",\n \"value\": \"{\\\"ip_address\\\":\\\"2.2.2.2\\\"}\",\n \"order\": 7\n },\n {\n \"actionName\": \"baseDirectory\",\n \"value\": \"{\\\"origin_directory_value\\\":\\\"/abcd\\\"}\",\n \"order\": 8\n },\n {\n \"actionName\": \"denyAccess\",\n \"value\": \"{\\\"reason\\\":\\\"deny test\\\",\\\"enabled\\\":\\\"true\\\"}\",\n \"order\": 9\n },\n {\n \"actionName\": \"byPassByCookies\",\n \"value\": \"{\\\"cookie_value\\\":\\\"test\\\",\\\"cookie_name\\\":\\\"abd\\\"}\",\n \"order\": 10\n }\n ],\n \"criterias\": [\n {\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/acd\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n },\n {\n \"order\": 2,\n \"urlPattern\": [\n \"/dtw\"\n ],\n \"actions\": [\n {\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 1\n },\n {\n \"actionName\": \"browserCache\",\n \"value\": \"3h\",\n \"order\": 2\n }\n ],\n \"criterias\": [\n {\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/dtw\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n },\n {\n \"order\": 3,\n \"urlPattern\": [\n \"/\"\n ],\n \"actions\": [\n {\n \"actionName\": \"redirect\",\n \"value\": \"{\\\"code\\\":\\\"301\\\",\\\"url\\\":\\\"https://fk.zoneplay.vn/landing\\\"}\",\n \"order\": 1\n }\n ],\n \"criterias\": [\n {\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n }\n ],\n \"cName\": [],\n \"tokenRuleCriteria\": null,\n \"accessFilters\": [],\n \"serviceType\": \"\",\n \"segmentSize\": 0,\n \"s3Origin\": null,\n \"useSsl\": false\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"type": "vod",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/create", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/vod/create
Create new Video On Demand CDN
Body parameter
Successfully
{
"type": "vod",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
type | string | false | Type là vod |
|
tokenRuleCriteria | TokenRuleDto | false | Chỉ dùng cho Video On Demand CDN | |
accessFilters | List(AccessFilterDto) | false | [ ] | Chỉ dùng cho Video On Demand CDN |
serviceType | string | true | Service type của Video On Demand CDN | |
segmentSize | integer(int32) | true | Segment Size của Video On Demand CDN khi type là cdnPack | |
s3Origin | S3OriginDto | false | Chỉ áp dụng cho Object Download và Video On Demand CDN | |
useSsl | boolean | false | Điều chỉnh việc sử dụng ssl cho http origin hay không. | |
originHostHeader | string | false | Origin host header cần tạo hay edit | |
upstreams | List(UpStreamDto) | true | Danh sách các upstream của CDN. |
|
lbType | string | true | Load balance type của origin | |
failOverErrorCode | List(string) | true | List string một hoặc nhiều giá trị trong dãy sau:403, 404, 429, 500, 502, 503, 504 |
|
domainName | string | true | Tên domain name của CDN cần tạo hay edit, | |
cName | List(string) | false | [ ] | Danh sách các domain name thay thế của CDN |
defaultRuleAction | List(RuleAction) | true | Những rule behavior default bắt buộc của từng loại CDN | |
childrenRule | List(PageRule) | false | Danh sách các rule và behavior tùy chọn | |
sslId | string | true | default | Id của certificate |
Detailed descriptions
serviceType: Service type của Video On Demand CDN
Một trong các giá trị sau:
cdnpack
, oripack
, mp4
segmentSize: Segment Size của Video On Demand CDN khi type là cdnPack
- Giá trị 0 khi sử dụng service Type của VoD là
oripack
haymp4
. - Khi service Type là
cdnPack
, nhập một trong các giá trị sau:4,6,10
lbType: Load balance type của origin
rr
Round robinlc
Least Connectediph
IP Hashing
domainName: Tên domain name của CDN cần tạo hay edit,
- Nếu tạo Web Accelerator CDN phải thỏa các điều kiện sau:
- Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang
(-)
và dấu chấm.
- Đầu và đuôi từng thành phần (phân cách bởi dấu chấm
(.)
) không được xuất hiện ký tự đặc biệt(-)
. - Được phép 2 dấu gạch ngang liên tiếp
(--)
nhưng không được 2 dấu chấm liên tiếp(..)
- Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang
- Nếu tạo các CDN khác thì thỏa điều kiện sau:
- Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau:
%*,./-_()?&=:;+$[]!#~^@
- Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau:
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Create CDN successful, your CDN domain will effect after 5 minutes.",
"data": {
"message": null,
"data": null,
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "vod",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Create Cdn successfully | VodResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Update Video On Demand CDN
Code samples
# You can also use wget
curl -X PUT https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/update \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "vod",
"cdnDomain": "jftbmv73rgvod.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}'
PUT https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/update HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "vod",
"cdnDomain": "jftbmv73rgvod.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}
const fetch = require('node-fetch');
const inputBody = {
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "vod",
"cdnDomain": "jftbmv73rgvod.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/update',
{
method: 'PUT',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "vod",
"cdnDomain": "jftbmv73rgvod.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}
result = RestClient.put 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/update',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "vod",
"cdnDomain": "jftbmv73rgvod.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}
r = requests.put('https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/update', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "vod",
"cdnDomain": "jftbmv73rgvod.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}');
try {
$response = $client->request('PUT','https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/update', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/update");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"cdnId\": \"07fd428c-06da-4e9e-9d7c-da59d60eee97\",\n \"customerId\": \"5d9d4c8bbac45dce2dcccff8\",\n \"userUuid\": \"5d9d4c8bbac45dce2dcccff8\",\n \"type\": \"vod\",\n \"cdnDomain\": \"jftbmv73rgvod.vcdn.cloud\",\n \"domainName\": \"abc\",\n \"sslId\": \"default\",\n \"status\": 1,\n \"lbType\": \"rr\",\n \"originHostHeader\": \"\",\n \"failOverErrorCode\": [\n \"500\",\n \"502\",\n \"503\",\n \"504\"\n ],\n \"upstreams\": [\n {\n \"cdnUpstreamId\": \"d98fee9c-e696-4e39-9cc2-df4e9163f556\",\n \"cdnId\": \"07fd428c-06da-4e9e-9d7c-da59d60eee97\",\n \"priority\": 10,\n \"ipaddress\": \"1.1.1.1\",\n \"status\": 1,\n \"upstreamType\": \"httpOrigin\",\n \"originValue\": null,\n \"useSsl\": false\n }\n ],\n \"defaultRuleAction\": [\n {\n \"id\": \"01911fa0-ed4d-4225-a4d9-056a1c39d99f\",\n \"actionName\": \"cacheLevel\",\n \"value\": \"3\",\n \"order\": 0\n },\n {\n \"id\": \"06017a97-ea94-4c56-b625-67c87fc9f887\",\n \"actionName\": \"hsts\",\n \"value\": \"{\\\"hsts\\\":\\\"off\\\",\\\"preload\\\":\\\"off\\\",\\\"includeSubDomains\\\":\\\"off\\\",\\\"maxAge\\\":\\\"0m\\\"}\",\n \"order\": 0\n },\n {\n \"id\": \"0ee22b8c-e595-43d6-8572-a7d6f5d6c93d\",\n \"actionName\": \"nosniff\",\n \"value\": \"on\",\n \"order\": 0\n },\n {\n \"id\": \"9e545b59-a1ef-48bd-93df-57996f218484\",\n \"actionName\": \"minimumTls\",\n \"value\": \"TLS 1.0\",\n \"order\": 0\n },\n {\n \"id\": \"d66761ba-371b-41a7-8e30-1ef556e57449\",\n \"actionName\": \"addCors\",\n \"value\": \"{\\\"configType\\\":\\\"simple\\\",\\\"allowOrigin\\\":[],\\\"allowHeader\\\":[],\\\"allowMethod\\\":[],\\\"exposeHeader\\\":[]}\",\n \"order\": 0\n },\n {\n \"id\": \"ea40055f-a4fb-4df6-89f0-e795cab99ff1\",\n \"actionName\": \"serverCache\",\n \"value\": \"1d\",\n \"order\": 0\n },\n {\n \"id\": \"ec7163b4-9208-479d-ae75-9f6bff60038f\",\n \"actionName\": \"browserCache\",\n \"value\": \"1M\",\n \"order\": 0\n },\n {\n \"id\": \"f30f0d11-b0a0-4c81-b184-36a5af86bdd6\",\n \"actionName\": \"developmentMode\",\n \"value\": \"off\",\n \"order\": 0\n },\n {\n \"id\": \"80a177af-9aa7-43ad-93fb-ade89299de78\",\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 0\n }\n ],\n \"childrenRule\": [\n {\n \"id\": \"085df6b1-705f-488f-bd9f-3d8802c0a32e\",\n \"order\": 1,\n \"urlPattern\": [\n \"/acd\"\n ],\n \"actions\": [\n {\n \"id\": \"2f5a707f-bba6-432c-99c7-9f9053c10ba7\",\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 1\n },\n {\n \"id\": \"753a7f17-299e-45f1-b3fe-57dc5fba105f\",\n \"actionName\": \"serverCache\",\n \"value\": \"1h\",\n \"order\": 2\n },\n {\n \"id\": \"6904bc94-8dd7-414a-a2fd-346646667d88\",\n \"actionName\": \"browserCache\",\n \"value\": \"30m\",\n \"order\": 3\n },\n {\n \"id\": \"cd148324-9019-48a1-9fc4-df6a79706c8a\",\n \"actionName\": \"byPassByCookies\",\n \"value\": \"{\\\"cookie_value\\\":\\\"def\\\",\\\"cookie_name\\\":\\\"abc\\\"}\",\n \"order\": 4\n },\n {\n \"id\": \"f552edb9-f025-491d-a7e7-2ba7abe33b67\",\n \"actionName\": \"byPassCacheByDeviceType\",\n \"value\": \"[\\\"test\\\"]\",\n \"order\": 5\n },\n {\n \"id\": \"1542ddb0-7f3d-4106-9525-742b200326f1\",\n \"actionName\": \"headerOverride\",\n \"value\": \"{\\\"header_value\\\":\\\"test\\\",\\\"header_name\\\":\\\"test\\\"}\",\n \"order\": 6\n },\n {\n \"id\": \"a5707038-aae1-4848-bfda-1608d3c660ce\",\n \"actionName\": \"originOverride\",\n \"value\": \"{\\\"ip_address\\\":\\\"2.2.2.2\\\"}\",\n \"order\": 7\n },\n {\n \"id\": \"f548a897-3ffc-4265-9165-0c0f19fb2c13\",\n \"actionName\": \"baseDirectory\",\n \"value\": \"{\\\"origin_directory_value\\\":\\\"/abcd\\\"}\",\n \"order\": 8\n },\n {\n \"id\": \"8cab245e-edcb-4ca1-a76e-5605a65d9c23\",\n \"actionName\": \"denyAccess\",\n \"value\": \"{\\\"reason\\\":\\\"deny test\\\",\\\"enabled\\\":\\\"true\\\"}\",\n \"order\": 9\n },\n {\n \"id\": \"40a9988c-6c39-47d3-82cc-915eca7c0e11\",\n \"actionName\": \"byPassByCookies\",\n \"value\": \"{\\\"cookie_value\\\":\\\"test\\\",\\\"cookie_name\\\":\\\"abd\\\"}\",\n \"order\": 10\n }\n ],\n \"criterias\": [\n {\n \"id\": \"085df6b1-705f-488f-bd9f-3d8802c0a32e\",\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/acd\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n },\n {\n \"id\": \"17a2e518-d1a4-49fd-a20e-a5877b8343e9\",\n \"order\": 2,\n \"urlPattern\": [\n \"/dtw\"\n ],\n \"actions\": [\n {\n \"id\": \"f546c53c-6d7f-4b12-9c9e-2bad501e94af\",\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 1\n },\n {\n \"id\": \"408e97ef-24ac-4e2c-8ae7-58705e3af404\",\n \"actionName\": \"browserCache\",\n \"value\": \"3h\",\n \"order\": 2\n }\n ],\n \"criterias\": [\n {\n \"id\": \"17a2e518-d1a4-49fd-a20e-a5877b8343e9\",\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/dtw\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n },\n {\n \"id\": \"e5977714-b7d7-45a5-8695-9f75dd7db6c8\",\n \"order\": 3,\n \"urlPattern\": [\n \"/\"\n ],\n \"actions\": [\n {\n \"id\": \"349db4df-28de-4ea0-9d8a-402f4de1bdeb\",\n \"actionName\": \"redirect\",\n \"value\": \"{\\\"code\\\":\\\"301\\\",\\\"url\\\":\\\"https://fk.zoneplay.vn/landing\\\"}\",\n \"order\": 1\n }\n ],\n \"criterias\": [\n {\n \"id\": \"e5977714-b7d7-45a5-8695-9f75dd7db6c8\",\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n }\n ],\n \"cName\": [],\n \"tokenRuleCriteria\": null,\n \"accessFilters\": [],\n \"serviceType\": \"\",\n \"segmentSize\": 0,\n \"s3Origin\": null,\n \"useSsl\": false\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "vod",
"cdnDomain": "jftbmv73rgvod.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/update", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /v1/vod/update
Update Video On Demand CDN
Body parameter
Successfully
{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "vod",
"cdnDomain": "jftbmv73rgvod.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
type | string | false | Type là vod |
|
tokenRuleCriteria | TokenRuleDto | false | Chỉ dùng cho Video On Demand CDN | |
accessFilters | List(AccessFilterDto) | false | [ ] | Chỉ dùng cho Video On Demand CDN |
serviceType | string | true | Service type của Video On Demand CDN | |
segmentSize | integer(int32) | true | Segment Size của Video On Demand CDN khi type là cdnPack | |
s3Origin | S3OriginDto | false | Chỉ áp dụng cho Object Download và Video On Demand CDN | |
useSsl | boolean | false | Điều chỉnh việc sử dụng ssl cho http origin hay không. | |
originHostHeader | string | false | Origin host header cần tạo hay edit | |
upstreams | List(UpStreamDto) | true | Danh sách các upstream của CDN. |
|
lbType | string | true | Load balance type của origin | |
failOverErrorCode | List(string) | true | List string một hoặc nhiều giá trị trong dãy sau:403, 404, 429, 500, 502, 503, 504 |
|
cdnDomain | string | true | Domain của CDN được tạo ra bởi hệ thống. | |
cdnId | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. | |
domainName | string | true | Tên domain name của CDN cần tạo hay edit, | |
cName | List(string) | false | [ ] | Danh sách các domain name thay thế của CDN |
status | integer(int32) | true | Status của CDN: | |
defaultRuleAction | List(RuleAction) | true | Những rule behavior default bắt buộc của từng loại CDN | |
childrenRule | List(PageRule) | false | Danh sách các rule và behavior tùy chọn | |
sslId | string | true | default | Id của certificate |
Detailed descriptions
serviceType: Service type của Video On Demand CDN
Một trong các giá trị sau:
cdnpack
, oripack
, mp4
segmentSize: Segment Size của Video On Demand CDN khi type là cdnPack
- Giá trị 0 khi sử dụng service Type của VoD là
oripack
haymp4
. - Khi service Type là
cdnPack
, nhập một trong các giá trị sau:4,6,10
lbType: Load balance type của origin
rr
Round robinlc
Least Connectediph
IP Hashing
cdnId: Chuỗi giá trị auto generate bởi hệ thống CDN.
- Create CDN:
null
hayempty
- Update CDN: Id của CDN cần update
domainName: Tên domain name của CDN cần tạo hay edit,
- Nếu tạo Web Accelerator CDN phải thỏa các điều kiện sau:
- Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang
(-)
và dấu chấm.
- Đầu và đuôi từng thành phần (phân cách bởi dấu chấm
(.)
) không được xuất hiện ký tự đặc biệt(-)
. - Được phép 2 dấu gạch ngang liên tiếp
(--)
nhưng không được 2 dấu chấm liên tiếp(..)
- Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang
- Nếu tạo các CDN khác thì thỏa điều kiện sau:
- Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau:
%*,./-_()?&=:;+$[]!#~^@
- Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau:
status: Status của CDN:
0
: DISABLED
1
: ENABLED
2
: DELETED
3
: DEPLOYING
4
: DELETING
5
: DISABLING
6
: SUSPENDING
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Update CDN data successful.",
"data": {
"message": null,
"data": null,
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "vod",
"cdnDomain": "jftbmv73rgobj.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Update Video On Demand successfully | VodResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Delete Video On Demand CDN
Code samples
# You can also use wget
curl -X DELETE https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/delete/{cdnId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
DELETE https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/delete/{cdnId} HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/delete/{cdnId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.delete 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/delete/{cdnId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.delete('https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/delete/{cdnId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('DELETE','https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/delete/{cdnId}', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/delete/{cdnId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/delete/{cdnId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /v1/vod/delete/{cdnId}
Delete Video On Demand CDN
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
cdnId | string | true | id của cdn |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Delete CDN successful, your CDN domain will effect after 5 minutes.",
"data": ""
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Delete CDN successfully | None |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Response Schema
Get Video On Demand CDN detail
Code samples
# You can also use wget
curl -X GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/detail/{cdnId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/detail/{cdnId} HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/detail/{cdnId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.get 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/detail/{cdnId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.get('https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/detail/{cdnId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('GET','https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/detail/{cdnId}', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/detail/{cdnId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/detail/{cdnId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /v1/vod/detail/{cdnId}
Get Video On Demand CDN detail
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
cdnId | string | true | none |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get CDN data successful.",
"data": {
"message": null,
"data": null,
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "vod",
"cdnDomain": "jftbmv73rgobj.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Get Video On Demand successfully | VodResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Get Video On Demand CDN list
Code samples
# You can also use wget
curl -X GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/list \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/list HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/list',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.get 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/list',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.get('https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/list', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('GET','https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/list', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/list");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/list", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /v1/vod/list
Get Video On Demand CDN list
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get CDN data successful.",
"data": [
{
"cdnId": "d1139eb2",
"cName": [],
"domainName": "abc.vn",
"cdnDomain": "fuafvhqbndweb.vcdn.cloud",
"status": 0
}
]
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Get CDN data successful. | VodResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Change Video On Demand CDN status
Code samples
# You can also use wget
curl -X PUT https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/status/change/{cdnId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
PUT https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/status/change/{cdnId} HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/status/change/{cdnId}',
{
method: 'PUT',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.put 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/status/change/{cdnId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.put('https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/status/change/{cdnId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('PUT','https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/status/change/{cdnId}', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/status/change/{cdnId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/vod/status/change/{cdnId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /v1/vod/status/change/{cdnId}
Change Video On Demand CDN status
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
cdnId | string | true | id của cdn |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Update CDN data successful.",
"data": {
"message": null,
"data": null,
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "vod",
"cdnDomain": "jftbmv73rgobj.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"tokenRuleCriteria": null,
"accessFilters": [],
"serviceType": "",
"segmentSize": 0,
"s3Origin": null,
"useSsl": false
}
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Update Object-Download successfully | VodResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Object Download
The Object Download API
Create Object Download CDN
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/create \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"type": "obj-download",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/create HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"type": "obj-download",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}
const fetch = require('node-fetch');
const inputBody = {
"type": "obj-download",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/create',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"type": "obj-download",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/create',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"type": "obj-download",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/create', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"type": "obj-download",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/create', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/create");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"type\": \"obj-download\",\n \"domainName\": \"abc\",\n \"sslId\": \"default\",\n \"lbType\": \"rr\",\n \"originHostHeader\": \"\",\n \"failOverErrorCode\": [\n \"500\",\n \"502\",\n \"503\",\n \"504\"\n ],\n \"upstreams\": [\n {\n \"priority\": 10,\n \"ipaddress\": \"1.1.1.1\",\n \"status\": 1,\n \"upstreamType\": \"httpOrigin\",\n \"originValue\": null,\n \"useSsl\": false\n }\n ],\n \"defaultRuleAction\": [\n {\n \"actionName\": \"cacheLevel\",\n \"value\": \"3\",\n \"order\": 0\n },\n {\n \"actionName\": \"hsts\",\n \"value\": \"{\\\"hsts\\\":\\\"off\\\",\\\"preload\\\":\\\"off\\\",\\\"includeSubDomains\\\":\\\"off\\\",\\\"maxAge\\\":\\\"0m\\\"}\",\n \"order\": 0\n },\n {\n \"actionName\": \"nosniff\",\n \"value\": \"on\",\n \"order\": 0\n },\n {\n \"actionName\": \"minimumTls\",\n \"value\": \"TLS 1.0\",\n \"order\": 0\n },\n {\n \"actionName\": \"addCors\",\n \"value\": \"{\\\"configType\\\":\\\"simple\\\",\\\"allowOrigin\\\":[],\\\"allowHeader\\\":[],\\\"allowMethod\\\":[],\\\"exposeHeader\\\":[]}\",\n \"order\": 0\n },\n {\n \"actionName\": \"serverCache\",\n \"value\": \"1d\",\n \"order\": 0\n },\n {\n \"actionName\": \"browserCache\",\n \"value\": \"1M\",\n \"order\": 0\n },\n {\n \"actionName\": \"developmentMode\",\n \"value\": \"off\",\n \"order\": 0\n },\n {\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 0\n }\n ],\n \"childrenRule\": [\n {\n \"order\": 1,\n \"urlPattern\": [\n \"/acd\"\n ],\n \"actions\": [\n {\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 1\n },\n {\n \"actionName\": \"serverCache\",\n \"value\": \"1h\",\n \"order\": 2\n },\n {\n \"actionName\": \"browserCache\",\n \"value\": \"30m\",\n \"order\": 3\n },\n {\n \"actionName\": \"byPassByCookies\",\n \"value\": \"{\\\"cookie_value\\\":\\\"def\\\",\\\"cookie_name\\\":\\\"abc\\\"}\",\n \"order\": 4\n },\n {\n \"actionName\": \"byPassCacheByDeviceType\",\n \"value\": \"[\\\"test\\\"]\",\n \"order\": 5\n },\n {\n \"actionName\": \"headerOverride\",\n \"value\": \"{\\\"header_value\\\":\\\"test\\\",\\\"header_name\\\":\\\"test\\\"}\",\n \"order\": 6\n },\n {\n \"actionName\": \"originOverride\",\n \"value\": \"{\\\"ip_address\\\":\\\"2.2.2.2\\\"}\",\n \"order\": 7\n },\n {\n \"actionName\": \"baseDirectory\",\n \"value\": \"{\\\"origin_directory_value\\\":\\\"/abcd\\\"}\",\n \"order\": 8\n },\n {\n \"actionName\": \"denyAccess\",\n \"value\": \"{\\\"reason\\\":\\\"deny test\\\",\\\"enabled\\\":\\\"true\\\"}\",\n \"order\": 9\n },\n {\n \"actionName\": \"byPassByCookies\",\n \"value\": \"{\\\"cookie_value\\\":\\\"test\\\",\\\"cookie_name\\\":\\\"abd\\\"}\",\n \"order\": 10\n }\n ],\n \"criterias\": [\n {\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/acd\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n },\n {\n \"order\": 2,\n \"urlPattern\": [\n \"/dtw\"\n ],\n \"actions\": [\n {\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 1\n },\n {\n \"actionName\": \"browserCache\",\n \"value\": \"3h\",\n \"order\": 2\n }\n ],\n \"criterias\": [\n {\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/dtw\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n },\n {\n \"order\": 3,\n \"urlPattern\": [\n \"/\"\n ],\n \"actions\": [\n {\n \"actionName\": \"redirect\",\n \"value\": \"{\\\"code\\\":\\\"301\\\",\\\"url\\\":\\\"https://fk.zoneplay.vn/landing\\\"}\",\n \"order\": 1\n }\n ],\n \"criterias\": [\n {\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n }\n ],\n \"cName\": [],\n \"s3Origin\": null,\n \"useSsl\": false\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"type": "obj-download",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/create", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/obj-download/create
Create Object Download CDN
Body parameter
Successfully
{
"type": "obj-download",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
type | string | false | Type là obj-download |
|
s3Origin | S3OriginDto | false | Chỉ áp dụng cho Object Download và Video On Demand CDN | |
useSsl | boolean | false | Điều chỉnh việc sử dụng ssl cho http origin hay không. | |
originHostHeader | string | false | Origin host header cần tạo hay edit | |
upstreams | List(UpStreamDto) | true | Danh sách các upstream của CDN. |
|
lbType | string | true | Load balance type của origin | |
failOverErrorCode | List(string) | true | List string một hoặc nhiều giá trị trong dãy sau:403, 404, 429, 500, 502, 503, 504 |
|
domainName | string | true | Tên domain name của CDN cần tạo hay edit, | |
cName | List(string) | false | [ ] | Danh sách các domain name thay thế của CDN |
defaultRuleAction | List(RuleAction) | true | Những rule behavior default bắt buộc của từng loại CDN | |
childrenRule | List(PageRule) | false | Danh sách các rule và behavior tùy chọn | |
sslId | string | true | default | Id của certificate |
Detailed descriptions
lbType: Load balance type của origin
rr
Round robinlc
Least Connectediph
IP Hashing
domainName: Tên domain name của CDN cần tạo hay edit,
- Nếu tạo Web Accelerator CDN phải thỏa các điều kiện sau:
- Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang
(-)
và dấu chấm.
- Đầu và đuôi từng thành phần (phân cách bởi dấu chấm
(.)
) không được xuất hiện ký tự đặc biệt(-)
. - Được phép 2 dấu gạch ngang liên tiếp
(--)
nhưng không được 2 dấu chấm liên tiếp(..)
- Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang
- Nếu tạo các CDN khác thì thỏa điều kiện sau:
- Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau:
%*,./-_()?&=:;+$[]!#~^@
- Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau:
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Create CDN successful, your CDN domain will effect after 5 minutes.",
"data": {
"message": null,
"data": null,
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "obj-download",
"domainName": "abc",
"sslId": "default",
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Create Object-Download successfully | ObjectDownloadResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Update Object Download CDN
Code samples
# You can also use wget
curl -X PUT https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/update \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "obj-download",
"cdnDomain": "jftbmv73rgobj.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}'
PUT https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/update HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "obj-download",
"cdnDomain": "jftbmv73rgobj.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}
const fetch = require('node-fetch');
const inputBody = {
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "obj-download",
"cdnDomain": "jftbmv73rgobj.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/update',
{
method: 'PUT',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "obj-download",
"cdnDomain": "jftbmv73rgobj.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}
result = RestClient.put 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/update',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "obj-download",
"cdnDomain": "jftbmv73rgobj.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}
r = requests.put('https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/update', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "obj-download",
"cdnDomain": "jftbmv73rgobj.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}');
try {
$response = $client->request('PUT','https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/update', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/update");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"cdnId\": \"07fd428c-06da-4e9e-9d7c-da59d60eee97\",\n \"customerId\": \"5d9d4c8bbac45dce2dcccff8\",\n \"userUuid\": \"5d9d4c8bbac45dce2dcccff8\",\n \"type\": \"obj-download\",\n \"cdnDomain\": \"jftbmv73rgobj.vcdn.cloud\",\n \"domainName\": \"abc\",\n \"sslId\": \"default\",\n \"status\": 1,\n \"lbType\": \"rr\",\n \"originHostHeader\": \"\",\n \"failOverErrorCode\": [\n \"500\",\n \"502\",\n \"503\",\n \"504\"\n ],\n \"upstreams\": [\n {\n \"cdnUpstreamId\": \"d98fee9c-e696-4e39-9cc2-df4e9163f556\",\n \"cdnId\": \"07fd428c-06da-4e9e-9d7c-da59d60eee97\",\n \"priority\": 10,\n \"ipaddress\": \"1.1.1.1\",\n \"status\": 1,\n \"upstreamType\": \"httpOrigin\",\n \"originValue\": null,\n \"useSsl\": false\n }\n ],\n \"defaultRuleAction\": [\n {\n \"id\": \"01911fa0-ed4d-4225-a4d9-056a1c39d99f\",\n \"actionName\": \"cacheLevel\",\n \"value\": \"3\",\n \"order\": 0\n },\n {\n \"id\": \"06017a97-ea94-4c56-b625-67c87fc9f887\",\n \"actionName\": \"hsts\",\n \"value\": \"{\\\"hsts\\\":\\\"off\\\",\\\"preload\\\":\\\"off\\\",\\\"includeSubDomains\\\":\\\"off\\\",\\\"maxAge\\\":\\\"0m\\\"}\",\n \"order\": 0\n },\n {\n \"id\": \"0ee22b8c-e595-43d6-8572-a7d6f5d6c93d\",\n \"actionName\": \"nosniff\",\n \"value\": \"on\",\n \"order\": 0\n },\n {\n \"id\": \"9e545b59-a1ef-48bd-93df-57996f218484\",\n \"actionName\": \"minimumTls\",\n \"value\": \"TLS 1.0\",\n \"order\": 0\n },\n {\n \"id\": \"d66761ba-371b-41a7-8e30-1ef556e57449\",\n \"actionName\": \"addCors\",\n \"value\": \"{\\\"configType\\\":\\\"simple\\\",\\\"allowOrigin\\\":[],\\\"allowHeader\\\":[],\\\"allowMethod\\\":[],\\\"exposeHeader\\\":[]}\",\n \"order\": 0\n },\n {\n \"id\": \"ea40055f-a4fb-4df6-89f0-e795cab99ff1\",\n \"actionName\": \"serverCache\",\n \"value\": \"1d\",\n \"order\": 0\n },\n {\n \"id\": \"ec7163b4-9208-479d-ae75-9f6bff60038f\",\n \"actionName\": \"browserCache\",\n \"value\": \"1M\",\n \"order\": 0\n },\n {\n \"id\": \"f30f0d11-b0a0-4c81-b184-36a5af86bdd6\",\n \"actionName\": \"developmentMode\",\n \"value\": \"off\",\n \"order\": 0\n },\n {\n \"id\": \"80a177af-9aa7-43ad-93fb-ade89299de78\",\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 0\n }\n ],\n \"childrenRule\": [\n {\n \"id\": \"085df6b1-705f-488f-bd9f-3d8802c0a32e\",\n \"order\": 1,\n \"urlPattern\": [\n \"/acd\"\n ],\n \"actions\": [\n {\n \"id\": \"2f5a707f-bba6-432c-99c7-9f9053c10ba7\",\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 1\n },\n {\n \"id\": \"753a7f17-299e-45f1-b3fe-57dc5fba105f\",\n \"actionName\": \"serverCache\",\n \"value\": \"1h\",\n \"order\": 2\n },\n {\n \"id\": \"6904bc94-8dd7-414a-a2fd-346646667d88\",\n \"actionName\": \"browserCache\",\n \"value\": \"30m\",\n \"order\": 3\n },\n {\n \"id\": \"cd148324-9019-48a1-9fc4-df6a79706c8a\",\n \"actionName\": \"byPassByCookies\",\n \"value\": \"{\\\"cookie_value\\\":\\\"def\\\",\\\"cookie_name\\\":\\\"abc\\\"}\",\n \"order\": 4\n },\n {\n \"id\": \"f552edb9-f025-491d-a7e7-2ba7abe33b67\",\n \"actionName\": \"byPassCacheByDeviceType\",\n \"value\": \"[\\\"test\\\"]\",\n \"order\": 5\n },\n {\n \"id\": \"1542ddb0-7f3d-4106-9525-742b200326f1\",\n \"actionName\": \"headerOverride\",\n \"value\": \"{\\\"header_value\\\":\\\"test\\\",\\\"header_name\\\":\\\"test\\\"}\",\n \"order\": 6\n },\n {\n \"id\": \"a5707038-aae1-4848-bfda-1608d3c660ce\",\n \"actionName\": \"originOverride\",\n \"value\": \"{\\\"ip_address\\\":\\\"2.2.2.2\\\"}\",\n \"order\": 7\n },\n {\n \"id\": \"f548a897-3ffc-4265-9165-0c0f19fb2c13\",\n \"actionName\": \"baseDirectory\",\n \"value\": \"{\\\"origin_directory_value\\\":\\\"/abcd\\\"}\",\n \"order\": 8\n },\n {\n \"id\": \"8cab245e-edcb-4ca1-a76e-5605a65d9c23\",\n \"actionName\": \"denyAccess\",\n \"value\": \"{\\\"reason\\\":\\\"deny test\\\",\\\"enabled\\\":\\\"true\\\"}\",\n \"order\": 9\n },\n {\n \"id\": \"40a9988c-6c39-47d3-82cc-915eca7c0e11\",\n \"actionName\": \"byPassByCookies\",\n \"value\": \"{\\\"cookie_value\\\":\\\"test\\\",\\\"cookie_name\\\":\\\"abd\\\"}\",\n \"order\": 10\n }\n ],\n \"criterias\": [\n {\n \"id\": \"085df6b1-705f-488f-bd9f-3d8802c0a32e\",\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/acd\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n },\n {\n \"id\": \"17a2e518-d1a4-49fd-a20e-a5877b8343e9\",\n \"order\": 2,\n \"urlPattern\": [\n \"/dtw\"\n ],\n \"actions\": [\n {\n \"id\": \"f546c53c-6d7f-4b12-9c9e-2bad501e94af\",\n \"actionName\": \"alwaysHttps\",\n \"value\": \"off\",\n \"order\": 1\n },\n {\n \"id\": \"408e97ef-24ac-4e2c-8ae7-58705e3af404\",\n \"actionName\": \"browserCache\",\n \"value\": \"3h\",\n \"order\": 2\n }\n ],\n \"criterias\": [\n {\n \"id\": \"17a2e518-d1a4-49fd-a20e-a5877b8343e9\",\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/dtw\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n },\n {\n \"id\": \"e5977714-b7d7-45a5-8695-9f75dd7db6c8\",\n \"order\": 3,\n \"urlPattern\": [\n \"/\"\n ],\n \"actions\": [\n {\n \"id\": \"349db4df-28de-4ea0-9d8a-402f4de1bdeb\",\n \"actionName\": \"redirect\",\n \"value\": \"{\\\"code\\\":\\\"301\\\",\\\"url\\\":\\\"https://fk.zoneplay.vn/landing\\\"}\",\n \"order\": 1\n }\n ],\n \"criterias\": [\n {\n \"id\": \"e5977714-b7d7-45a5-8695-9f75dd7db6c8\",\n \"criteriaName\": \"path\",\n \"value\": \"{\\\"matchOperator\\\":\\\"MATCHES_ONE_OF\\\",\\\"values\\\":[\\\"/\\\"],\\\"matchCaseSensitive\\\":true}\",\n \"order\": 1\n }\n ],\n \"status\": 1,\n \"childrenRule\": [],\n \"criteriaMustSatisfy\": null\n }\n ],\n \"cName\": [],\n \"s3Origin\": null,\n \"useSsl\": false\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "obj-download",
"cdnDomain": "jftbmv73rgobj.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/update", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /v1/obj-download/update
Update Object Download CDN
Body parameter
Successfully
{
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "obj-download",
"cdnDomain": "jftbmv73rgobj.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
type | string | false | Type là obj-download |
|
s3Origin | S3OriginDto | false | Chỉ áp dụng cho Object Download và Video On Demand CDN | |
useSsl | boolean | false | Điều chỉnh việc sử dụng ssl cho http origin hay không. | |
originHostHeader | string | false | Origin host header cần tạo hay edit | |
upstreams | List(UpStreamDto) | true | Danh sách các upstream của CDN. |
|
lbType | string | true | Load balance type của origin | |
failOverErrorCode | List(string) | true | List string một hoặc nhiều giá trị trong dãy sau:403, 404, 429, 500, 502, 503, 504 |
|
cdnDomain | string | true | Domain của CDN được tạo ra bởi hệ thống. | |
cdnId | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. | |
domainName | string | true | Tên domain name của CDN cần tạo hay edit, | |
cName | List(string) | false | [ ] | Danh sách các domain name thay thế của CDN |
status | integer(int32) | true | Status của CDN: | |
defaultRuleAction | List(RuleAction) | true | Những rule behavior default bắt buộc của từng loại CDN | |
childrenRule | List(PageRule) | false | Danh sách các rule và behavior tùy chọn | |
sslId | string | true | default | Id của certificate |
Detailed descriptions
lbType: Load balance type của origin
rr
Round robinlc
Least Connectediph
IP Hashing
cdnId: Chuỗi giá trị auto generate bởi hệ thống CDN.
- Create CDN:
null
hayempty
- Update CDN: Id của CDN cần update
domainName: Tên domain name của CDN cần tạo hay edit,
- Nếu tạo Web Accelerator CDN phải thỏa các điều kiện sau:
- Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang
(-)
và dấu chấm.
- Đầu và đuôi từng thành phần (phân cách bởi dấu chấm
(.)
) không được xuất hiện ký tự đặc biệt(-)
. - Được phép 2 dấu gạch ngang liên tiếp
(--)
nhưng không được 2 dấu chấm liên tiếp(..)
- Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang
- Nếu tạo các CDN khác thì thỏa điều kiện sau:
- Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau:
%*,./-_()?&=:;+$[]!#~^@
- Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau:
status: Status của CDN:
0
: DISABLED
1
: ENABLED
2
: DELETED
3
: DEPLOYING
4
: DELETING
5
: DISABLING
6
: SUSPENDING
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Update CDN data successful.",
"data": {
"message": null,
"data": null,
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "obj-download",
"cdnDomain": "jftbmv73rgobj.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Update Object-Download successfully | ObjectDownloadResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Delete Object Download CDN
Code samples
# You can also use wget
curl -X DELETE https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/delete/{cdnId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
DELETE https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/delete/{cdnId} HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/delete/{cdnId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.delete 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/delete/{cdnId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.delete('https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/delete/{cdnId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('DELETE','https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/delete/{cdnId}', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/delete/{cdnId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/delete/{cdnId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /v1/obj-download/delete/{cdnId}
Delete Object Download CDN
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
cdnId | string | true | id của cdn |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Delete CDN successful, your CDN domain will effect after 5 minutes.",
"data": ""
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Delete CDN successful. | boolean |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Get Object Download CDN detail by Id
Code samples
# You can also use wget
curl -X GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/detail/{cdnId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/detail/{cdnId} HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/detail/{cdnId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.get 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/detail/{cdnId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.get('https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/detail/{cdnId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('GET','https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/detail/{cdnId}', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/detail/{cdnId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/detail/{cdnId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /v1/obj-download/detail/{cdnId}
Get Object Download CDN detail by Id
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
cdnId | string | true | Id của CDN |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get CDN data successful.",
"data": {
"message": null,
"data": null,
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"customerId": "5d9d4c8bbac45dce2dcccff8",
"userUuid": "5d9d4c8bbac45dce2dcccff8",
"type": "obj-download",
"cdnDomain": "jftbmv73rgobj.vcdn.cloud",
"domainName": "abc",
"sslId": "default",
"status": 1,
"lbType": "rr",
"originHostHeader": "",
"failOverErrorCode": [
"500",
"502",
"503",
"504"
],
"upstreams": [
{
"cdnUpstreamId": "d98fee9c-e696-4e39-9cc2-df4e9163f556",
"cdnId": "07fd428c-06da-4e9e-9d7c-da59d60eee97",
"priority": 10,
"ipaddress": "1.1.1.1",
"status": 1,
"upstreamType": "httpOrigin",
"originValue": null,
"useSsl": false
}
],
"defaultRuleAction": [
{
"id": "01911fa0-ed4d-4225-a4d9-056a1c39d99f",
"actionName": "cacheLevel",
"value": "3",
"order": 0
},
{
"id": "06017a97-ea94-4c56-b625-67c87fc9f887",
"actionName": "hsts",
"value": "{\"hsts\":\"off\",\"preload\":\"off\",\"includeSubDomains\":\"off\",\"maxAge\":\"0m\"}",
"order": 0
},
{
"id": "0ee22b8c-e595-43d6-8572-a7d6f5d6c93d",
"actionName": "nosniff",
"value": "on",
"order": 0
},
{
"id": "9e545b59-a1ef-48bd-93df-57996f218484",
"actionName": "minimumTls",
"value": "TLS 1.0",
"order": 0
},
{
"id": "d66761ba-371b-41a7-8e30-1ef556e57449",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
},
{
"id": "ea40055f-a4fb-4df6-89f0-e795cab99ff1",
"actionName": "serverCache",
"value": "1d",
"order": 0
},
{
"id": "ec7163b4-9208-479d-ae75-9f6bff60038f",
"actionName": "browserCache",
"value": "1M",
"order": 0
},
{
"id": "f30f0d11-b0a0-4c81-b184-36a5af86bdd6",
"actionName": "developmentMode",
"value": "off",
"order": 0
},
{
"id": "80a177af-9aa7-43ad-93fb-ade89299de78",
"actionName": "alwaysHttps",
"value": "off",
"order": 0
}
],
"childrenRule": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"order": 1,
"urlPattern": [
"/acd"
],
"actions": [
{
"id": "2f5a707f-bba6-432c-99c7-9f9053c10ba7",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "753a7f17-299e-45f1-b3fe-57dc5fba105f",
"actionName": "serverCache",
"value": "1h",
"order": 2
},
{
"id": "6904bc94-8dd7-414a-a2fd-346646667d88",
"actionName": "browserCache",
"value": "30m",
"order": 3
},
{
"id": "cd148324-9019-48a1-9fc4-df6a79706c8a",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abc\"}",
"order": 4
},
{
"id": "f552edb9-f025-491d-a7e7-2ba7abe33b67",
"actionName": "byPassCacheByDeviceType",
"value": "[\"test\"]",
"order": 5
},
{
"id": "1542ddb0-7f3d-4106-9525-742b200326f1",
"actionName": "headerOverride",
"value": "{\"header_value\":\"test\",\"header_name\":\"test\"}",
"order": 6
},
{
"id": "a5707038-aae1-4848-bfda-1608d3c660ce",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 7
},
{
"id": "f548a897-3ffc-4265-9165-0c0f19fb2c13",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 8
},
{
"id": "8cab245e-edcb-4ca1-a76e-5605a65d9c23",
"actionName": "denyAccess",
"value": "{\"reason\":\"deny test\",\"enabled\":\"true\"}",
"order": 9
},
{
"id": "40a9988c-6c39-47d3-82cc-915eca7c0e11",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"test\",\"cookie_name\":\"abd\"}",
"order": 10
}
],
"criterias": [
{
"id": "085df6b1-705f-488f-bd9f-3d8802c0a32e",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/acd\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"order": 2,
"urlPattern": [
"/dtw"
],
"actions": [
{
"id": "f546c53c-6d7f-4b12-9c9e-2bad501e94af",
"actionName": "alwaysHttps",
"value": "off",
"order": 1
},
{
"id": "408e97ef-24ac-4e2c-8ae7-58705e3af404",
"actionName": "browserCache",
"value": "3h",
"order": 2
}
],
"criterias": [
{
"id": "17a2e518-d1a4-49fd-a20e-a5877b8343e9",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/dtw\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
},
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"cName": [],
"s3Origin": null,
"useSsl": false
}
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Get Object-Download successfully | ObjectDownloadResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Get Object Download CDN List
Code samples
# You can also use wget
curl -X GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/list \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/list HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/list',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.get 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/list',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.get('https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/list', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('GET','https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/list', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/list");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/list", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /v1/obj-download/list
Get Object Download CDN List
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get CDN data successful.",
"data": [
{
"cdnId": "d1139eb2",
"cName": [],
"domainName": "abc.vn",
"cdnDomain": "fuafvhqbndweb.vcdn.cloud",
"status": 0
}
]
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Get CDN data successful. | BaseCdnInfo |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Change Object Download CDN status from enabled to disabled or vice versa
Code samples
# You can also use wget
curl -X PUT https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/status/change/{cdnId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
PUT https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/status/change/{cdnId} HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/status/change/{cdnId}',
{
method: 'PUT',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.put 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/status/change/{cdnId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.put('https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/status/change/{cdnId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('PUT','https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/status/change/{cdnId}', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/status/change/{cdnId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/obj-download/status/change/{cdnId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /v1/obj-download/status/change/{cdnId}
Change Object Download CDN status from enabled to disabled or vice versa
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
cdnId | string | true | id của cdn |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Update CDN successful, your CDN domain will effect after 5 minutes.",
"data": ""
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Update CDN successful. | string |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Certificate Management
The Certificate API
Get certificate detail
Code samples
# You can also use wget
curl -X GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/detail/{idCert} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/detail/{idCert} HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/detail/{idCert}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.get 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/detail/{idCert}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.get('https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/detail/{idCert}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('GET','https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/detail/{idCert}', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/detail/{idCert}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/detail/{idCert}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /v1/certificate/detail/{idCert}
Get certificate detail
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
idCert | string | true | Id của Certificate |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get certificate data successful.",
"data": {
"cdnSslcertificateId": "ssl id",
"cdnUsing": 2,
"certificate": "certificate value",
"cname": "abc",
"commonName": "def",
"expiresOn": "28 Apr 2025 06:53:20 GMT",
"issuer": "issuer",
"privateKey": "private key value",
"validFrom": "29 Apr 2020 06:53:20 GMT",
"status": 1,
"createdTime": "2020-05-11T07:49:23.000+0000",
"deletedTime": null,
"updatedTime": "2020-05-11T08:00:07.000+0000",
"userUuid": "userid",
"createdUser": "userid",
"updatedUser": "userid",
"deletedUser": null
}
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Get certificate data successful. | CdnSslcertificateDto |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Enabled or disabled certificate
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/status/change/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/status/change/{id} HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/status/change/{id}',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/status/change/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/status/change/{id}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/status/change/{id}', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/status/change/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/status/change/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/certificate/status/change/{id}
Enabled or disabled certificate
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
id | string | true | Id của certificate |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Upload certificate successful.",
"data": ""
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Upload certificate successful. | string |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Delete certificate
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/delete/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/delete/{id} HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/delete/{id}',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/delete/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/delete/{id}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/delete/{id}', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/delete/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/delete/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/certificate/delete/{id}
Delete certificate
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
id | string | true | Id của Certificate |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Delete certificate successful.",
"data": ""
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Delete certificate successful. | SingleResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Upload certificate new certificate and edit existed certificate
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/api/upload \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"privateKey": "-----BEGIN PRIVATE KEY-----MIIJQwIBADANBgkqhkiG9-----END PRIVATE KEY-----",
"certificate": "-----BEGIN CERTIFICATE-----MIIFEjCCA-----END CERTIFICATE-----",
"caRoot": "-----BEGIN CERTIFICATE-----MIIEKTCCAxGgAwIBAgIUU-----END CERTIFICATE-----"
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/api/upload HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"privateKey": "-----BEGIN PRIVATE KEY-----MIIJQwIBADANBgkqhkiG9-----END PRIVATE KEY-----",
"certificate": "-----BEGIN CERTIFICATE-----MIIFEjCCA-----END CERTIFICATE-----",
"caRoot": "-----BEGIN CERTIFICATE-----MIIEKTCCAxGgAwIBAgIUU-----END CERTIFICATE-----"
}
const fetch = require('node-fetch');
const inputBody = {
"privateKey": "-----BEGIN PRIVATE KEY-----MIIJQwIBADANBgkqhkiG9-----END PRIVATE KEY-----",
"certificate": "-----BEGIN CERTIFICATE-----MIIFEjCCA-----END CERTIFICATE-----",
"caRoot": "-----BEGIN CERTIFICATE-----MIIEKTCCAxGgAwIBAgIUU-----END CERTIFICATE-----"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/api/upload',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"privateKey": "-----BEGIN PRIVATE KEY-----MIIJQwIBADANBgkqhkiG9-----END PRIVATE KEY-----",
"certificate": "-----BEGIN CERTIFICATE-----MIIFEjCCA-----END CERTIFICATE-----",
"caRoot": "-----BEGIN CERTIFICATE-----MIIEKTCCAxGgAwIBAgIUU-----END CERTIFICATE-----"
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/api/upload',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"privateKey": "-----BEGIN PRIVATE KEY-----MIIJQwIBADANBgkqhkiG9-----END PRIVATE KEY-----",
"certificate": "-----BEGIN CERTIFICATE-----MIIFEjCCA-----END CERTIFICATE-----",
"caRoot": "-----BEGIN CERTIFICATE-----MIIEKTCCAxGgAwIBAgIUU-----END CERTIFICATE-----"
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/api/upload', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"privateKey": "-----BEGIN PRIVATE KEY-----MIIJQwIBADANBgkqhkiG9-----END PRIVATE KEY-----",
"certificate": "-----BEGIN CERTIFICATE-----MIIFEjCCA-----END CERTIFICATE-----",
"caRoot": "-----BEGIN CERTIFICATE-----MIIEKTCCAxGgAwIBAgIUU-----END CERTIFICATE-----"
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/api/upload', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/api/upload");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"privateKey\": \"-----BEGIN PRIVATE KEY-----MIIJQwIBADANBgkqhkiG9-----END PRIVATE KEY-----\",\n \"certificate\": \"-----BEGIN CERTIFICATE-----MIIFEjCCA-----END CERTIFICATE-----\",\n \"caRoot\": \"-----BEGIN CERTIFICATE-----MIIEKTCCAxGgAwIBAgIUU-----END CERTIFICATE-----\"\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"privateKey": "-----BEGIN PRIVATE KEY-----MIIJQwIBADANBgkqhkiG9-----END PRIVATE KEY-----",
"certificate": "-----BEGIN CERTIFICATE-----MIIFEjCCA-----END CERTIFICATE-----",
"caRoot": "-----BEGIN CERTIFICATE-----MIIEKTCCAxGgAwIBAgIUU-----END CERTIFICATE-----"
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/api/upload", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/certificate/api/upload
Upload certificate new certificate and edit existed certificate
Body parameter
Successfully
{
"privateKey": "-----BEGIN PRIVATE KEY-----MIIJQwIBADANBgkqhkiG9-----END PRIVATE KEY-----",
"certificate": "-----BEGIN CERTIFICATE-----MIIFEjCCA-----END CERTIFICATE-----",
"caRoot": "-----BEGIN CERTIFICATE-----MIIEKTCCAxGgAwIBAgIUU-----END CERTIFICATE-----"
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
idCert | string | false | null (khi tạo mới) hoặc id của certificate | |
cdnUsing | integer(int32) | false | none | |
privateKey | string | false | giá trị private key | |
certificate | string | false | giá trị certificate | |
caRoot | string | false | giá trị caRoot | |
status | integer(int32) | false | status: 1 (active), 0 (inactive) |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Upload certificate successful.",
"data": ""
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Upload certificate successful. | SingleResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Get list certificate
Code samples
# You can also use wget
curl -X GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/list \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/list HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/list',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.get 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/list',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.get('https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/list', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('GET','https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/list', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/list");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/certificate/list", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /v1/certificate/list
Get list certificate
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get certificate data successful.",
"data": [
{
"cdnSslcertificateId": "certificate id",
"caRoot": "caroot value after decode",
"cdnUsing": 2,
"certificate": "certificate value after decode",
"cname": "abc",
"commonName": "def",
"expiresOn": "17 Mar 2020 02:39:24 GMT",
"issuer": "Let's Encrypt Authority X3 Let's Encrypt US",
"privateKey": "private key value after decode",
"status": 1,
"createdTime": "2020-05-28T10:24:32.000+0000",
"deletedTime": null,
"updatedTime": null,
"userUuid": "userid",
"createdUser": "userid",
"updatedUser": null,
"deletedUser": null
}
]
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Get certificate data successful. | CdnSslcertificateDto |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
General Action
the CDN API
Flush cache CDN
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/cdn/flush-cache \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"cdnDomain": "abcdvod.vcdn.cloud",
"patterns": [
"abcd",
"efgh"
],
"type": "BEGIN"
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/cdn/flush-cache HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"cdnDomain": "abcdvod.vcdn.cloud",
"patterns": [
"abcd",
"efgh"
],
"type": "BEGIN"
}
const fetch = require('node-fetch');
const inputBody = {
"cdnDomain": "abcdvod.vcdn.cloud",
"patterns": [
"abcd",
"efgh"
],
"type": "BEGIN"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/cdn/flush-cache',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"cdnDomain": "abcdvod.vcdn.cloud",
"patterns": [
"abcd",
"efgh"
],
"type": "BEGIN"
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/cdn/flush-cache',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"cdnDomain": "abcdvod.vcdn.cloud",
"patterns": [
"abcd",
"efgh"
],
"type": "BEGIN"
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/cdn/flush-cache', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"cdnDomain": "abcdvod.vcdn.cloud",
"patterns": [
"abcd",
"efgh"
],
"type": "BEGIN"
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/cdn/flush-cache', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/cdn/flush-cache");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"cdnDomain\": \"abcdvod.vcdn.cloud\",\n \"patterns\": [\n \"abcd\",\n \"efgh\"\n ],\n \"type\": \"BEGIN\"\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"cdnDomain": "abcdvod.vcdn.cloud",
"patterns": [
"abcd",
"efgh"
],
"type": "BEGIN"
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/cdn/flush-cache", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/cdn/flush-cache
Flush cache CDN
Body parameter
Successfully
{
"cdnDomain": "abcdvod.vcdn.cloud",
"patterns": [
"abcd",
"efgh"
],
"type": "BEGIN"
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
cdnDomain | string | false | CDN domain cần flush cache | |
patterns | List(string) | false | List String các pattern cần flush cache | |
type | string | false | một trong các gía trị sau [ALL , URI , BEGIN , END , CONTAIN ] |
Detailed descriptions
type: một trong các gía trị sau [ALL
, URI
, BEGIN
, END
, CONTAIN
]
+ Khi type là BEGIN
, END
, CONTAIN
chỉ cho phép nhập 1 pattern, hỗ trợ nhập dấu *
.
+ Khi type là ALL
, giá trị pattern là empty list.
+ Khi tyle là URI
, cho phép nhập nhiều giá trị nhưng không hỗ trợ dấu *
Example responses
Status 200
{
"success": false,
"code": 202,
"message": "Only one pattern is allow for these select type [BEGIN, END, CONTAIN]",
"data": ""
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Flush cache successful. | BaseResponse |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
API Key Management
The API Key API
Create API Key
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/create \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/create HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}
const fetch = require('node-fetch');
const inputBody = {
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/create',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/create',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/create', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/create', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/create");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"token\": \"eyJhbGcLWioUzUxMiw\",\n \"expiredDate\": \"2020-08-10T04:24:35Z\"\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/create", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/apikey/create
Create API Key
Body parameter
{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
token | string | false | Giá trị API Key cần cập nhật | |
expiredDate | string(date-time) | false | Ngày hết hạn |
Example responses
200 Response
{
"apiKeyId": 1,
"userEmail": "abc@gmail.com",
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z",
"createTime": "2020-08-10T04:24:35Z",
"updateTime": "2020-08-10T04:24:35Z"
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Create API Key successful. | ApiKey |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Edit API Key
Code samples
# You can also use wget
curl -X PUT https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/update \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}'
PUT https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/update HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}
const fetch = require('node-fetch');
const inputBody = {
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/update',
{
method: 'PUT',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}
result = RestClient.put 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/update',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}
r = requests.put('https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/update', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}');
try {
$response = $client->request('PUT','https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/update', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/update");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"token\": \"eyJhbGcLWioUzUxMiw\",\n \"expiredDate\": \"2020-08-10T04:24:35Z\"\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/update", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /v1/apikey/update
Edit API Key
Body parameter
{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
token | string | false | Giá trị API Key cần cập nhật | |
expiredDate | string(date-time) | false | Ngày hết hạn |
Example responses
200 Response
{
"apiKeyId": 1,
"userEmail": "abc@gmail.com",
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z",
"createTime": "2020-08-10T04:24:35Z",
"updateTime": "2020-08-10T04:24:35Z"
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Edit API Key successful. | ApiKey |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Delete API Key
Code samples
# You can also use wget
curl -X DELETE https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/delete \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}'
DELETE https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/delete HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}
const fetch = require('node-fetch');
const inputBody = {
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/delete',
{
method: 'DELETE',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}
result = RestClient.delete 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/delete',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}
r = requests.delete('https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/delete', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}');
try {
$response = $client->request('DELETE','https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/delete', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/delete");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"token\": \"eyJhbGcLWioUzUxMiw\",\n \"expiredDate\": \"2020-08-10T04:24:35Z\"\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/delete", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /v1/apikey/delete
Delete API Key
Body parameter
{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
token | string | false | Giá trị API Key cần cập nhật | |
expiredDate | string(date-time) | false | Ngày hết hạn |
Example responses
200 Response
true
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Delete API Key successful. | boolean |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Get list API Key
Code samples
# You can also use wget
curl -X GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/list \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'
GET https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/list HTTP/1.1
Host: vcdn-api.vngcloud.vn
Accept: application/json
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/list',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
result = RestClient.get 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/list',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
r = requests.get('https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/list', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
try {
$response = $client->request('GET','https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/list', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/list");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/apikey/list", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /v1/apikey/list
Get list API Key
Example responses
200 Response
{
"apiKeyId": 1,
"userEmail": "abc@gmail.com",
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z",
"createTime": "2020-08-10T04:24:35Z",
"updateTime": "2020-08-10T04:24:35Z"
}
Status 400
{
"success": false,
"code": 400,
"message": "Failed to validate CDN data, error is not support error code",
"data": ""
}
Status 401
{
"timestamp": "2020-07-07T02:55:12.402+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized with access ip is 103.245.252.19",
"path": "/web-acc-api/v1/vod/list"
}
Status 403
{
"success": false,
"code": 403,
"message": "Current user abc is not allow to call this api",
"data": ""
}
Status 500
{
"success": false,
"code": 500,
"message": "Get CDN data failed",
"data": ""
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Get list API Key successful. | ApiKey |
400 | Bad Request | Failed to validate CDN data | SingleResponse |
401 | Unauthorized | Unauthorized with access ip is [request ip] | SingleResponse |
403 | Forbidden | Current user is not allow to call this api | SingleResponse |
500 | Internal Server Error | [Request action] failled. | SingleResponse |
Analytic
the analytic API
Get CDN request data
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-requestsps \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"period": "180d",
"domains": [
"facdsndweb.vcdn.cloud"
]
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-requestsps HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"period": "180d",
"domains": [
"facdsndweb.vcdn.cloud"
]
}
const fetch = require('node-fetch');
const inputBody = {
"period": "180d",
"domains": [
"facdsndweb.vcdn.cloud"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-requestsps',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"period": "180d",
"domains": [
"facdsndweb.vcdn.cloud"
]
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-requestsps',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"period": "180d",
"domains": [
"facdsndweb.vcdn.cloud"
]
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-requestsps', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"period": "180d",
"domains": [
"facdsndweb.vcdn.cloud"
]
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-requestsps', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-requestsps");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"period\": \"180d\",\n \"domains\": [\n \"facdsndweb.vcdn.cloud\"\n ]\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"period": "180d",
"domains": [
"facdsndweb.vcdn.cloud"
]
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-requestsps", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/analytic/cdn-requestsps
Get CDN request data
Body parameter
Successfully
{
"period": "180d",
"domains": [
"facdsndweb.vcdn.cloud"
]
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
fromTime | string | true | Thời gian bắt đầu lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
toTime | string | true | Thời gian kết thúc lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
domains | List(string) | true | CDN domain muốn lấy report | |
period | string | true | Khoảng thời gian lấy report. Note: chỉ được áp dụng khi fromTime và toTime ko được cung cấp. Field này chấp nhận giá trị như sau: 30m ,1h ,3h ,6h ,12h ,24h ,3d ,7d ,14d ,30d ,90d ,180d ,360d |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get analytic data successful.",
"data": {
"1589414400000": {
"cached": 0.0012599206422382,
"uncached": 0.0041269841380343
},
"1584576000000": {
"cached": 0,
"uncached": 0
},
"1585785600000": {
"cached": 0,
"uncached": 0
}
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Data trả về là 1 Map có Key là thời gian với định dạng epoch time của Unix (timezone sẽ là UTC ), Value tham khảo bảng RequestSpsDto |
RequestSpsDto |
Get origin request data
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-requestsps \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-requestsps HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
}
const fetch = require('node-fetch');
const inputBody = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-requestsps',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-requestsps',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-requestsps', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-requestsps', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-requestsps");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"fromTime\": \"01/03/2020\",\n \"toTime\": \"01/07/2020\",\n \"domains\": [\n \"fuafvhatndfweb.vcdn.cloud\",\n \"foouwnltwdweb.vcdn.cloud\"\n ]\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-requestsps", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/analytic/origin-requestsps
Get origin request data
Body parameter
Successfully
{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
fromTime | string | true | Thời gian bắt đầu lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
toTime | string | true | Thời gian kết thúc lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
domains | List(string) | true | CDN domain muốn lấy report | |
period | string | true | Khoảng thời gian lấy report. Note: chỉ được áp dụng khi fromTime và toTime ko được cung cấp. Field này chấp nhận giá trị như sau: 30m ,1h ,3h ,6h ,12h ,24h ,3d ,7d ,14d ,30d ,90d ,180d ,360d |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get analytic data successful.",
"data": {
"1589414400000": 0.0041269841380343,
"1584576000000": 0,
"1590019200000": 0.0000198412705065,
"1586995200000": 0,
"1591833600000": 0
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Data trả về là 1 Map có Key là thời gian với định dạng epoch time của Unix (timezone sẽ là UTC ), Value là số lượng request/s đến Origin |
number |
Get unique visitors data
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/unique-visitors \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"period": "30m",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/unique-visitors HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"period": "30m",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
const fetch = require('node-fetch');
const inputBody = {
"period": "30m",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/unique-visitors',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"period": "30m",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/unique-visitors',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"period": "30m",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/unique-visitors', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"period": "30m",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/unique-visitors', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/unique-visitors");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"period\": \"30m\",\n \"domains\": [\n \"fuafvhqbndweb.vcdn.cloud\",\n \"fbb3yi3uouweb.vcdn.cloud\"\n ]\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"period": "30m",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/unique-visitors", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/analytic/unique-visitors
Get unique visitors data
Body parameter
Successfully
{
"period": "30m",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
fromTime | string | true | Thời gian bắt đầu lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
toTime | string | true | Thời gian kết thúc lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
domains | List(string) | true | CDN domain muốn lấy report | |
period | string | true | Khoảng thời gian lấy report. Note: chỉ được áp dụng khi fromTime và toTime ko được cung cấp. Field này chấp nhận giá trị như sau: 30m ,1h ,3h ,6h ,12h ,24h ,3d ,7d ,14d ,30d ,90d ,180d ,360d |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get analytic data successful.",
"data": {
"1593664632340": 0,
"1593664662340": 0
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Data trả về là 1 Map có Key là thời gian với định dạng epoch time của Unix (timezone sẽ là UTC ), Value là số lượng user đang sử dụng CDN |
number |
Get traffic consuming
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-consuming \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-consuming HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
const fetch = require('node-fetch');
const inputBody = {
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-consuming',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-consuming',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-consuming', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-consuming', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-consuming");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"period\": \"24h\",\n \"domains\": [\n \"fuafvhqbndweb.vcdn.cloud\",\n \"fbb3yi3uouweb.vcdn.cloud\"\n ]\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-consuming", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/analytic/traffic-consuming
Get traffic consuming
Body parameter
Successfully
{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
fromTime | string | true | Thời gian bắt đầu lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
toTime | string | true | Thời gian kết thúc lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
domains | List(string) | true | CDN domain muốn lấy report | |
period | string | true | Khoảng thời gian lấy report. Note: chỉ được áp dụng khi fromTime và toTime ko được cung cấp. Field này chấp nhận giá trị như sau: 30m ,1h ,3h ,6h ,12h ,24h ,3d ,7d ,14d ,30d ,90d ,180d ,360d |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get analytic data successful.",
"data": {
"1593669600000": {
"cached": 0,
"uncached": 0
},
"1593640800000": {
"cached": 0,
"uncached": 0
},
"1593662400000": {
"cached": 371628,
"uncached": 263894
},
"1593626400000": {
"cached": 0,
"uncached": 0
},
"1593622800000": {
"cached": 0,
"uncached": 0
}
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Data trả về là 1 Map có Key là thời gian với định dạng epoch time của Unix (timezone sẽ là UTC ), Value tham khảo bảng RequestSpsDto |
RequestSpsDto |
Get speed per second
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/speed \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/speed HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
const fetch = require('node-fetch');
const inputBody = {
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/speed',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/speed',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/speed', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/speed', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/speed");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"period\": \"24h\",\n \"domains\": [\n \"fuafvhqbndweb.vcdn.cloud\",\n \"fbb3yi3uouweb.vcdn.cloud\"\n ]\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/speed", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/analytic/speed
Get speed per second
Body parameter
Successfully
{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
fromTime | string | true | Thời gian bắt đầu lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
toTime | string | true | Thời gian kết thúc lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
domains | List(string) | true | CDN domain muốn lấy report | |
period | string | true | Khoảng thời gian lấy report. Note: chỉ được áp dụng khi fromTime và toTime ko được cung cấp. Field này chấp nhận giá trị như sau: 30m ,1h ,3h ,6h ,12h ,24h ,3d ,7d ,14d ,30d ,90d ,180d ,360d |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get analytic data successful.",
"data": {
"1589414400000": {
"cdn": 57.688439899021,
"origin": 205.48882296085
},
"1584576000000": {
"cdn": 0,
"origin": 0
},
"1587600000000": {
"cdn": 12.715502664778,
"origin": 45.419444445958
},
"1590019200000": {
"cdn": 0.062671957318745,
"origin": 0.073981480749827
},
"1588204800000": {
"cdn": 35.684748839575,
"origin": 139.08597894283
},
"1588809600000": {
"cdn": 79.538004020661,
"origin": 174.98555839629
},
"1586995200000": {
"cdn": 0,
"origin": 0
},
"1580947200000": {
"cdn": 0,
"origin": 0
}
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Data trả về là 1 Map có Key là thời gian với định dạng epoch time của Unix (timezone sẽ là UTC ), Value tham khảo bảng TrafficConsunmingDto |
TrafficConsunmingDto |
Get average speed per second
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/avg-speed \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/avg-speed HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
const fetch = require('node-fetch');
const inputBody = {
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/avg-speed',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/avg-speed',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/avg-speed', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/avg-speed', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/avg-speed");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"period\": \"24h\",\n \"domains\": [\n \"fuafvhqbndweb.vcdn.cloud\",\n \"fbb3yi3uouweb.vcdn.cloud\"\n ]\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/avg-speed", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/analytic/avg-speed
Get average speed per second
Body parameter
Successfully
{
"period": "24h",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
fromTime | string | true | Thời gian bắt đầu lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
toTime | string | true | Thời gian kết thúc lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
domains | List(string) | true | CDN domain muốn lấy report | |
period | string | true | Khoảng thời gian lấy report. Note: chỉ được áp dụng khi fromTime và toTime ko được cung cấp. Field này chấp nhận giá trị như sau: 30m ,1h ,3h ,6h ,12h ,24h ,3d ,7d ,14d ,30d ,90d ,180d ,360d |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get analytic data successful.",
"data": {
"1593669600000": {
"cdn": 0,
"origin": 0
},
"1593640800000": {
"cdn": 0,
"origin": 0
},
"1593673200000": {
"cdn": 2436031.25,
"origin": 44533.33203125
},
"1593662400000": {
"cdn": 763926.56510417,
"origin": 371620.26692708
},
"1593608400000": {
"cdn": 0,
"origin": 0
},
"1593626400000": {
"cdn": 0,
"origin": 0
},
"1593622800000": {
"cdn": 0,
"origin": 0
}
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Data trả về là 1 Map có Key là thời gian với định dạng epoch time của Unix (timezone sẽ là UTC ), Value tham khảo bảng TrafficConsunmingDto |
TrafficConsunmingDto |
Get traffic for CDN in a month
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-thismonth \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"fromTime": "01/06/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-thismonth HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"fromTime": "01/06/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
const fetch = require('node-fetch');
const inputBody = {
"fromTime": "01/06/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-thismonth',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"fromTime": "01/06/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-thismonth',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"fromTime": "01/06/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-thismonth', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"fromTime": "01/06/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-thismonth', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-thismonth");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"fromTime\": \"01/06/2020\",\n \"toTime\": \"01/07/2020\",\n \"domains\": [\n \"fuafvhqbndweb.vcdn.cloud\",\n \"fbb3yi3uouweb.vcdn.cloud\"\n ]\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"fromTime": "01/06/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-thismonth", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/analytic/traffic-thismonth
Get traffic for CDN in a month
Body parameter
Successfully
{
"fromTime": "01/06/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
fromTime | string | true | Thời gian bắt đầu lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
toTime | string | true | Thời gian kết thúc lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
domains | List(string) | true | CDN domain muốn lấy report |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get analytic data successful.",
"data": {
"1593669600000": {
"cdn": 0,
"origin": 0
},
"1593640800000": {
"cdn": 0,
"origin": 0
},
"1593673200000": {
"cdn": 2436031.25,
"origin": 44533.33203125
},
"1593662400000": {
"cdn": 763926.56510417,
"origin": 371620.26692708
},
"1593608400000": {
"cdn": 0,
"origin": 0
},
"1593626400000": {
"cdn": 0,
"origin": 0
},
"1593622800000": {
"cdn": 0,
"origin": 0
}
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Data trả về là 1 Map có Key là thời gian với định dạng epoch time của Unix (timezone sẽ là UTC ), Value tham khảo bảng TrafficTotalDto |
TrafficTotalDto |
Get CDN traffic report
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-report \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-report HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
const fetch = require('node-fetch');
const inputBody = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-report',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-report',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-report', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-report', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-report");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"fromTime\": \"01/03/2020\",\n \"toTime\": \"01/07/2020\",\n \"domains\": [\n \"fuafvhqbndweb.vcdn.cloud\",\n \"fbb3yi3uouweb.vcdn.cloud\"\n ]\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/traffic-report", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/analytic/traffic-report
Get CDN traffic report
Body parameter
Successfully
{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
fromTime | string | true | Thời gian bắt đầu lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
toTime | string | true | Thời gian kết thúc lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
domains | List(string) | true | CDN domain muốn lấy report |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get analytic data successful.",
"data": [
{
"data": {
"1583020800000": 0,
"1583107200000": 0,
"1583193600000": 0,
"1583280000000": 0,
"1587772800000": 0,
"1587859200000": 0,
"1587945600000": 0,
"1588377600000": 0,
"1588464000000": 0,
"1588550400000": 853486,
"1588636800000": 1353918,
"1588723200000": 490363,
"1588809600000": 0,
"1588896000000": 1055926,
"1590278400000": 0,
"1593388800000": 0,
"1593475200000": 0,
"1593561600000": 0
},
"domainName": "abc.com.vn"
},
{
"data": {
"1583020800000": 0,
"1583107200000": 0,
"1593388800000": 0,
"1593475200000": 0,
"1593561600000": 0
},
"domainName": "def.vn"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Data trả về là 1 Map có Key là thời gian với định dạng epoch time của Unix (timezone sẽ là UTC ), Value tham khảo bảng TrafficTotalDto |
TrafficReportDto |
Get cache status data
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cache-status \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cache-status HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
const fetch = require('node-fetch');
const inputBody = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cache-status',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cache-status',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cache-status', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cache-status', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cache-status");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"fromTime\": \"01/03/2020\",\n \"toTime\": \"01/07/2020\",\n \"domains\": [\n \"fuafvhqbndweb.vcdn.cloud\",\n \"fbb3yi3uouweb.vcdn.cloud\"\n ]\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cache-status", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/analytic/cache-status
Get cache status data
Body parameter
Successfully
{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
fromTime | string | true | Thời gian bắt đầu lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
toTime | string | true | Thời gian kết thúc lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
domains | List(string) | true | CDN domain muốn lấy report | |
period | string | true | Khoảng thời gian lấy report. Note: chỉ được áp dụng khi fromTime và toTime ko được cung cấp. Field này chấp nhận giá trị như sau: 30m ,1h ,3h ,6h ,12h ,24h ,3d ,7d ,14d ,30d ,90d ,180d ,360d |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get analytic data successful.",
"data": "{\"hit\":73,\"bypass\":187,\"revalidated\":4,\"miss\":2074,\"expired\":23}"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Check cache status của CDN | string |
Get CDN http codes data
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-http-codes \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"period": "180d",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-http-codes HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"period": "180d",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
const fetch = require('node-fetch');
const inputBody = {
"period": "180d",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-http-codes',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"period": "180d",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-http-codes',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"period": "180d",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-http-codes', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"period": "180d",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-http-codes', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-http-codes");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"period\": \"180d\",\n \"domains\": [\n \"fuafvhqbndweb.vcdn.cloud\",\n \"fbb3yi3uouweb.vcdn.cloud\"\n ]\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"period": "180d",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/cdn-http-codes", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/analytic/cdn-http-codes
Get CDN http codes data
Body parameter
Successfully
{
"period": "180d",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
fromTime | string | true | Thời gian bắt đầu lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
toTime | string | true | Thời gian kết thúc lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
domains | List(string) | true | CDN domain muốn lấy report | |
period | string | true | Khoảng thời gian lấy report. Note: chỉ được áp dụng khi fromTime và toTime ko được cung cấp. Field này chấp nhận giá trị như sau: 30m ,1h ,3h ,6h ,12h ,24h ,3d ,7d ,14d ,30d ,90d ,180d ,360d |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get analytic data successful.",
"data": "{\"404\":3,\"500\":4933,\"503\":4,\"499\":3,\"400\":10,\"301\":8,\"409\":18,\"200\":2277,\"403\":4}"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Số lượng http status code xuất hiện trong lúc CDN sử dụng | string |
Get origin http code data
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-http-codes \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-http-codes HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
}
const fetch = require('node-fetch');
const inputBody = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-http-codes',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-http-codes',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-http-codes', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-http-codes', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-http-codes");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"fromTime\": \"01/03/2020\",\n \"toTime\": \"01/07/2020\",\n \"domains\": [\n \"fuafvhatndfweb.vcdn.cloud\",\n \"foouwnltwdweb.vcdn.cloud\"\n ]\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/origin-http-codes", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/analytic/origin-http-codes
Get origin http code data
Body parameter
Successfully
{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhatndfweb.vcdn.cloud",
"foouwnltwdweb.vcdn.cloud"
]
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
fromTime | string | true | Thời gian bắt đầu lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
toTime | string | true | Thời gian kết thúc lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
domains | List(string) | true | CDN domain muốn lấy report | |
period | string | true | Khoảng thời gian lấy report. Note: chỉ được áp dụng khi fromTime và toTime ko được cung cấp. Field này chấp nhận giá trị như sau: 30m ,1h ,3h ,6h ,12h ,24h ,3d ,7d ,14d ,30d ,90d ,180d ,360d |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get analytic data successful.",
"data": "{\"404\":3,\"500\":4933,\"503\":4,\"499\":3,\"400\":10,\"301\":8,\"409\":18,\"200\":2277,\"403\":4}"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Số lượng http status code xuất hiện khi request đến Origin | string |
Get country traffic
Code samples
# You can also use wget
curl -X POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/country-traffic \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}'
POST https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/country-traffic HTTP/1.1
Host: vcdn-api.vngcloud.vn
Content-Type: application/json
Accept: application/json
{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
const fetch = require('node-fetch');
const inputBody = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer <YOUR_API_KEY>'
};
fetch('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/country-traffic',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>'
}
body = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
result = RestClient.post 'https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/country-traffic',
params: {
}, headers: headers, payload: body
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>'
}
body = {
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
r = requests.post('https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/country-traffic', headers = headers, data = body)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer <YOUR_API_KEY>',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = json_decode('{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}');
try {
$response = $client->request('POST','https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/country-traffic', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/country-traffic");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
String jsonBodyStr = "{\n \"fromTime\": \"01/03/2020\",\n \"toTime\": \"01/07/2020\",\n \"domains\": [\n \"fuafvhqbndweb.vcdn.cloud\",\n \"fbb3yi3uouweb.vcdn.cloud\"\n ]\n}";
try (OutputStream outputStream = httpURLConnection.getOutputStream()) {
outputStream.write(jsonBodyStr.getBytes());
outputStream.flush();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer <YOUR_API_KEY>"},
}
var jsonStr = []byte(`{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}`)
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://vcdn-api.vngcloud.vn/vcdn-api/v1/analytic/country-traffic", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /v1/analytic/country-traffic
Get country traffic
Body parameter
Successfully
{
"fromTime": "01/03/2020",
"toTime": "01/07/2020",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
fromTime | string | true | Thời gian bắt đầu lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
toTime | string | true | Thời gian kết thúc lấy report. Format sẽ là dd/mm/yyyy hh:mm |
|
domains | List(string) | true | CDN domain muốn lấy report | |
period | string | true | Khoảng thời gian lấy report. Note: chỉ được áp dụng khi fromTime và toTime ko được cung cấp. Field này chấp nhận giá trị như sau: 30m ,1h ,3h ,6h ,12h ,24h ,3d ,7d ,14d ,30d ,90d ,180d ,360d |
Example responses
Status 200
{
"success": true,
"code": 200,
"message": "Get analytic data successful.",
"data": {
"Viet Nam": 2331
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Lấy traffic theo từng quốc gia | number |
Schemas
RequestSpsDto
{
"cached": 0.0012599206422382,
"uncached": 0.0041269841380343
}
Properties
Name | Type | Required | Description |
---|---|---|---|
cached | number(double) | false | Số lượng request/s thông qua CDN |
uncached | number(double) | false | Số lượng request/s đến Origin |
AnalyticRequest
{
"period": "180d",
"domains": [
"fuafvhqbndweb.vcdn.cloud",
"fbb3yi3uouweb.vcdn.cloud"
]
}
Properties
Name | Type | Required | Description |
---|---|---|---|
fromTime | string | true | Thời gian bắt đầu lấy report. Format sẽ là dd/mm/yyyy hh:mm |
toTime | string | true | Thời gian kết thúc lấy report. Format sẽ là dd/mm/yyyy hh:mm |
domains | List(string) | true | CDN domain muốn lấy report |
period | string | true | Khoảng thời gian lấy report. Note: chỉ được áp dụng khi fromTime và toTime ko được cung cấp. Field này chấp nhận giá trị như sau: 30m ,1h ,3h ,6h ,12h ,24h ,3d ,7d ,14d ,30d ,90d ,180d ,360d |
TrafficConsunmingDto
{
"cdn": 763926.56510417,
"origin": 371620.26692708
}
Properties
Name | Type | Required | Description |
---|---|---|---|
cdn | number(double) | false | Dung lượng băng thông CDN sử dụng |
origin | number(double) | false | Dung lượng băng thông Origin sử dụng |
TrafficTotalDto
{
"cdn": 2436031.25,
"origin": 44533.33203125
}
Properties
Name | Type | Required | Description |
---|---|---|---|
data | object | false | Lượng data sử dụng từng ngày |
total | number(double) | false | Tổng data sử dụng trong 1 tháng |
TrafficRequest
{
"period": "180d",
"domains": [
"facdsndweb.vcdn.cloud"
]
}
Properties
Name | Type | Required | Description |
---|---|---|---|
fromTime | string | true | Thời gian bắt đầu lấy report. Format sẽ là dd/mm/yyyy hh:mm |
toTime | string | true | Thời gian kết thúc lấy report. Format sẽ là dd/mm/yyyy hh:mm |
domains | List(string) | true | CDN domain muốn lấy report |
TrafficReportDto
{
"data": {
"1583020800000": 0,
"1583107200000": 0,
"1583193600000": 0,
"1583280000000": 0,
"1587772800000": 0,
"1587859200000": 0,
"1587945600000": 0,
"1588377600000": 0,
"1588464000000": 0,
"1588550400000": 853486,
"1588636800000": 1353918,
"1588723200000": 490363,
"1588809600000": 0,
"1588896000000": 1055926,
"1590278400000": 0,
"1593388800000": 0,
"1593475200000": 0,
"1593561600000": 0
},
"domainName": "abc.com.vn"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
data | object | false | Data trả về là 1 Map có key là Date với định dạng epoch của Unix , Value là dung lượng băng thông CDN sử dụng tại 1 thời điểm đơn vị là Byte |
domainName | string | false | Domain của CDN lấy report |
ApiKey
{
"apiKeyId": 1,
"userEmail": "abc@gmail.com",
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z",
"createTime": "2020-08-10T04:24:35Z",
"updateTime": "2020-08-10T04:24:35Z"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
apiKeyId | integer(int32) | false | Id của API Key được tạo ra từ hệ thống |
userEmail | string | false | Email của user |
token | string | false | Giá trị của API Key |
expiredDate | string(date-time) | false | Ngày hết hạn của API Key |
createTime | string(date-time) | false | Thời gian tạo API Key |
updateTime | string(date-time) | false | thời gian cập nhật API Key |
JwtRequest
{
"token": "eyJhbGcLWioUzUxMiw",
"expiredDate": "2020-08-10T04:24:35Z"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
token | string | false | Giá trị API Key cần cập nhật |
expiredDate | string(date-time) | false | Ngày hết hạn |
SingleResponse
{
"success": true,
"code": 0,
"message": "string",
"data": {}
}
Properties
Name | Type | Required | Description |
---|---|---|---|
success | boolean | false | none |
code | integer(int32) | false | none |
message | string | false | none |
data | object | false | none |
BaseResponse
{
"success": true,
"code": 0,
"message": "string"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
success | boolean | false | none |
code | integer(int32) | false | none |
message | string | false | none |
FlushCacheRequest
{
"cdnDomain": "abcdvod.vcdn.cloud",
"patterns": [
"abcd",
"efgh"
],
"type": "BEGIN"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
cdnDomain | string | false | CDN domain cần flush cache |
patterns | List(string) | false | List String các pattern cần flush cache |
type | string | false | một trong các gía trị sau [ALL , URI , BEGIN , END , CONTAIN ]+ Khi type là BEGIN , END , CONTAIN chỉ cho phép nhập 1 pattern, hỗ trợ nhập dấu * .+ Khi type là ALL , giá trị pattern là empty list. + Khi tyle là URI , cho phép nhập nhiều giá trị nhưng không hỗ trợ dấu * |
CdnSslcertificateDto
{
"cdnSslcertificateId": "certificate id",
"caRoot": "caroot value after decode",
"cdnUsing": 2,
"certificate": "certificate value after decode",
"cname": "abc",
"commonName": "def",
"expiresOn": "17 Mar 2020 02:39:24 GMT",
"issuer": "Let's Encrypt Authority X3 Let's Encrypt US",
"privateKey": "private key value after decode",
"status": 1,
"createdTime": "2020-05-28T10:24:32.000+0000",
"deletedTime": null,
"updatedTime": null,
"userUuid": "userid",
"createdUser": "userid",
"updatedUser": null,
"deletedUser": null
}
Properties
Name | Type | Required | Description |
---|---|---|---|
cdnSslcertificateId | string | false | Id của certificate được tạo ra từ hệ thống |
caRoot | string | false | CA root của certificate |
cdnUsing | integer(int32) | false | Số lượng CDN đang xử dụng certificate này |
certificate | string | false | Giá trị của certificate |
cname | string | false | Cname của certificate |
commonName | string | false | Common name của certificate |
expiresOn | string | false | Ngày hết hạn của certificate |
issuer | string | false | Tổ chức cung cấp certificate |
privateKey | string | false | Private key của certificate |
validFrom | string | false | Ngày bắt đầu có hiệu lực của certificate |
status | integer(int32) | false | Status của certificate: 0 inactive và 1 active |
createdTime | string(date-time) | false | Ngày tạo certificate |
deletedTime | string(date-time) | false | Ngày xóa certificate |
updatedTime | string(date-time) | false | Ngày cập nhật của certificate |
userUuid | string | false | Id của user tạo certificate này |
WebCertificateRequest
{
"idCert": "9f290429-baa0-4e59-88fb-20f749c0b02b",
"status": 1,
"privateKey": "-----BEGIN PRIVATE KEY-----\nMIIJQwIBADANBgkqhkiG9\n-----END PRIVATE KEY-----",
"certificate": "-----BEGIN CERTIFICATE-----\nMIIFEjCCA\n-----END CERTIFICATE-----",
"caRoot": "-----BEGIN CERTIFICATE-----\nMIIEKTCCAxGgAwIBAgIUU\n-----END CERTIFICATE-----"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
idCert | string | false | null (khi tạo mới) hoặc id của certificate |
cdnUsing | integer(int32) | false | none |
privateKey | string | false | giá trị private key |
certificate | string | false | giá trị certificate |
caRoot | string | false | giá trị caRoot |
status | integer(int32) | false | status: 1 (active), 0 (inactive) |
AddCorsBehavior
{
"id": "0c6a88aa-2e6d-4718-b62a-414cdf07a8a9",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | addCors |
value | CorsConfigBehavior | true | Chỉ support Object Download và Video on Demand |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | CorsConfigBehavior | false | Chỉ support Object Download và Video on Demand |
AlwaysHttpsBehavior
{
"id": "af5495a6-821a-45f0-b005-810bbdea9b95",
"actionName": "alwaysHttps",
"value": "on",
"order": 0
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | alwaysHttps |
value | string | true | Một trong các giá trị sau : + on + off |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | string | false | none |
BaseDirectoryBehavior
{
"id": "6b9bc91b-38bf-4583-a376-1798a6859375",
"actionName": "baseDirectory",
"value": "{\"origin_directory_value\":\"/abcd\"}",
"order": 13
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | baseDirectory |
value | BaseDirectoryValue | true | none |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | BaseDirectoryValue | false | none |
BaseDirectoryValue
{
"origin_directory_value": "/abcd"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
origin_directory_value | string | false | giá trị là một uri, bắt đầu bằng dấu /. |
BrotliBehavior
{
"id": "29a3eb4b-386e-48d4-b2ee-be3ca6c3a0a1",
"actionName": "brotliResponse",
"value": "on",
"order": 0
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | brotliResponse |
value | boolean | true | Một trong các giá trị sau : + on + off |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | boolean | false | none |
BrowserCacheBehavior
{
"id": "4cf731c9-46db-4c6a-aab7-9d2f64ad093b",
"actionName": "browserCache",
"value": "1M",
"order": 0
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | browserCache |
value | string | true | Khoảng thời gian browser cache Các giá trị trong dãy sau: same_as_origin ,30m ,1h ,2h ,3h ,4h ,5h ,6h ,8h ,12h ,20h ,1d ,2d ,3d ,4d ,5d ,6d ,1w ,2w ,3w ,1M ,2M ,3M ,4M ,5M ,6M ,1y |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | string | false | none |
ByPassByCookieBehavior
{
"id": "5c682156-3f00-43a9-bf0d-3a4334eeec5e",
"actionName": "byPassByCookies",
"value": "{\"cookie_value\":\"def\",\"cookie_name\":\"abcd\"}",
"order": 7
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | byPassByCookies |
value | ByPassByCookieValue | true | none |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | ByPassByCookieValue | false | none |
ByPassByCookieValue
{
"cookie_value": "def",
"cookie_name": "abcd"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
cookie_value | string | false | Cho phép nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ |
cookie_name | string | false | Cho phép nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ |
CacheByDeviceType
{
"id": "0f2a7dfa-2e24-43d9-80f3-c3a4972f13f8",
"actionName": "cacheByDeviceType",
"value": "[\"atest\"]",
"order": 8
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | byPassByCookies |
value | string | true | Giá trị cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | string | false | none |
CacheLevelBehavior
{
"id": "fd003176-9b86-4ff1-b39d-a445a118ac9c",
"actionName": "cacheLevel",
"value": "3",
"order": 0
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | cacheLevel |
value | string | true | Tùy chọn Cache level 1 : URL Without Query String Only2 : Skip Query String of URL3 : URL With Query String |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | string | false | none |
CorsConfigBehavior
{
"configType": "advanced",
"allowOrigin": [
"*"
],
"allowHeader": [
"header1",
"header2"
],
"allowMethod": [
"GET",
"POST"
],
"exposeHeader": [
"header3",
"header4"
]
}
Chỉ support Object Download và Video on Demand
Properties
Name | Type | Required | Description |
---|---|---|---|
configType | string | true | Kiểu config type sử dụng. + Nhập một trong 2 giá trị : simple hoặc advance . + Khi giá trị là simple thì chỉ nhận giá trị c trường ủa allow Origin , các trường khác mặc định là empty |
allowOrigin | List(string) | false | Danh sách các origin cho phép. Giá trị của origin phải là 1 url đầy đủ hoặc nhập dấu * thay thế. Default gửi empty . |
allowHeader | List(string) | false | Danh sách các header cho phép. Chỉ hỗ trợ khi config type là advanced, cho phép nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ Default gửi empty list. |
allowMethod | List(string) | false | Danh sách các method cho phép. Chỉ hỗ trợ khi config type là advanced, nhập một hay nhiều giá trị trong dãy sau: GET, HEAD, POST, PUT, DELETE, OPTIONS, PATCH . Default gửi empty list. |
exposeHeader | List(string) | false | Danh sách các header expose. Chỉ hỗ trợ khi config type là advanced, cho phép nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ . Default gửi empty list. |
DenyAccessBehavior
{
"id": "2e6b3439-804c-4b20-9f63-3ab3f6c747d5",
"actionName": "denyAccess",
"value": "{\"reason\":\"test\",\"enabled\":\"true\"}",
"order": 1
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | denyAccess |
value | DenyAccessValue | true | none |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | DenyAccessValue | false | none |
DenyAccessValue
{
"reason": "test",
"enabled": true
}
Properties
Name | Type | Required | Description |
---|---|---|---|
reason | string | false | Lý do chặn request |
enabled | boolean | false | Bật/Tắt chức năng access deny |
DevelopmentModeBehavior
{
"id": "f79c7d11-e5f3-4fcf-b457-4520978e0bc1",
"actionName": "developmentMode",
"value": "on",
"order": 0
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | developmentMode |
value | string | true | Một trong các giá trị sau : + on + off |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | string | false | none |
GzipBehavior
{
"id": "01afefe2-d9af-4dde-9d33-ab6e0f37fcad",
"actionName": "gzipResponse",
"value": "on",
"order": 11
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | gzipResponse |
value | string | true | Một trong các giá trị sau : + on + off |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | string | false | none |
HeaderOverrideBehavior
{
"id": "99b7d27b-6e62-4489-b864-ffe8f2cfa66c",
"actionName": "headerOverride",
"value": "{\"header_value\":\"tes\",\"header_name\":\"abt\"}",
"order": 9
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | headerOverride |
value | HeaderOverrideValue | true | none |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | HeaderOverrideValue | false | none |
HeaderOverrideValue
{
"header_key": "test",
"header_value": "vavavava"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
header_key | string | false | Cho phép nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ |
header_value | string | false | Cho phép nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ |
HstsBehavior
{
"id": "cc9aac52-76ad-45b7-acb9-442d2eb957f0",
"actionName": "hsts",
"value": "{\"hsts\":\"on\",\"preload\":\"on\",\"includeSubDomains\":\"on\",\"maxAge\":\"1y\"}",
"order": 0
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | hsts |
value | HstsBehaviorValue | true | none |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | HstsBehaviorValue | false | none |
HstsBehaviorValue
{
"hsts": "on",
"preload": "on",
"includeSubDomains": "on",
"maxAge": "1y"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
hsts | string | false | Tùy chọn hỗ trợ hsts . Giá trị nhập vào sẽ là: on , off |
preload | string | false | Tùy chọn preload configuration của hsts . Giá trị nhập vào sẽ là: on , off " |
includeSubDomains | string | false | Tùy chọn các sub domain sử dụng hsts . Một trong các giá trị sau: on , off " |
maxAge | string | false | Tùy chọn khoảng gian cache trên browser. Giá trị nhập vào sẽ là: 0 ,30m ,1h ,2h ,3h ,4h ,5h ,8h ,12h ,16h ,20h ,1d ,2d ,3d ,4d ,5d ,6d ,1w ,2w ,3w ,1M ,2M ,3M ,4M ,5M ,6M ,1y |
ImgOptimizeBehavior
{
"id": "9146e82a-27db-4ce6-8310-a9e852640298",
"actionName": "imgOptimize",
"value": "on",
"order": 0
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | imgOptimize |
value | string | true | Một trong các giá trị sau : + on + off |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | string | false | none |
MinimumTlsBehavior
{
"id": "22748f0e-df58-4ace-9ffb-bcf7ee8a00cb",
"actionName": "minimumTls",
"value": "TLS 1.2",
"order": 0
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | minimumTls |
value | List(string) | true | Một trong các giá trị sau : + TLS 1.0 + TLS 1.1 + TLS 1.2 + TLS 1.3 |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | List(string) | false | none |
NoSniffBehavior
{
"id": "93272253-e398-4f05-bc4c-c35110e1a920",
"actionName": "nosniff",
"value": "on",
"order": 0
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | nosniff |
value | string | true | Một trong các giá trị sau : + on + off |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | string | false | none |
ObjectDownloadResponse
{
"s3Origin": {
"cdnUpstreamId": "2e6b3439-804c-4b20-9f63-3ab3f6c747d5",
"cdnId": "2e6b3439-804c-4b20-9f63-3ab3f6c747d5",
"accessKey": "s3AccessKey",
"secretKey": "s3SecretKey",
"bucket": "bucket-name",
"region": "us-west-2",
"endpoint": "/path-name",
"version": "v4"
},
"useSsl": false,
"type": "obj-download",
"originHostHeader": "google.com",
"upstreams": [
{
"cdnUpstreamId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703",
"cdnId": "5527a5f2-ef6e-420c-b70a-6286eb3a1104",
"priority": 10,
"ipaddress": "1.1.1.1:8080",
"status": 0
}
],
"lbType": "rr",
"failOverErrorCode": [
403,
404,
429,
500
],
"cdnDomain": "cdnDomain",
"cdnId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703",
"domainName": "google.com",
"cName": "[aaa.google.com.vn, bbb.google.com.vn]",
"status": 1,
"defaultRuleAction": [
{
"id": "0c6a88aa-2e6d-4718-b62a-414cdf07a8a9",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
}
],
"childrenRule": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"userUuid": "2e6b3439-804c-4b20-9f63-3ab3f6c23232"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
s3Origin | S3OriginDto | false | Chỉ áp dụng cho Object Download và Video On Demand CDN |
useSsl | boolean | false | Điều chỉnh việc sử dụng ssl cho http origin hay không. |
type | string | false | obj-download |
originHostHeader | string | false | Origin host header cần tạo hay edit |
upstreams | List(UpStreamDto) | true | Danh sách các upstream của CDN. |
lbType | string | true | Load balance type của origin + rr Round robin+ lc Least Connected+ iph IP Hashing |
failOverErrorCode | List(string) | true | List string một hoặc nhiều giá trị trong dãy sau:403, 404, 429, 500, 502, 503, 504 |
cdnDomain | string | true | Domain của CDN được tạo ra bởi hệ thống. |
cdnId | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create CDN: null hay empty + Update CDN: Id của CDN cần update |
domainName | string | true | Tên domain name của CDN cần tạo hay edit, - Nếu tạo Web Accelerator CDN phải thỏa các điều kiện sau: + Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang (-) và dấu chấm . + Đầu và đuôi từng thành phần (phân cách bởi dấu chấm (.) ) không được xuất hiện ký tự đặc biệt (-) .+ Được phép 2 dấu gạch ngang liên tiếp (--) nhưng không được 2 dấu chấm liên tiếp (..) - Nếu tạo các CDN khác thì thỏa điều kiện sau: + Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ |
cName | List(string) | false | Danh sách các domain name thay thế của CDN |
status | integer(int32) | true | Status của CDN:0 : DISABLED1 : ENABLED2 : DELETED3 : DEPLOYING4 : DELETING5 : DISABLING6 : SUSPENDING |
defaultRuleAction | List(RuleAction) | true | Những rule behavior default bắt buộc của từng loại CDN |
childrenRule | List(PageRule) | false | Danh sách các rule và behavior tùy chọn |
userUuid | string | true | UUID của User sở hữu CDN. |
OriginOverrideBehavior
{
"id": "4b801100-94ba-4e56-8390-5c0eff727096",
"actionName": "originOverride",
"value": "{\"ip_address\":\"2.2.2.2\"}",
"order": 12
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | originOverride |
value | OriginOverrideValue | true | none |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | OriginOverrideValue | false | none |
OriginOverrideValue
{
"ip_address": "1.1.1.1"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
ip_address | string | false | Giá trị là format Ipv4 |
PageRule
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
Tất cả các loại CDN
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create cdnRule: null hay empty + Update cdnRule: Id của cdnRule cần Update + Delete rule: Những Id của cdnRule đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
order | integer(int32) | true | Thứ tự của rule. |
urlPattern | List(string) | true | Điều kiện url để thực hiện các rule behavior. Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ |
actions | List(RuleAction) | true | Các behavior tùy chọn cho rule. Xem bảng RuleAction |
status | integer(int32) | true | Status của rule + Status: 0 (Disabled) + Status: 1 (Enabled) |
RedirectBehavior
{
"id": "a147f64c-24bb-4162-8ee7-2c297792d7af",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://zingnews.vn/\"}",
"order": 1
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | redirect |
value | RedirectValue | true | Khi dùng rule redirect thì sẽ không được chọn các rule khác, các behavior khác sẽ bị xóa đi. |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | RedirectValue | false | Khi dùng rule redirect thì sẽ không được chọn các rule khác, các behavior khác sẽ bị xóa đi. |
RedirectValue
{
"code": "302",
"url": "302"
}
Khi dùng rule redirect thì sẽ không được chọn các rule khác, các behavior khác sẽ bị xóa đi.
Properties
Name | Type | Required | Description |
---|---|---|---|
code | string | false | Giá trị cho phép nhập gồm 301 hoặc 302 |
url | string | false | giá trị là một url đầy đủ bắt đầu bằng http(s):// |
RewriteHttpsBehavior
{
"id": "b3420658-177f-4036-86ba-40bcdcf74680",
"actionName": "rewriteHttps",
"value": "on",
"order": 0
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | rewriteHttps |
value | string | true | Một trong các giá trị sau : + on + off |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | string | false | none |
RuleAction
{
"id": "0c6a88aa-2e6d-4718-b62a-414cdf07a8a9",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
}
Tất cả các loại CDN
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | Tên của rule action |
value | object | true | Xem các loại action ở bên dưới |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | object | false | none |
addCors
Name | Type | Required | Description |
---|---|---|---|
addCors | AddCorsBehavior | false | none |
alwaysHttps
Name | Type | Required | Description |
---|---|---|---|
alwaysHttps | AlwaysHttpsBehavior | false | none |
baseDirectory
Name | Type | Required | Description |
---|---|---|---|
baseDirectory | BaseDirectoryBehavior | false | none |
brotliResponse
Name | Type | Required | Description |
---|---|---|---|
brotliResponse | BrotliBehavior | false | none |
browserCache
Name | Type | Required | Description |
---|---|---|---|
browserCache | BrowserCacheBehavior | false | none |
byPassByCookies
Name | Type | Required | Description |
---|---|---|---|
byPassByCookies | ByPassByCookieBehavior | false | none |
cacheByDeviceType
Name | Type | Required | Description |
---|---|---|---|
cacheByDeviceType | CacheByDeviceType | false | none |
cacheLevel
Name | Type | Required | Description |
---|---|---|---|
cacheLevel | CacheLevelBehavior | false | none |
denyAccess
Name | Type | Required | Description |
---|---|---|---|
denyAccess | DenyAccessBehavior | false | none |
developmentMode
Name | Type | Required | Description |
---|---|---|---|
developmentMode | DevelopmentModeBehavior | false | none |
imgOptimize
Name | Type | Required | Description |
---|---|---|---|
imgOptimize | ImgOptimizeBehavior | false | none |
hsts
Name | Type | Required | Description |
---|---|---|---|
hsts | HstsBehavior | false | none |
headerOverride
Name | Type | Required | Description |
---|---|---|---|
headerOverride | HeaderOverrideBehavior | false | none |
gzipResponse
Name | Type | Required | Description |
---|---|---|---|
gzipResponse | GzipBehavior | false | none |
minimumTls
Name | Type | Required | Description |
---|---|---|---|
minimumTls | MinimumTlsBehavior | false | none |
nosniff
Name | Type | Required | Description |
---|---|---|---|
nosniff | NoSniffBehavior | false | none |
originOverride
Name | Type | Required | Description |
---|---|---|---|
originOverride | OriginOverrideBehavior | false | none |
redirect
Name | Type | Required | Description |
---|---|---|---|
redirect | RedirectBehavior | false | none |
rewriteHttps
Name | Type | Required | Description |
---|---|---|---|
rewriteHttps | RewriteHttpsBehavior | false | none |
serverCache
Name | Type | Required | Description |
---|---|---|---|
serverCache | ServerCacheBehavior | false | none |
S3OriginDto
{
"cdnUpstreamId": "2e6b3439-804c-4b20-9f63-3ab3f6c747d5",
"cdnId": "2e6b3439-804c-4b20-9f63-3ab3f6c747d5",
"accessKey": "s3AccessKey",
"secretKey": "s3SecretKey",
"bucket": "bucket-name",
"region": "us-west-2",
"endpoint": "/path-name",
"version": "v4"
}
Chỉ áp dụng cho Object Download và Video On Demand CDN
Properties
Name | Type | Required | Description |
---|---|---|---|
cdnUpstreamId | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create s3Origin: null hay empty + Update upstream: Id của Upstream cần update+ Delete s3Origin: Những id của upstream đã tạo không được gửi xuống khi update thì sẽ bị xóa đi. |
cdnId | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create CDN: null hay empty + Update CDN: Id của CDN cần update |
accessKey | string | true | Access key của s3 origin Cho phép nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ , giới hạn 1024 kí tự |
secretKey | string | true | Secret key của s3 origin Cho phép nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ , giới hạn 1024 kí tự |
bucket | string | true | Bucket của s3 origin Cho phép user nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: -_ , giới hạn 255 kí tự |
region | string | true | Region của s3 origin Cho phép user nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: -_ , giới hạn 255 kí tự |
endpoint | string | true | Endpoint của s3 origin Giá trị cho phép nhập tương đương domain name |
version | string | true | Version của s3 origin Nhập một trong các giá trị sau: v2 hay v4 . |
ServerCacheBehavior
{
"id": "dff315f4-5aed-41d8-b3d0-64adb4231df2",
"actionName": "serverCache",
"value": "1d",
"order": 0
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create ruleAction: null hay empty + Update ruleAction: Id của RuleAction cần Update + Delete ruleAction: Những Id của ruleAction đã tạo không được gửi xuống khi Update thì sẽ bị xóa đi. |
actionName | string | true | serverCache |
value | string | true | + Một trong các giá trị cho phép tương ứng với gói package của user khi tạo CDN Web-Acc. Tham khảo thông tin ở dưới + Enterprise : > 30m+ Business : > 12h+ Pro : > 1d+ Basic : > 3d |
order | integer(int32) | true | Thứ tự của rule action |
objectValue | string | false | none |
UpStreamDto
{
"cdnUpstreamId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703",
"cdnId": "5527a5f2-ef6e-420c-b70a-6286eb3a1104",
"priority": 10,
"ipaddress": "1.1.1.1:8080",
"status": 0
}
Danh sách các "upstream" của CDN.
Properties
Name | Type | Required | Description |
---|---|---|---|
cdnUpstreamId | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create upstream: null hay empty + Update upstream: Id của Upstream cần update + Delete upstream: Những id của upstream đã tạo không được gửi xuống khi update thì sẽ bị xóa đi. |
cdnId | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create CDN: null hay empty + Update CDN: Id của CDN cần update |
priority | integer(int32) | true | Độ ưu tiên của origin upstream Giá trị số từ 1-100 .Khi giá trị bằng 0 thì load balance type của upstream sẽ chuyển sang backup |
ipaddress | string | true | IpV4 của origin upstream Giá trị theo format IpV4 (1.1.1.1) .Với CDN Vod và Obj, cho phép nhập port. (1.1.1.1:8080) |
status | integer(int32) | true | Status của upstream cần tạo hay update + Status: 0 (Disabled)+ Status: 1 (Enabled) |
ObjectDownloadRequest
{
"type": "obj-download",
"s3Origin": {
"cdnUpstreamId": "2e6b3439-804c-4b20-9f63-3ab3f6c747d5",
"cdnId": "2e6b3439-804c-4b20-9f63-3ab3f6c747d5",
"accessKey": "s3AccessKey",
"secretKey": "s3SecretKey",
"bucket": "bucket-name",
"region": "us-west-2",
"endpoint": "/path-name",
"version": "v4"
},
"useSsl": false,
"originHostHeader": "google.com",
"upstreams": [
{
"cdnUpstreamId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703",
"cdnId": "5527a5f2-ef6e-420c-b70a-6286eb3a1104",
"priority": 10,
"ipaddress": "1.1.1.1:8080",
"status": 0
}
],
"lbType": "rr",
"failOverErrorCode": [
403,
404,
429,
500
],
"cdnDomain": "cdnDomain",
"cdnId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703",
"domainName": "google.com",
"cName": "[aaa.google.com.vn, bbb.google.com.vn]",
"status": 1,
"defaultRuleAction": [
{
"id": "0c6a88aa-2e6d-4718-b62a-414cdf07a8a9",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
}
],
"childrenRule": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"sslId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
type | string | false | Type là obj-download |
s3Origin | S3OriginDto | false | Chỉ áp dụng cho Object Download và Video On Demand CDN |
useSsl | boolean | false | Điều chỉnh việc sử dụng ssl cho http origin hay không. |
originHostHeader | string | false | Origin host header cần tạo hay edit |
upstreams | List(UpStreamDto) | true | Danh sách các upstream của CDN. |
lbType | string | true | Load balance type của origin + rr Round robin+ lc Least Connected+ iph IP Hashing |
failOverErrorCode | List(string) | true | List string một hoặc nhiều giá trị trong dãy sau:403, 404, 429, 500, 502, 503, 504 |
cdnDomain | string | true | Domain của CDN được tạo ra bởi hệ thống. |
cdnId | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create CDN: null hay empty + Update CDN: Id của CDN cần update |
domainName | string | true | Tên domain name của CDN cần tạo hay edit, - Nếu tạo Web Accelerator CDN phải thỏa các điều kiện sau: + Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang (-) và dấu chấm . + Đầu và đuôi từng thành phần (phân cách bởi dấu chấm (.) ) không được xuất hiện ký tự đặc biệt (-) .+ Được phép 2 dấu gạch ngang liên tiếp (--) nhưng không được 2 dấu chấm liên tiếp (..) - Nếu tạo các CDN khác thì thỏa điều kiện sau: + Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ |
cName | List(string) | false | Danh sách các domain name thay thế của CDN |
status | integer(int32) | true | Status của CDN:0 : DISABLED1 : ENABLED2 : DELETED3 : DEPLOYING4 : DELETING5 : DISABLING6 : SUSPENDING |
defaultRuleAction | List(RuleAction) | true | Những rule behavior default bắt buộc của từng loại CDN |
childrenRule | List(PageRule) | false | Danh sách các rule và behavior tùy chọn |
sslId | string | true | Id của certificate |
BaseCdnInfo
{
"cdnDomain": "cdnDomain",
"cdnId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703",
"domainName": "google.com",
"cName": "[aaa.google.com.vn, bbb.google.com.vn]",
"status": 1
}
Properties
Name | Type | Required | Description |
---|---|---|---|
cdnDomain | string | true | Domain của CDN được tạo ra bởi hệ thống. |
cdnId | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create CDN: null hay empty + Update CDN: Id của CDN cần update |
domainName | string | true | Tên domain name của CDN cần tạo hay edit, - Nếu tạo Web Accelerator CDN phải thỏa các điều kiện sau: + Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang (-) và dấu chấm . + Đầu và đuôi từng thành phần (phân cách bởi dấu chấm (.) ) không được xuất hiện ký tự đặc biệt (-) .+ Được phép 2 dấu gạch ngang liên tiếp (--) nhưng không được 2 dấu chấm liên tiếp (..) - Nếu tạo các CDN khác thì thỏa điều kiện sau: + Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ |
cName | List(string) | false | Danh sách các domain name thay thế của CDN |
status | integer(int32) | true | Status của CDN:0 : DISABLED1 : ENABLED2 : DELETED3 : DEPLOYING4 : DELETING5 : DISABLING6 : SUSPENDING |
AccessFilterDto
"Refer các type: refererFilter, geoBlocking, ipProtection"
Video On Demand CDN
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create access filter Rule: null hay empty + Update access filter rule: Id của access filter rule cần update + Delete access filter: Những Id của access filter rule đã tạo không được gửi xuống khi update thì sẽ bị xóa đi. |
filterName | string | true | Tên loại filter muốn sử dụng Một trong các loại filter sau: + refererFilter + geoBlocking + ipProtection |
matchOperator | string | true | Lựa chọn các allow hay block các giá trị trong danh sách filter values: + IS_ONE_OF : block các giá trị trong danh sách filter values+ IS_NOT_ONE_OF : cho phép các giá trị trong danh sách filter values |
filterValues | List(string) | true | Danh sách các giá trị cần filter |
refererFilter
Name | Type | Required | Description |
---|---|---|---|
refererFilter | RefererFilter | false | none |
geoBlocking
Name | Type | Required | Description |
---|---|---|---|
geoBlocking | GeoBlocking | false | none |
ipProtection
Name | Type | Required | Description |
---|---|---|---|
ipProtection | IpProtection | false | none |
GeoBlocking
{
"filterName": "geoBlocking",
"filterValues": [
"VN",
"CN",
"US",
"UNKNOWN"
],
"matchOperator": "IS_ONE_OF",
"id": "2e6b4572-804c-4b20-9f63-3ab3f6c747d5"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
filterName | string | false | Giá trị là geoBlocking . |
filterValues | List(string) | false | Giá trị là mã quốc gia 2 chữ cái theo chuẩn ISO . |
matchOperator | string | true | Lựa chọn các allow hay block các giá trị trong danh sách filter values: + IS_ONE_OF : block các giá trị trong danh sách filter values+ IS_NOT_ONE_OF : cho phép các giá trị trong danh sách filter values |
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create access filter Rule: null hay empty + Update access filter rule: Id của access filter rule cần update + Delete access filter: Những Id của access filter rule đã tạo không được gửi xuống khi update thì sẽ bị xóa đi. |
IpProtection
{
"filterName": "ipProtection",
"filterValues": [
"1.1.1.1/20",
"2.2.2.2/10"
],
"matchOperator": "IS_ONE_OF",
"id": "2e6b4572-804c-4b20-9f63-3ab3f6c747d5"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
filterName | string | false | Giá trị là ipProtection |
filterValues | List(string) | false | Giá trị IPV4 và hỗ trợ subnet, giá trị subnet từ 8-32 |
matchOperator | string | true | Lựa chọn các allow hay block các giá trị trong danh sách filter values: + IS_ONE_OF : block các giá trị trong danh sách filter values+ IS_NOT_ONE_OF : cho phép các giá trị trong danh sách filter values |
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create access filter Rule: null hay empty + Update access filter rule: Id của access filter rule cần update + Delete access filter: Những Id của access filter rule đã tạo không được gửi xuống khi update thì sẽ bị xóa đi. |
RefererFilter
{
"filterName": "refererFilter",
"filterValues": [
"ccc.google.com.vn",
"ddd.google.com.vn"
],
"matchOperator": "IS_ONE_OF",
"id": "2e6b4572-804c-4b20-9f63-3ab3f6c747d5"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
filterName | string | false | Giá trị là refererFilter . |
filterValues | List(string) | false | Giá trị cho phép nhập tương đương domain name |
matchOperator | string | true | Lựa chọn các allow hay block các giá trị trong danh sách filter values: + IS_ONE_OF : block các giá trị trong danh sách filter values+ IS_NOT_ONE_OF : cho phép các giá trị trong danh sách filter values |
id | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create access filter Rule: null hay empty + Update access filter rule: Id của access filter rule cần update + Delete access filter: Những Id của access filter rule đã tạo không được gửi xuống khi update thì sẽ bị xóa đi. |
TokenRuleDto
{
"type": "sbd",
"includeClientIp": 1,
"customerKey": "0d18eee3121571a72fa4892679b4ac4f"
}
Chỉ dùng cho Video On Demand CDN
Properties
Name | Type | Required | Description |
---|---|---|---|
type | string | true | Loại token sử dụng Nhập một trong các giá trị sau: akamai , sbd , vng . |
includeClientIp | integer(int32) | true | Lựa chọn include client Ip Giá trị : + 0 : Disabled. + 1 : Enabled. Với token type là akamai , giá trị luôn là disabled . |
customerKey | string | true | Chuỗi kí tự theo format MD5 |
VodResponse
{
"tokenRuleCriteria": {
"type": "sbd",
"includeClientIp": 1,
"customerKey": "0d18eee3121571a72fa4892679b4ac4f"
},
"accessFilters": [],
"serviceType": "oripack",
"segmentSize": 4,
"type": "vod",
"s3Origin": {
"cdnUpstreamId": "2e6b3439-804c-4b20-9f63-3ab3f6c747d5",
"cdnId": "2e6b3439-804c-4b20-9f63-3ab3f6c747d5",
"accessKey": "s3AccessKey",
"secretKey": "s3SecretKey",
"bucket": "bucket-name",
"region": "us-west-2",
"endpoint": "/path-name",
"version": "v4"
},
"useSsl": false,
"originHostHeader": "google.com",
"upstreams": [
{
"cdnUpstreamId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703",
"cdnId": "5527a5f2-ef6e-420c-b70a-6286eb3a1104",
"priority": 10,
"ipaddress": "1.1.1.1:8080",
"status": 0
}
],
"lbType": "rr",
"failOverErrorCode": [
403,
404,
429,
500
],
"cdnDomain": "cdnDomain",
"cdnId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703",
"domainName": "google.com",
"cName": "[aaa.google.com.vn, bbb.google.com.vn]",
"status": 1,
"defaultRuleAction": [
{
"id": "0c6a88aa-2e6d-4718-b62a-414cdf07a8a9",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
}
],
"childrenRule": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"userUuid": "2e6b3439-804c-4b20-9f63-3ab3f6c23232"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
tokenRuleCriteria | TokenRuleDto | false | Chỉ dùng cho Video On Demand CDN |
accessFilters | List(AccessFilterDto) | false | Chỉ dùng cho Video On Demand CDN |
serviceType | string | true | Service type của Video On Demand CDN Một trong các giá trị sau: cdnpack , oripack , mp4 |
segmentSize | integer(int32) | true | Segment Size của Video On Demand CDN khi type là cdnPack + Giá trị 0 khi sử dụng service Type của VoD là oripack hay mp4 .+ Khi service Type là cdnPack , nhập một trong các giá trị sau: 4,6,10 |
type | string | false | Kiểu CDN vod . |
s3Origin | S3OriginDto | false | Chỉ áp dụng cho Object Download và Video On Demand CDN |
useSsl | boolean | false | Điều chỉnh việc sử dụng ssl cho http origin hay không. |
originHostHeader | string | false | Origin host header cần tạo hay edit |
upstreams | List(UpStreamDto) | true | Danh sách các upstream của CDN. |
lbType | string | true | Load balance type của origin + rr Round robin+ lc Least Connected+ iph IP Hashing |
failOverErrorCode | List(string) | true | List string một hoặc nhiều giá trị trong dãy sau:403, 404, 429, 500, 502, 503, 504 |
cdnDomain | string | true | Domain của CDN được tạo ra bởi hệ thống. |
cdnId | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create CDN: null hay empty + Update CDN: Id của CDN cần update |
domainName | string | true | Tên domain name của CDN cần tạo hay edit, - Nếu tạo Web Accelerator CDN phải thỏa các điều kiện sau: + Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang (-) và dấu chấm . + Đầu và đuôi từng thành phần (phân cách bởi dấu chấm (.) ) không được xuất hiện ký tự đặc biệt (-) .+ Được phép 2 dấu gạch ngang liên tiếp (--) nhưng không được 2 dấu chấm liên tiếp (..) - Nếu tạo các CDN khác thì thỏa điều kiện sau: + Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ |
cName | List(string) | false | Danh sách các domain name thay thế của CDN |
status | integer(int32) | true | Status của CDN:0 : DISABLED1 : ENABLED2 : DELETED3 : DEPLOYING4 : DELETING5 : DISABLING6 : SUSPENDING |
defaultRuleAction | List(RuleAction) | true | Những rule behavior default bắt buộc của từng loại CDN |
childrenRule | List(PageRule) | false | Danh sách các rule và behavior tùy chọn |
userUuid | string | true | UUID của User sở hữu CDN. |
VodRequest
{
"type": "vod",
"tokenRuleCriteria": {
"type": "sbd",
"includeClientIp": 1,
"customerKey": "0d18eee3121571a72fa4892679b4ac4f"
},
"accessFilters": [],
"serviceType": "oripack",
"segmentSize": 4,
"s3Origin": {
"cdnUpstreamId": "2e6b3439-804c-4b20-9f63-3ab3f6c747d5",
"cdnId": "2e6b3439-804c-4b20-9f63-3ab3f6c747d5",
"accessKey": "s3AccessKey",
"secretKey": "s3SecretKey",
"bucket": "bucket-name",
"region": "us-west-2",
"endpoint": "/path-name",
"version": "v4"
},
"useSsl": false,
"originHostHeader": "google.com",
"upstreams": [
{
"cdnUpstreamId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703",
"cdnId": "5527a5f2-ef6e-420c-b70a-6286eb3a1104",
"priority": 10,
"ipaddress": "1.1.1.1:8080",
"status": 0
}
],
"lbType": "rr",
"failOverErrorCode": [
403,
404,
429,
500
],
"cdnDomain": "cdnDomain",
"cdnId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703",
"domainName": "google.com",
"cName": "[aaa.google.com.vn, bbb.google.com.vn]",
"status": 1,
"defaultRuleAction": [
{
"id": "0c6a88aa-2e6d-4718-b62a-414cdf07a8a9",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
}
],
"childrenRule": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"sslId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
type | string | false | Type là vod |
tokenRuleCriteria | TokenRuleDto | false | Chỉ dùng cho Video On Demand CDN |
accessFilters | List(AccessFilterDto) | false | Chỉ dùng cho Video On Demand CDN |
serviceType | string | true | Service type của Video On Demand CDN Một trong các giá trị sau: cdnpack , oripack , mp4 |
segmentSize | integer(int32) | true | Segment Size của Video On Demand CDN khi type là cdnPack + Giá trị 0 khi sử dụng service Type của VoD là oripack hay mp4 .+ Khi service Type là cdnPack , nhập một trong các giá trị sau: 4,6,10 |
s3Origin | S3OriginDto | false | Chỉ áp dụng cho Object Download và Video On Demand CDN |
useSsl | boolean | false | Điều chỉnh việc sử dụng ssl cho http origin hay không. |
originHostHeader | string | false | Origin host header cần tạo hay edit |
upstreams | List(UpStreamDto) | true | Danh sách các upstream của CDN. |
lbType | string | true | Load balance type của origin + rr Round robin+ lc Least Connected+ iph IP Hashing |
failOverErrorCode | List(string) | true | List string một hoặc nhiều giá trị trong dãy sau:403, 404, 429, 500, 502, 503, 504 |
cdnDomain | string | true | Domain của CDN được tạo ra bởi hệ thống. |
cdnId | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create CDN: null hay empty + Update CDN: Id của CDN cần update |
domainName | string | true | Tên domain name của CDN cần tạo hay edit, - Nếu tạo Web Accelerator CDN phải thỏa các điều kiện sau: + Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang (-) và dấu chấm . + Đầu và đuôi từng thành phần (phân cách bởi dấu chấm (.) ) không được xuất hiện ký tự đặc biệt (-) .+ Được phép 2 dấu gạch ngang liên tiếp (--) nhưng không được 2 dấu chấm liên tiếp (..) - Nếu tạo các CDN khác thì thỏa điều kiện sau: + Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ |
cName | List(string) | false | Danh sách các domain name thay thế của CDN |
status | integer(int32) | true | Status của CDN:0 : DISABLED1 : ENABLED2 : DELETED3 : DEPLOYING4 : DELETING5 : DISABLING6 : SUSPENDING |
defaultRuleAction | List(RuleAction) | true | Những rule behavior default bắt buộc của từng loại CDN |
childrenRule | List(PageRule) | false | Danh sách các rule và behavior tùy chọn |
sslId | string | true | Id của certificate |
WebAccResponse
{
"type": "webacc",
"originHostHeader": "google.com",
"upstreams": [
{
"cdnUpstreamId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703",
"cdnId": "5527a5f2-ef6e-420c-b70a-6286eb3a1104",
"priority": 10,
"ipaddress": "1.1.1.1:8080",
"status": 0
}
],
"lbType": "rr",
"failOverErrorCode": [
403,
404,
429,
500
],
"cdnDomain": "cdnDomain",
"cdnId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703",
"domainName": "google.com",
"cName": "[aaa.google.com.vn, bbb.google.com.vn]",
"status": 1,
"defaultRuleAction": [
{
"id": "0c6a88aa-2e6d-4718-b62a-414cdf07a8a9",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
}
],
"childrenRule": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"userUuid": "2e6b3439-804c-4b20-9f63-3ab3f6c23232"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
type | string | false | Type là webacc |
originHostHeader | string | false | Origin host header cần tạo hay edit |
upstreams | List(UpStreamDto) | true | Danh sách các upstream của CDN. |
lbType | string | true | Load balance type của origin + rr Round robin+ lc Least Connected+ iph IP Hashing |
failOverErrorCode | List(string) | true | List string một hoặc nhiều giá trị trong dãy sau:403, 404, 429, 500, 502, 503, 504 |
cdnDomain | string | true | Domain của CDN được tạo ra bởi hệ thống. |
cdnId | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create CDN: null hay empty + Update CDN: Id của CDN cần update |
domainName | string | true | Tên domain name của CDN cần tạo hay edit, - Nếu tạo Web Accelerator CDN phải thỏa các điều kiện sau: + Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang (-) và dấu chấm . + Đầu và đuôi từng thành phần (phân cách bởi dấu chấm (.) ) không được xuất hiện ký tự đặc biệt (-) .+ Được phép 2 dấu gạch ngang liên tiếp (--) nhưng không được 2 dấu chấm liên tiếp (..) - Nếu tạo các CDN khác thì thỏa điều kiện sau: + Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ |
cName | List(string) | false | Danh sách các domain name thay thế của CDN |
status | integer(int32) | true | Status của CDN:0 : DISABLED1 : ENABLED2 : DELETED3 : DEPLOYING4 : DELETING5 : DISABLING6 : SUSPENDING |
defaultRuleAction | List(RuleAction) | true | Những rule behavior default bắt buộc của từng loại CDN |
childrenRule | List(PageRule) | false | Danh sách các rule và behavior tùy chọn |
userUuid | string | true | UUID của User sở hữu CDN. |
WebAccRequest
{
"originHostHeader": "google.com",
"upstreams": [
{
"cdnUpstreamId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703",
"cdnId": "5527a5f2-ef6e-420c-b70a-6286eb3a1104",
"priority": 10,
"ipaddress": "1.1.1.1:8080",
"status": 0
}
],
"lbType": "rr",
"failOverErrorCode": [
403,
404,
429,
500
],
"cdnDomain": "cdnDomain",
"cdnId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703",
"domainName": "google.com",
"cName": "[aaa.google.com.vn, bbb.google.com.vn]",
"status": 1,
"defaultRuleAction": [
{
"id": "0c6a88aa-2e6d-4718-b62a-414cdf07a8a9",
"actionName": "addCors",
"value": "{\"configType\":\"simple\",\"allowOrigin\":[],\"allowHeader\":[],\"allowMethod\":[],\"exposeHeader\":[]}",
"order": 0
}
],
"childrenRule": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"order": 3,
"urlPattern": [
"/"
],
"actions": [
{
"id": "349db4df-28de-4ea0-9d8a-402f4de1bdeb",
"actionName": "redirect",
"value": "{\"code\":\"301\",\"url\":\"https://fk.zoneplay.vn/landing\"}",
"order": 1
}
],
"criterias": [
{
"id": "e5977714-b7d7-45a5-8695-9f75dd7db6c8",
"criteriaName": "path",
"value": "{\"matchOperator\":\"MATCHES_ONE_OF\",\"values\":[\"/\"],\"matchCaseSensitive\":true}",
"order": 1
}
],
"status": 1,
"childrenRule": [],
"criteriaMustSatisfy": null
}
],
"sslId": "5527a5f2-ef6e-420c-b70a-6286eb3a7703"
}
Properties
Name | Type | Required | Description |
---|---|---|---|
originHostHeader | string | false | Origin host header cần tạo hay edit |
upstreams | List(UpStreamDto) | true | Danh sách các upstream của CDN. |
lbType | string | true | Load balance type của origin + rr Round robin+ lc Least Connected+ iph IP Hashing |
failOverErrorCode | List(string) | true | List string một hoặc nhiều giá trị trong dãy sau:403, 404, 429, 500, 502, 503, 504 |
cdnDomain | string | true | Domain của CDN được tạo ra bởi hệ thống. |
cdnId | string | true | Chuỗi giá trị auto generate bởi hệ thống CDN. + Create CDN: null hay empty + Update CDN: Id của CDN cần update |
domainName | string | true | Tên domain name của CDN cần tạo hay edit, - Nếu tạo Web Accelerator CDN phải thỏa các điều kiện sau: + Giới hạn 255 kí tự, nhập chữ thường, in hoa, số và các kí tự đặc biệt sau: gạch ngang (-) và dấu chấm . + Đầu và đuôi từng thành phần (phân cách bởi dấu chấm (.) ) không được xuất hiện ký tự đặc biệt (-) .+ Được phép 2 dấu gạch ngang liên tiếp (--) nhưng không được 2 dấu chấm liên tiếp (..) - Nếu tạo các CDN khác thì thỏa điều kiện sau: + Cho phép nhập chữ thường, in hoa, số , dấu cách và các kí tự đặc biệt sau: %*,./-_()?&=:;+$[]!#~^@ |
cName | List(string) | false | Danh sách các domain name thay thế của CDN |
status | integer(int32) | true | Status của CDN:0 : DISABLED1 : ENABLED2 : DELETED3 : DEPLOYING4 : DELETING5 : DISABLING6 : SUSPENDING |
defaultRuleAction | List(RuleAction) | true | Những rule behavior default bắt buộc của từng loại CDN |
childrenRule | List(PageRule) | false | Danh sách các rule và behavior tùy chọn |
sslId | string | true | Id của certificate |