Media Acceleration

AddCdnDomain

Update time: 2024-08-07 18:54:58

When you apply the non-live-streaming acceleration service for specified domain. Content Acceleration, Dynamic Web Acceleration, Download Acceleration are supported. The newly added domains can be deployed in a fast mode after the following requirements are met service form for relevant acceleration type; and application that no manual review needed are finished. By default, manual review is required. When creating Accelerated domain inside china or outside china, the requirements are as below. 1. To create the accelerated domain inside china - The accelerated domain name MUST obtain an ICP license - Keep the core requirement of obtaining ICP certification Accelerated domain names should not contain the following information: the sale of controlled drugs and tools, unlawful remarks and information. Video-related accelerated domain names must have Audio Visual Services License; blog forums or community-related accelerated domain names must have BBS special approval qualifications. 2. To create the accelerated domain outside china - The accelerated domain name MUST use accelerate-no-china = true that indicates that the customer domain name is not accelerated in China. Note: 1. Data format: Both request and response support XML. 2. Recommended frequency: 1 times per15min.

  • Limit Description: · The accelerated domain name must have been filed. · Accelerated domain names must not contain the following information: sales of drugs and controlled tools, including illegal speech and information. · Video-accelerated domain names must have audiovisual licenses; blog forums or community-based accelerated domain names must have BBS special approval qualifications. · Interface requests and return results only accept xml format.
  • Single user trigger frequency: 300/5min
  • Applicable Products: Content Acceleration,Dynamic Web Acceleration,Media Acceleration,Flood Shield,Flood Shield 2.0

Request

Body Params

NameDescription
*versionString
The current version is 1.0.0
*domain-nameString
CDN accelerated domain name. Support generic domain name, witch starts with a dot, such as: .example.com, If the domain example.com have China ICP, then the domain name xx.example.com have ICP too.
referenced-domain-nameString
The value should be an effective domain. The added domain will copy the config of this domain.
config-form-idString
Configure single template. If you want to add a new accelerated domain name with a specified configuration, you can use a specified configured template. For details, please consult the corresponding customer support staff.
accelerate-no-chinaString
The optional value is: true or false.
*contract-idString
The id of contract, such as 40015677
*item-idString
The id of product, such as 10
cname-labelString
An alias for public service cname. When you have multiple domains that need to share a cname, then you may specify a cname-label here. If domains use the same cname-label, they will share the same cname and has the same dns coverage. Note: 1. Restrictions on domains with the same cname-label: they should have the same acceleration type, certificate (if use ssl), service areas. 2. Multiple http domains can share the same cname; multiple sni https domains can share the same cname as wll. 3. When a single domain uses a cname-label, it can be cancelled acceleration; while multiple domains are not allowed to cancel acceleration for part of them.
commentString
Remarks, up to 1000 characters
header-of-clientipString
Pass the response header of client IP. The optional values are Cdn-Src-Ip and X-Forwarded-For. The default value is Cdn-Src-Ip.
*origin-configObject
Back-to-origin policy setting, which is used to set the origin site information and the back-to-origin policy of the accelerated domain name
origin-ipsString
Origin site address, which can be an IP or a domain name. 1. IP is separated by semicolons and multiple IPs are supported. 2. Only one domain name can be entered. IP and domain names cannot be entered at the same time. 3. Maximum character limit is 500.
default-origin-host-headerString
The Origin HOST for changing the HOST field in the return source HTTP request header. Note: It should be domain or IP format. For domain name format, each segement separated by a dot, does not exceed 62 characters, the total length should not exceed 128 characters.
origin-portString
Origin port, Value cannot be zero
live-configObject
Live domain configuration, used to set the livestream acceleration domain origin config. Note: In addition to the API call permission, you need to contact the dedicated customer service to apply for the corresponding API client template.
stream-typeString
The live push-pull stream type, the optional values are pull and push, pull means pull flow; push means push flow.
origin-push-hostString
The push-pull domain name is used to set the push-flow domain name corresponding to the live streaming domain name. When the stream-type is pull, at least one of the source IP address and the corresponding push-stream domain name is not empty. When the stream-type is push, Incoming.
origin-ipsString
Source station IP. When the stream-type is pull, at least one of the source station IP and the companion push stream domain name is not empty. 1. If it is a push-pull flow package, fill in 127.0.0.1, and the system will also default to 127.0.0.1. 2. If it is directly returning to the source, fill in the source IP of the source pull stream.
publish-pointsList
Livestream domain settings. Set the publishing point of the live push-pull domain. note: 1. The pull stream and the corresponding push stream domain must be configured with the same publishing point. 2. If you are not going to modify the publishing point, please do not pass this param. 3. The publishing point adopts the overlay update. Each time you modify, you need to submit all the publishing points. You cannot submit only the parts that need to be modified.
uriString
Publish point, support multiple, multiple values separated by ||,do not pass the system by default to generate a publishing point uri for slash /
sslObject
SSL settings, to bind a certificate with the accelerated domain. You can use the interface [AddCertificate] to upload your certificates. If you want to modify a certificate, please use the interface: [UpdateCertificate]
use-sslString
Use a certificate, the optional values are true and false, true means to use the certificate, false means not to use the certificate
use-for-sniString
Use sni certificate, the optional values are true and false, true means use sni certificate, false means use shared certificate (not supported)
ssl-certificate-idInteger
Use sni certificate, the optional values are true and false, true means use sni certificate, false means use shared certificate (not supported)

