全部产品
云市场

点播CDN

更新时间:2019-02-12 20:14:55

初始化客户端

使用前请先初始化客户端,参考 initVodClient 接口。

预热缓存

接口参数和返回字段请参考 PreloadVodObjectCaches

  1. // 调用样例
  2. var client = initVodClient('<Your AccessKeyId>','<Your AccessKeySecret>');
  3. client.request("PreloadVodObjectCaches", {
  4. ObjectPath: 'http://testxxxx.testvodxxxxx.com/video/xxxxxxxx-1688e7fd1ca-0005-36ec-adb-xxxxx.mp4' // 需要预热的文件路径
  5. }, {}).then(function (response) {
  6. // 预热返回的任务ID
  7. console.log('PreloadTaskId = ' + response.PreloadTaskId);
  8. console.log('RequestId = ' + response.RequestId);
  9. }).catch(function (response) {
  10. console.log('ErrorCode = ' + response.data.Code);
  11. console.log('ErrorMessage = ' + response.data.Message);
  12. console.log('RequestId = ' + response.data.RequestId);
  13. });

刷新缓存

接口参数和返回字段请参考 RefreshVodObjectCaches

  1. // 调用样例
  2. var client = initVodClient('<Your AccessKeyId>','<Your AccessKeySecret>');
  3. client.request("RefreshVodObjectCaches", {
  4. ObjectPath: 'http://testxxxx.testvodxxxxx.com/video/xxxxxxxx-1688e7fd1ca-0005-36ec-adb-xxxxx.mp4', // 需要刷新的文件或者目录路径
  5. ObjectType: 'File' // 刷新的类型
  6. }, {}).then(function (response) {
  7. // 刷新返回的任务ID
  8. console.log('RefreshTaskId = ' + response.RefreshTaskId);
  9. console.log('RequestId = ' + response.RequestId);
  10. }).catch(function (response) {
  11. console.log('ErrorCode = ' + response.data.Code);
  12. console.log('ErrorMessage = ' + response.data.Message);
  13. console.log('RequestId = ' + response.data.RequestId);
  14. });

查询刷新和预热状态

接口参数和返回字段请参考 DescribeVodRefreshTasks

  1. // 调用样例
  2. var client = initVodClient('<Your AccessKeyId>','<Your AccessKeySecret>');
  3. client.request("DescribeVodRefreshTasks", {
  4. DomainName: 'testxxxx.testvodxxxxx.com', // 需要查询的域名
  5. ObjectType: 'File' // 任务类型
  6. }, {}).then(function (response) {
  7. console.log(response);
  8. // 整页大小
  9. console.log('PageSize = ' + response.PageSize);
  10. // 页码
  11. console.log('PageNumber = ' + response.PageNumber);
  12. // 总条数
  13. console.log('TotalCount = ' + response.TotalCount);
  14. // 任务信息
  15. if (response.Tasks && response.Tasks.Task && response.Tasks.Task.length > 0){
  16. for (var i=0; i<response.Tasks.Task.length; i++){
  17. console.log('The ' + i + ' Task.');
  18. var task = response.Tasks.Task[i];
  19. // 任务ID
  20. console.log('TaskId = ' + task.TaskId);
  21. // 刷新对象路径
  22. console.log('ObjectPath = ' + task.ObjectPath);
  23. // 状态
  24. console.log('Status = ' + task.Status);
  25. // 进度百分比
  26. console.log('Process = ' + task.Process);
  27. // 任务类型
  28. console.log('ObjectType = ' + task.ObjectType);
  29. // 任务对象创建时间,使用UTC时间
  30. console.log('CreationTime = ' + task.CreationTime);
  31. // 刷新预热失败返回的错误描述
  32. console.log('Description = ' + task.Description);
  33. }
  34. }
  35. console.log('RequestId = ' + response.RequestId);
  36. }).catch(function (response) {
  37. console.log('ErrorCode = ' + response.data.Code);
  38. console.log('ErrorMessage = ' + response.data.Message);
  39. console.log('RequestId = ' + response.data.RequestId);
  40. });

