CDN Pro
创建部署任务将加速项目或证书部署到演练或生产环境,或将已部署的加速项目或证书卸载。 建议先将加速项目部署到演练环境进行测试,以确保加速配置符合预期。
单用户调用频率:300/5min
Open API在线调试功能提供可视化界面在线调试API、支持生成代码示例、快速检索查看API文档等能力。前往调试
参数名称 | 描述 |
---|---|
Check-CertificateString | 当您提交部署任务时,后台会校验加速项目所引用的证书是否已过期,以及加速域名是否与证书的授权域名匹配。如果您的部署操作是出于测试目的,您可以在调用接口时传入请求头Check-Certificate: no来跳过校验。非测试目的,不建议跳过校验。 |
Check-UsageString | 当您卸载加速项目时,后台会校验加速项目下的域名是否处于活跃状态。如果域名在过去24小时仍有产生请求,则会拒绝卸载加速项目,避免误操作。如果您确定要卸载加速项目,可以在调用接口时传入请求头Check-Usage: no来跳过校验。 |
参数名称 | 描述 |
---|---|
nameString | 部署任务的名称。 |
*targetString | 取值范围: staging,production
指定部署任务的目标环境,即演练或生产环境。 |
actionsList | 部署任务所要执行的操作,可以包括加速项目和证书的部署或卸载操作。 |
actionString | 取值范围: deploy_property,remove_property,deploy_cert,remove_cert
指定操作类型,包括部署加速项目、卸载加速项目、部署证书以及卸载证书。 |
propertyIdString | 指定要部署或卸载的加速项目ID。 |
certificateIdString | 指定要部署或卸载的证书ID。 |
versionString | 指定要部署或卸载的证书或加速项目的版本。 |
webhookString | 部署任务完成时要调用的webhook的ID。 |
参数名称 | 描述 |
---|---|
LocationString | 通过Location响应头返回新建的部署任务的URL。可使用该URL调用'获取部署任务详细信息'接口来查看部署任务的详细信息。URL示例: Location: http://open.chinanetcenter.com/cdn/deploymentTasks/ac8e3085-ef92-4c12-ab1b-19b18ac9383c |
错误代码(code) | 描述(message) | HTTP状态码 | 语义 |
---|---|---|---|
InvalidPropertyId | An invalid property ID was specified. | 400 | 指定的加速项目ID不存在。 |
InvalidAction | A deployment action is invalid. It must be deploy_property, remove_property, deploy_cert, or remove_cert. | 400 | 所指定的部署操作不存在。必须是deploy_property, remove_property,deploy_cert或者remove_cert。 |
CertificateExpired | Certificate is expired. Use request header 'Check-Certificate: no' to bypass cert expiration check. | 400 | 证书已过期。如果要跳过证书过期校验,请加上请求头Check-Certificate: no。 |
InvalidPropertyVersion | The specified version 999 or property 1c2a0ce09612e9988c345dff does not exist. | 400 | 所指定的加速项目ID或版本不存在。 |
InvalidCertificateVersion | The specified version 100 of certificate 5c65d18197146f000148511f does not exist. | 400 | 所指定的证书ID或版本不存在。 |
CertificateMismatch | The domain(s) mytestdomain.domain.info are not included in the Subject Alternative Name field of the deployed version of certificate c5fbb345a24615f2a7ea0791. | 400 | 加速项目中的部分域名不在证书的授权域名中。 |
OutdatedSecret | Property a2334bc12345 versionId 1 is using an outdated secret. Please validate the property again before deploying it. | 400 | 加速项目所引用的保密信息(Secret)已更新,请重新验证加速项目再部署。 |
CertificateNotDeployed | The required certificate 879aba3828341232 has not been deployed to the target yet. | 409 | 加速项目所引用的证书未部署到目标环境。 |
#!/bin/bash username="example_username" apiKey="example_apiKey" date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"` password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64` curl -i --url "https://open.chinanetcenter.com/cdn/deploymentTasks" \ -X "POST" \ -u "$username:$password" \ -H "Date: $date" \ -H "Accept: application/json" \ -d '{"name": "DeploymentName_1573690803000", "target": "production", "actions": [{"propertyId": "5bc3a494aceedd9073a7daa0", "version": "1", "action": "deploy_property"}]}'
{ "code": "InvalidPropertyId", "message": "An invalid property ID was specified." }