Modify Domain Configuration

Last updated: 2020-06-05 20:20:18

    Note:

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

    API Description

    This API (UpdateDsaHostInfo) is used to modify the origin server configuration for a domain name.
    Domain name for API request: dsa.api.qcloud.com

    1. For the deactivated or under-deployment domain names, modifying the configuration is not allowed;
    2. You can only modify the configuration for one domain name at a time;
    3. You can modify multiple configuration items for the same domain name at a time;
    4. A maximum of 100 calls to this API are allowed per minute.

    Supported operations

    • Modify origin server configuration.
    • Modify the project of a domain name.
    • Modify HTTPS configuration.
    • Set response header.

    Input Parameters

    The following request parameter list only provides API request parameters. Common request parameters are required when the API is called.The Action field for this API is UpdateDsaHostInfo.

    Parameter Name Required Type Description
    hostId Yes Int The ID of the domain name after it is connected to DSA.
    You can query the hostId of the domain name through the API Query Domain Name List
    projectId No Unsigned The ID of the project to which the domain name is to be added. View the project ID
    origin No String Origin server address. You can enter an origin server domain name or multiple origin server IPs
    Supported format: domain:port or ip:port
    The port number should be between 0 and 65535
    https No String HTTPS configuration information (JSON), which is required when you modify HTTPS configuration. View the HTTPS information
    rspHeader No String Custom header information, which is required when you modify the custom origin-pull header. View the custom header configuration

    HTTPS configuration

    Parameter Name Required Type Description
    type Yes Int Indicates whether to enable HTTPS
    0: Disable
    2: Enable (with "Use HTTP for Origin-Pull" enabled)
    4: Enable (with "Use Request Protocol for Origin-Pull" enabled)
    crt No String Certificate in PEM format. It is required when HTTPS is enabled.
    private_key No String Private key in PEM format. It is required when HTTPS is enabled.
    cert_id No String If HTTPS is enabled and Tencent Cloud-hosted certificate is used, the certificate ID is required
    message No String Remarks
    Note

    You're recommended to submit the certificate information using POST method to prevent the URL length from exceeding the limit.

    Custom header configuration

    The custom origin-pull header is configured in JSON format as shown below:

    {
        "key_name_1":"value_1",
        "key_name_2":"value_2",
        ...
        "key_name_N":"value_N"
    }

    Note

    It is recommended to use POST method for submission when setting the custom header to prevent the URL length from exceeding the limit.

    Output Parameters

    Parameter Name Type Description
    code Int Common error code
    0: Successful
    Other values: Failed.
    For more information, please see Common Error Codes on the Error Codes page.
    message String Module error message description depending on API
    codeDesc String Error message or error code at business side.
    data Object Output result. The modified configuration information of the domain name is returned

    data Field Description

    Parameter Name Type Description
    host_id Int The unique ID of the domain name after it is connected to DSA
    app_id Int APPID of domain name owner
    project_id Unsigned ID of project to which the domain name belongs
    host String Accelerated domain name
    cname String Cname of the domain name after it is connected to DSA
    status String Status of the domain name.
    online: Activated
    offline: Deactivated
    process Int Deployment status
    0: Deployed
    1: Deploying
    mode Int Indicates whether the domain name is blocked; "0" indicates that the domain name is not blocked
    locked Int Indicates whether OPS is locked.
    0: Unlocked. You can directly modify the configuration
    1: Locked. You need to submit a ticket to modify the configuration
    deleted Int Indicates whether the domain name has been deleted.
    0: Not deleted
    1: Deleted
    origin String Origin server address
    fwd_host String Original-pull host configuration
    rsp_header Array Custom response header configuration information
    https Object HTTPS configuration information as described below.
    message String Message description
    create_time String Creation time of domain name
    update_time String Last update time of domain name configuration

    HTTPS Field Description

    Parameter Name Type Description
    type Unsigned Indicates whether to enable HTTPS
    0: Disable
    2: Enable (with "Use HTTP for Origin-Pull" enabled)
    4: Enable (with "Use Request Protocol for Origin-Pull" enabled)
    cert_id String Tencent Cloud-hosted certificate ID, which is returned when a Tencent Cloud-hosted certificate is used
    cn String Certificate domain name
    expire String Expiration time of the SSL certificate
    message String Certificate remarks
    http2 String Indicates whether to enable HTTP 2.0
    on: Enable
    off: Disable

    Note:

    The fields not described above are inapplicable fields and can be ignored.

    Sample Code: Modify Origin Server Address

    Configuration Example

    Modify the origin server address of dsa.qcloud.com from source.dsa.qcloud.com to source2.dsa.qcloud.com

    host: dsa.qcloud.com
    hostId: 1234
    origin: source2.dsa.qcloud.com

    GET Request

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

    https://dsa.api.qcloud.com/v2/index.php?
    Action=UpdateDsaHostInfo
    &SecretId=XXXXXXXXXXXXXXXXXXXXXXXXXXX
    &Timestamp=1462520137
    &Nonce=123456789
    &Signature=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    &hostId=1234
    &origin=source2.dsa.qcloud.com

    POST Request

    For a POST request, the parameters are input in HTTP Request-body. The request address is:

    https://dsa.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' => 'UpdateDsaHostInfo',
      'SecretId' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX',
      'Timestamp' => 1462782282,
      'Nonce' => 123456789,
      'Signature' => 'XXXXXXXXXXXXXXXXXXXXXXXX',
      'hostId' => '1234',
      'origin' => 'source2.dsa.qcloud.com',
    )

    Example of returned result

    Modified successfully

    {
        "code": 0,
        "message": "",
        "codeDesc": "Success",
        "data": {
            "host_id": 1234,
            "app_id": *******,
            "project_id": 0,
            "host": "dsa.qcloud.com",
            "cname": "dsa.qcloud.com.dsa.dnsv1.com",
            "status": "online",
            "progress": 0,
            "mode": 0,
            "locked": 0,
            "deleted": 0,
            "origin": "source2.dsa.qcloud.com",
            "fwd_host": "dsa.qcloud.com",
            "rsp_header": [],
            "https": {"type": 0},
            "ip_access":{"type":"off","ips":[]},
            "ip_freq_limit":0,
            "message": "",
            "create_time": "2017-11-17 11:07:08",
            "update_time": "2018-01-28 12:52:02"
        }
    }

    Modification failed

    {
        "code": 4000,
        "message": "(2000) Accelerated domain name does not exist",
        "codeDesc": "InvalidParameter"
    }

    Sample Code: Modify HTTPS Configuration

    Configuration Example

    Enable HTTPS configuration for the domain name dsa.qcloud.com, and use self-owned certificate and "Use Request Protocol for Origin-Pull"

    host: dsa.qcloud.com
    hostId: 1234
    Origin-Pull mode: Use Request Protocol for Origin-Pull
    Certificate information: ***
    Private key of certificate: ***

    GET Request

    When uploading certificate information, do not use Get method to submit configuration modification request to prevent URL length from exceeding the limit.

    POST Request

    For a POST request, the parameters are input in HTTP Request-body. The request address is:

    https://dsa.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' => 'UpdateDsaHostInfo',
      'SecretId' => 'SecretId',
      'Timestamp' => 1462782282,
      'Nonce' => 123456789,
      'Signature' => 'Signature',
      'hostId' => '1234',
      'https' => '{"type":4,"crt":"certificate content","private_key":"certificate's private key content"}',
    )

    Example of returned result

    Modified successfully

    {
        "code": 0,
        "message": "",
        "codeDesc": "Success",
        "data": {
            "host_id": 1234,
            "app_id": *******,
            "project_id": 0,
            "host": "dsa.qcloud.com",
            "cname": "dsa.qcloud.com.dsa.dnsv1.com",
            "status": "online",
            "progress": 0,
            "mode": 0,
            "locked": 0,
            "deleted": 0,
            "origin": "source.dsa.qcloud.com",
            "fwd_host": "dsa.qcloud.com",
            "rsp_header": [],
            "https": {
                "type": 4
                "crt":"***************"
                "private_key":"***************"
            },
            "message": "",
            "create_time": "2017-11-17 11:07:08",
            "update_time": "2018-01-28 12:52:02"
        }
    }

    Modification failed

    {
        "code": 4000,
        "message": "(3003) Certificate does not match private key",
        "codeDesc": "InvalidParameter"
    }

    Was this page helpful?

    Was this page helpful?

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