All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

AddCdnDomain

Last updated:2021-03-17 10:54:32

AddCdnDomain

Description

You can call this operation to add a domain name. Only one domain name can be added at a time. This operation allows you to add a wildcard domain name such as *.a.com.

Limits:

  • The domain name must have an ICP filing.

Notes:

  • You need to specify basic information such as the domain name and origin server.
  • The domain name must be unique. Otherwise, an error message is returned, indicating that the domain name already exists.

Request syntax

The API request contains the specified directory /2016-09-01/domain/AddCdnDomain, common request headers, and operation-specific request parameters. For more information, see the sample request.

Request parameters

Parameter Required Type Description
DomainName Yes String The domain name that you want to add to Kingsoft Cloud CDN.
CdnType Yes String The business type of the domain name. You can specify only one type at a time. Valid values: file, video, page, and live. Currently, the value live is not supported.
ProjectId No String The project ID of the domain name. By default, domain names are added to the default project. If a project ID is specified, the domain name is added to the specified project.
CdnProtocol Yes String The CDN access protocol. Default value: http. Valid values for live streaming are http+flv, hls, and rtmp. If the business type is file, video, or page, the access protocol is http. If the business type is live, the access protocol is http+flv, hls, or rtmp.
Regions No String The region in which content delivery is accelerated, which is CN by default. Separate multiple regions with commas (,). For more information about the enumeration types, see Usage notes.
OriginType Yes String The type of the origin. Valid values: ipaddr (IP address), domain (domain name), KS3, and ksvideo (video cloud of Kingsoft Cloud). If the business type is file, the origin type is ipaddr, domain, or KS3. If the business type is live, the origin type is ipaddr, domain, or ksvideo. If the origin type is KS3, the domain name to be added must end with ksyun.com.
OriginProtocol Yes String The back-to-origin protocol. Valid values: http, https, follow, rtmp, and hls. If the business type is file or video, the back-to-origin protocol is http, https, or follow. The value follow indicates that the access protocol is used as the back-to-origin protocol. If the business type is live, the back-to-origin protocol is rtmp or hls. If the access protocol is hls, the back-to-origin protocol must be hls. If the access protocol is http+flv or rtmp, the back-to-origin protocol must be rtmp.
Origin Yes String The back-to-origin address, which is an IP address or a domain name. You can specify either up to 20 IP addresses separated with commas (,) or only one domain name. If the origin type is ipaddr, you can specify only IP addresses. If the origin type is domain, KS3, or ksvideo, you can specify only one domain name.

Wildcard domain names

  1. You can add a domain name with three or more levels.
  2. This rule takes effect when the business type is file. If the business type is live, the rule for wildcard domain names is the same as that for exact domain names.

Response parameters

Parameter Type Description
DomainId String The ID of the domain name.
DomainStatus String The status of the domain name.

Examples

Sample request

GET method:

GET /2016-09-01/domain/AddCdnDomain?DomainName=www.test.com&CdnType=live&CdnSubType=live&CdnProtocol=RTMP&Regions=CN&OriginType=domain&OriginProtocol=rtmp&Origin=www.test.com 1.1
Host: cdn.api.ksyun.com
X-Amz-Date: date
Authorization:authorization string
x-action: AddCdnDomain
x-version: 2016-09-01

POST method for adding an exact domain name:

POST /2016-09-01/domain/AddCdnDomain 1.1
Host: cdn.api.ksyun.com
X-Amz-Date: date
Authorization:authorization string
x-action: AddCdnDomain
x-version: 2016-09-01
Content-Type: application/x-www-form-urlencoded

DomainName=www.test.com&CdnType=live&CdnSubType=live&CdnProtocol=RTMP&Regions=CN&OriginType=domain&OriginProtocol=rtmp&Origin=www.test.com

POST method for adding a wildcard domain name:

POST /2016-09-01/domain/AddCdnDomain 1.1
Host: cdn.api.ksyun.com
X-Amz-Date: date
Authorization:authorization string
x-action: AddCdnDomain
x-version: 2016-09-01
Content-Type: application/x-www-form-urlencoded

DomainName=www.test.com&CdnType=download&CdnSubType=download&CdnProtocol=http&Regions=CN&OriginType=domain&OriginProtocol=http&Origin=www.test.com&SearchUrl=http://test.com/1.html

Sample response

{
 "DomainId": "2D09XC0",
 "DomainStatus":"online"
}
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback