Add Acceleration Domain Name

Last updated: 2019-11-29 16:40:06


1. API Description

This API (AddCdnHost) is used to add an accelerated domain.

Domain for API

1) The domain to be connected must have not been connected to Tencent Cloud CDN;
2) The domain to be connected must have been filed with MIIT for the record;
3) With this API, only one domain can be added to Tencent Cloud CDN at a time.

2. Input Parameters

The following request parameter list only provides API request parameters. Common request parameters need to be added when the API is called. For more information, refer to Common Request Parameters. The Action field for this API is AddCdnHost.

Parameter Name Required Type Description
host Yes String The domain to be connected
projectId Yes String Project ID, i.e., the ID of the project to which the domain is to be added
hostType Yes String The connection method of the domain. Only two values are available: "cname" means that the user uses a self-owned origin server, and "ftp" means that the user uses FTP hosted origin provided by CDN.Note: If you select FTP, you do not need to enter origin server configurations.
origin No String Configuration of the origin server. You can configure one domain or multiple origin server IPs (the type of "ip:port" is supported, such as The port number should be between 0 and 65535 (exclusive of 0).

3. Output Parameters

Parameter Name Type Description
code Int Common error code; 0: Succeeded; other values: Failed.
message String Module error message description depending on API
codeDesc String English error message or error code at business side.

4. Example

4.1 Input Example

projectId: 0
hostType: cname

4.2 GET Request

For GET request, all the parameters are required to be appended to the URL:

4.3 POST Request

For POST request, the parameters need to be filled in HTTP Request-body. Request address:

Formats such as form-data and x-www-form-urlencoded are supported for the parameters. The array of parameters is as follows:

array (
  'Action' => 'AddCdnHost',
  'Timestamp' => 1462868615,
  'Nonce' => 520585444,
  'host' => '',
  'projectId' => '0',
  'hostType' => 'cname',
  'origin' => ''

4.4 Example of Returned Result

Added successfully

    "code": 0,
    "message": "",
    "codeDesc": "Success"

Addition failed

    "code": 4000,
    "message": "(20004) Not filed cdn audit no icp [cdn audit no icp [The current domain has not been filed with MIIT for the record]]",
    "codeDesc": 20004