Service binding custom domain name

Last updated: 2020-02-21 16:21:26

PDF

Interface description

This API (BindSubDomain) is used to bind a custom domain name to a service.
Each service in the API gateway provides a default domain name for users to call, but when users want to use their own existing domain name, they can also bind the custom domain name to this service. After completing the CNAME with the default domain name, you can directly call the custom domain name.

Input Parameter

The following request parameter list only lists the API request parameters. For other parameters, please see Common Request Parameters .

Parameter name Required Type Description
ServiceId Yes String The service is a unique ID.
SubDomain Yes String The custom domain name to be bound.
CertificateId No String The certificate to be bound to the custom domain name is a unique ID.
IsDefaultMapping No String Whether to use the default path mapping, the default is TRUE. When FALSE, indicates a custom path mapping, which is required for pathMappingSet.
PathMappingSet.n.path No Object The path of the custom path map. When using custom mapping, you can map only one path to one environment at a time, or you can map multiple path to multiple environments. And once a custom mapping is used, the original default mapping rules no longer take effect, only the custom mapping path takes effect.
PathMappingSet.n.environment No Object The name of the environment for the custom path mapping.
Protocol No String By default, the type of Protocol bound to a custom domain name is the same as Protocol, the frontend of the service.

Output Parameter

Parameter name Type Description
Code Int Common error code, 0 indicates success, other values indicate failure. For more information, please see the error code page Common error code .
CodeDesc String Error code on the business side. If a Success, error is returned on success, the cause of the business error is returned.
Message String Module error message description, related to the interface.

Example

Sample input:

https://apigateway.api.qcloud.com/v2/index.php?
&<Common request parameters>
&Action=BindSubDomain
&serviceId=service-XXXX
&subDomain=testSubDomain
&certificate=testcertificate
&pathMapping.0.path=/test
&pathMapping.0.environment=release

Sample output:

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