tencent cloud

文档反馈

BindSubDomain

最后更新时间:2024-10-10 21:41:11

    1. API Description

    Domain name for API request: apigateway.tencentcloudapi.com.

    This API is used to bind a custom domain name to a service.
    Each service in API Gateway provides a default domain name for users to call. If you want to use your own domain name, you can bind a custom domain name to the target service. After getting the ICP filing and configuring the CNAME record between the custom and default domain names, you can directly call the custom domain name.

    A maximum of 20 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common Params. The value used for this API: BindSubDomain.
    Version Yes String Common Params. The value used for this API: 2018-08-08.
    Region Yes String Common Params. For more information, please see the list of regions supported by the product.
    ServiceId Yes String Unique service ID.
    SubDomain Yes String Custom domain name to be bound.
    Protocol Yes String Protocol supported by service. Valid values: http, https, http&https.
    NetType Yes String Network type. Valid values: OUTER, INNER.
    IsDefaultMapping Yes Boolean Whether the default path mapping is used. The default value is true. If the value is false, the custom path mapping will be used and PathMappingSet will be required in this case.
    NetSubDomain Yes String Default domain name.
    CertificateId No String Unique certificate ID of the custom domain name to be bound. The certificate can be uploaded if Protocol is https or http&https.
    PathMappingSet.N No Array of PathMapping Custom domain name path mapping. It can contain up to 3 Environment values which can be set to only test, prepub, and release, respectively.
    IsForcedHttps No Boolean Whether to force HTTP requests to redirect to HTTPS. Default value: false. When this parameter is true, API Gateway will redirect all requests using the custom domain name over the HTTP protocol to the HTTPS protocol for forwarding.

    3. Output Parameters

    Parameter Name Type Description
    Result Boolean Whether binding succeeded.
    Note: this field may return null, indicating that no valid values can be obtained.
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Binding with a custom domain name

    This example shows you how to bind with a custom domain name.

    Input Example

    https://apigateway.tencentcloudapi.com/?Action=BindSubDomain
    &ServiceId=service-1w9ekbwo
    &NetType=OUTER
    &SubDomain=xxx.com
    &NetSubDomain=service-1w9ekbwo-1259027407.gz.apigw.tencentcs.com
    &IsDefaultMapping=TRUE
    &PathMappingSet.0.Environment=release
    &PathMappingSet.0.Path=/
    &Protocol=http
    &IsForcedHttps=TRUE
    &<Common Request Parameters>
    

    Output Example

    {
        "Response": {
            "RequestId": "6e00553a-8158-4f70-ad43-e1b046af1502"
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    FailedOperation.CertificateIdEnterpriseWaitSubmit The certificate is an enterprise certificate and waiting to be submitted.
    FailedOperation.CertificateIdError The certificate does not exist or you do not have permission to view it. Please upload a valid certificate in the SSL Certificates Service Console.
    FailedOperation.CertificateIdExpired The certificate has expired. Please upload a valid one.
    FailedOperation.CertificateIdInfoError The certificate information is empty. Please submit a ticket for assistance.
    FailedOperation.CertificateIdUnderVerify The certificate is under review. Please upload a valid one.
    FailedOperation.CertificateIdUnknownError The certificate is in an unknown status. Please submit a ticket to check its specific status.
    FailedOperation.CertificateIdVerifyFail The certificate has been rejected. Please upload a valid one.
    FailedOperation.CertificateIsNull The Apis certificate is empty. Please upload a certificate.
    FailedOperation.DefineMappingEnvironmentError The Apis environment configuration is incorrect.
    FailedOperation.DefineMappingNotNull The Apis custom path mapping cannot be empty.
    FailedOperation.DefineMappingParamRepeat The Apis parameters are repeated.
    FailedOperation.DefineMappingPathError The Apis custom path configuration is incorrect.
    FailedOperation.DomainAlreadyBindOtherService The domain name has been bound to another service.
    FailedOperation.DomainAlreadyBindService The domain name has already been bound to this service.
    FailedOperation.DomainInBlackList Unable to connect: the current domain name is not compliant.
    FailedOperation.DomainNeedBeian The domain name does not have an ICP filing through Tencent Cloud. Please get the ICP filing before binding the domain name.
    FailedOperation.DomainResolveError The domain name is not configured with a CNAME record resolving to the default domain name, or the resolution has not taken effect yet.
    FailedOperation.FormatError The domain name format is incorrect.
    FailedOperation.IsDefaultMapping The Apis custom path conflicts with the default path.
    FailedOperation.NetSubDomainError The entered default second-level domain name is incorrect.
    FailedOperation.ServiceError Service error.
    FailedOperation.ServiceInOperation The service is in use. Please try again later.
    FailedOperation.SubDomainFormatError The custom domain name format is incorrect.
    InternalError Internal error.
    InternalError.ApigwException API Gateway internal request error. Please try again later. If the problem persists, please contact the smart customer service or submit a ticket.
    InternalError.OssException OSS internal request error. Please try again. If the problem persists, please contact the smart customer service or submit a ticket.
    InvalidParameter.FormatError Incorrect parameter format.
    InvalidParameterValue.InvalidProcotol Invalid protocol type parameter.
    LimitExceeded.ExceededDefineMappingLimit You can set up to 3 sets of custom path mappings.
    LimitExceeded.ExceededDomainLimit The number of bound domain names exceeds the limit. You can bind up to 5 domain names by default.
    LimitExceeded.RequestLimitExceeded The request frequency has reached the limit. Please try again later.
    ResourceNotFound.InvalidService The corresponding service is invisible.
    UnsupportedOperation.ForceHttps Cannot force HTTPS when the protocol is HTTP.
    UnsupportedOperation.InvalidServiceTrade The service is currently isolated and therefore the operation is not supported.