Add Acceleration Domain Name

Last updated: 2020-06-05 19:58:07

    Note:

    This is a legacy API which has been hidden and will no longer be updated. We recommend using the new CDN API 3.0 which is standardized and faster.

    1. API Description

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

    Domain for API request:cdn.api.qcloud.com

    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 8.8.8.8:8080). 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

    host: www.test.com
    projectId: 0
    hostType: cname
    origin: 8.8.8.8:8080

    4.2 GET Request

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

    https://cdn.api.qcloud.com/v2/index.php?
    Action=AddCdnHost
    &SecretId=XXXXXXXXXXXXXXXXXXXXXXXXX
    &Timestamp=1462440051
    &Nonce=123456789
    &Signature=XXXXXXXXXXXXXXXXXXXXXXXXXX
    &host=www.test.com
    &projectId=0
    &hostType=cname
    &origin=8.8.8.8:8080

    4.3 POST Request

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

    https://cdn.api.qcloud.com/v2/index.php

    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',
      'SecretId' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX',
      'Timestamp' => 1462868615,
      'Nonce' => 520585444,
      'Signature' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
      'host' => 'www.test.com',
      'projectId' => '0',
      'hostType' => 'cname',
      'origin' => '8.8.8.8:8080'
    )

    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
    }

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help