查询刷新预热次数限制和余量

接口参数和返回字段请参考 DescribeVodRefreshQuota

  1. // 调用样例
  2. var client = initVodClient('<Your AccessKeyId>','<Your AccessKeySecret>');
  3. client.request("DescribeVodRefreshQuota", {}, {}).then(function (response) {
  4. // 当日URL刷新数量上限
  5. console.log('UrlQuota = ' + response.UrlQuota);
  6. // 当日目录刷新数量上限
  7. console.log('DirQuota = ' + response.DirQuota);
  8. // 当日剩余URL刷新数量
  9. console.log('UrlRemain = ' + response.UrlRemain);
  10. // 当日剩余目录刷新数量
  11. console.log('DirRemain = ' + response.DirRemain);
  12. // 当天预热数量上限
  13. console.log('PreloadQuota = ' + response.PreloadQuota);
  14. // 当天剩余预热数量
  15. console.log('PreloadRemain = ' + response.PreloadRemain);
  16. console.log('RequestId = ' + response.RequestId);
  17. }).catch(function (response) {
  18. console.log('ErrorCode = ' + response.data.Code);
  19. console.log('ErrorMessage = ' + response.data.Message);
  20. console.log('RequestId = ' + response.data.RequestId);
  21. });

查询流量数据

接口参数和返回字段请参考 DescribeVodDomainTrafficData

  1. // 调用样例
  2. var client = initVodClient('<Your AccessKeyId>','<Your AccessKeySecret>');
  3. client.request("DescribeVodDomainTrafficData", {
  4. DomainName: 'testxxxx.testvodxxxxx.com', // 域名
  5. StartTime: '2019-01-15T15:59:59Z', // 开始时间,请使用UTC格式
  6. EndTime: '2019-01-20T15:59:59Z' // 结束时间,请使用UTC格式
  7. }, {}).then(function (response) {
  8. // 域名
  9. console.log('DomainName = ' + response.DomainName);
  10. // 开始时间
  11. console.log('StartTime = ' + response.StartTime);
  12. // 结束时间
  13. console.log('EndTime = ' + response.EndTime);
  14. // 时间间隔
  15. console.log('DataInterval = ' + response.DataInterval);
  16. // 流量数据
  17. if (response.TrafficDataPerInterval && response.TrafficDataPerInterval.DataModule && response.TrafficDataPerInterval.DataModule.length > 0){
  18. for(var i=0; i<response.TrafficDataPerInterval.DataModule.length; i++){
  19. var trafficData = response.TrafficDataPerInterval.DataModule[i];
  20. console.log("The " + i + " TrafficData.");
  21. console.log('TimeStamp = ' + trafficData.TimeStamp);
  22. console.log('Value = ' + trafficData.Value);
  23. console.log('DomesticValue = ' + trafficData.DomesticValue);
  24. console.log('OverseasValue = ' + trafficData.OverseasValue);
  25. }
  26. }
  27. console.log('RequestId = ' + response.RequestId);
  28. }).catch(function (response) {
  29. console.log('ErrorCode = ' + response.data.Code);
  30. console.log('ErrorMessage = ' + response.data.Message);
  31. console.log('RequestId = ' + response.data.RequestId);
  32. });

查询网络带宽