Response

Body Params

NameDescription
http status codeInteger
httpstatus=202; Indicates that the new domain API was successfully invoked, and the current deployment of the new domain can be viewed using x-cnc-request-id in the header
x-cnc-request-idString
Uniquely identified id for querying tasks per request (for all API)
locationString
The URL used to access the domain information, where domain-id is the unique token generated by our cloud platform for the domain name and whose value is a string.
cnameString
The name of the service domain automatically generated by the My company, for example: xxxx.cdn30.com
codeString
Request result code
messageString
Response information, when success is successful

Error code

Error code(code)Description(message)HTTP statusSemantic
MalformedXMLThe XML you provided was not well-formed or did not validate against our   published schema.400The XML provided is incorrect or incompatible with the rules
InternalErrorWe encountered an internal error. Please try again.500Internal errors such as server exception, data acquisition failure, etc.
DomainAlreadyExistsThe domain name you provided is already in our system.409The added domain name has already existed.
ConfigErrorThe domain name is invalid.400Invalid domain name
ICPNotFoundThere is no ICP number for the domain you provided.400The domain name you provided does not have a record number.
InvalidOriginPlease specify at least one IP or hostname.400No source ip or source domain name is provided.
InvalidOriginOrigin domain and accelerated domain cannot be the same.400The returned source domain and the accelerated domain name cannot be the same
InvalidOriginThe origin IP or hostname is invalid.400The source ip/domain name is invalid.
InvalidOrigin{"$domainName":{"src-ip":"Duplicate source ip or source domain name."}}400Returned source ip is repeated
CustomizedCnameErrorCustomized CNAME error.409Customer sharing a level 1 error
ConfigFormNotExistsThe configuration does not exist.400Configuration does not exist
CnameErrorCNAME error.409Shared first level error
CnameErrorThe cname label has one more templet forms400The common level belongs to multiple configuration order templates.
InvalidOrigin{"$domainName":{"$xmlTag":"$msg"}}400Domain name attribute value is incorrect
InvalidOrigin{"$domainName":{"ssl":"No certificate id when use ssl."}}400No certificate id is passed when using the certificate
ConfigErrorThe specified service type does not exist.400No corresponding service order
ConfigErrorparameter custSuitType is blank.400The external acceleration type of the parameter is empty
ConfigErrorcan not find form id for domain: [$domainName]400Cannot find the configuration list of the domain name
ConfigErrorcan not find service form for domain: [$domainName]400Cannot find the service form for the domain name
ConfigErrorThe suit does not match the suit associated with the value of cname-label.409The specified configuration does not match the specified shared primary domain name.
ConfigErrorThe service-type does not match the service-type associated with the value of   cname-label.400The specified acceleration type does not match the specified shared first-level domain name.
NoSuchConfigTempletThe specified config templet does not exist.404The configuration template does not exist.
NO_AVAILABLE_CONFIGCan not find effective ConfServiceForm by input parameter custSuitType :   [$CustSuitType]400Cannot find a suitable ticket based on the type of acceleration
PARSE_PARAM_ERRORError parameter.400Input parameter parsing error
NULL_DOMAIN_NAMEDomain name is null.400Domain name is empty
STAGING_SUIT_ERRORcan not find any suit400Package is not found
SUIT_HAS_NOT_CONFIG_CERTIFICATE_SERVICEThe suit belong to serviceForm does not have a certificate service.400The service order is of the https type, but the related service does not have the relevant secondary service for configuring the certificate.
ERROR_CONFIG_PARAM{"$configXmlTag":"$msg"}orWrong delete data id $dataIdorWrong data id $dataId400Configuring single configuration item error
MAIN_DOMAIN_NAME_EXISTMain domain names exists for domain [$errDomainNames]400Primary domain already exists

Example

JSON
XML
JSON FOR LIVE-PUSH
JSON FOR LIVE-PULL
XML FOR LIVE-PUSH
XML FOR LIVE-PULL
JSON
Request example
Copy Copy success
#!/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://api.cdnetworks.com/cdnw/api/domain" \
-X "POST" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-d '{
  "version": "1.0.0",
  "domain-name": "www.example.com",
  "contract-id": "40012086",
  "item-id": "10",
  "origin-config":{
        "origin-ips":"1.1.1.0"
    },
    "referenced-domain-name":"aaa.linlytest.com",
    "ssl":{
         "use-ssl":"true",
         "ssl-certificate-id":"certificate ID"
    }
}'
Response example
Copy Copy success
HTTP/1.1 202 Accepted
Date: Fri, 17 May 2017 06:33:26 GMT
Content-Type: application/xml;charset=utf-8
x-cnc-request-id:c54cbbb4-19fe-407a-930c-3988b62ed2fd
Location:https://api.cdnetworks.com/api/domain/1234567
cname: 7nt6mrh7sdkslj.cdn30.com
{"message":"success"}
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!