接口参数和返回字段请参考 DescribeVodDomainBpsData

  1. // 调用样例
  2. var client = initVodClient('<Your AccessKeyId>','<Your AccessKeySecret>');
  3. client.request("DescribeVodDomainBpsData", {
  4. DomainName: 'testxxxx.testvodxxxxx.com', // 域名
  5. StartTime: '2019-01-15T15:59:59Z', // 开始时间,请使用UTC格式
  6. EndTime: '2019-01-20T15:59:59Z' // 结束时间,请使用UTC格式
  7. }, {}).then(function (response) {
  8. // 域名
  9. console.log('DomainName = ' + response.DomainName);
  10. // 开始时间
  11. console.log('StartTime = ' + response.StartTime);
  12. // 结束时间
  13. console.log('EndTime = ' + response.EndTime);
  14. // 时间间隔
  15. console.log('DataInterval = ' + response.DataInterval);
  16. // 带宽数据
  17. if (response.BpsDataPerInterval && response.BpsDataPerInterval.DataModule && response.BpsDataPerInterval.DataModule.length > 0){
  18. for(var i=0; i<response.BpsDataPerInterval.DataModule.length; i++){
  19. var bpsData = response.BpsDataPerInterval.DataModule[i];
  20. console.log("The " + i + " BpsData.");
  21. console.log('TimeStamp = ' + bpsData.TimeStamp);
  22. console.log('Value = ' + bpsData.Value);
  23. console.log('DomesticValue = ' + bpsData.DomesticValue);
  24. console.log('OverseasValue = ' + bpsData.OverseasValue);
  25. }
  26. }
  27. console.log('RequestId = ' + response.RequestId);
  28. }).catch(function (response) {
  29. console.log('ErrorCode = ' + response.data.Code);
  30. console.log('ErrorMessage = ' + response.data.Message);
  31. console.log('RequestId = ' + response.data.RequestId);
  32. });

下载域名日志

接口参数和返回字段请参考 DescribeVodDomainLog

  1. // 调用样例
  2. var client = initVodClient('<Your AccessKeyId>','<Your AccessKeySecret>');
  3. client.request("DescribeVodDomainLog", {
  4. DomainName: 'testxxxx.testvodxxxxx.com', // 域名
  5. // PageSize: 300, // 分页大小
  6. // PageNumber: 1, // 分页页号
  7. StartTime: '2019-01-15T15:59:59Z', // 开始时间,请使用UTC格式
  8. EndTime: '2019-01-20T15:59:59Z' // 结束时间,请使用UTC格式
  9. }, {}).then(function (response) {
  10. // CDN日志详细数据
  11. console.log(response.DomainLogDetails);
  12. if (response.DomainLogDetails && response.DomainLogDetails.DomainLogDetail && response.DomainLogDetails.DomainLogDetail.length > 0){
  13. for(var i=0; i<response.DomainLogDetails.DomainLogDetail.length; i++){
  14. var logData = response.DomainLogDetails.DomainLogDetail[i];
  15. console.log("The " + i + " LogData.");
  16. console.log('DomainName = ' + logData.DomainName);
  17. console.log('LogCount = ' + logData.LogCount);
  18. console.log('=== PageInfoDetail Data ===');
  19. console.log('PageNumber = ' + logData.PageInfos.PageNumber);
  20. console.log('PageSize = ' + logData.PageInfos.PageSize);
  21. console.log('Total = ' + logData.PageInfos.Total);
  22. console.log('=== LogInfoDetail Data ===');
  23. if (logData.LogInfos && logData.LogInfos.LogInfoDetail && logData.LogInfos.LogInfoDetail.length > 0){
  24. for (var j=0; j<logData.LogInfos.LogInfoDetail.length; j++){
  25. var logInfoDetail = logData.LogInfos.LogInfoDetail[j]
  26. console.log('LogName = ' + logInfoDetail.LogName);
  27. console.log('LogPath = ' + logInfoDetail.LogPath);
  28. console.log('LogSize = ' + logInfoDetail.LogSize);
  29. console.log('StartTime = ' + logInfoDetail.StartTime);
  30. console.log('EndTime = ' + logInfoDetail.EndTime);
  31. }
  32. }
  33. }
  34. }
  35. console.log('RequestId = ' + response.RequestId);
  36. }).catch(function (response) {
  37. console.log('ErrorCode = ' + response.data.Code);
  38. console.log('ErrorMessage = ' + response.data.Message);
  39. console.log('RequestId = ' + response.data.RequestId);
  40. });