Updated on 2022-09-01 GMT+08:00

Binding a Domain Name

Function

Domain names are user-defined, and take effect only after CNAME records are added to point the domain names to subdomain names of API groups. For details, see Adding a CNAME Record Set.

An API group can be bound to a maximum of five domain names. After you bind a domain name to an API group, APIs in the group can be called using the domain name.

URI

The following table lists the HTTP/HTTPS request method and URI of the API.

Table 1 HTTP/HTTPS request method and URI

Request Method

URI

POST

/v1.0/apigw/api-groups/{group_id}/domains

The following table lists the parameter in the URI.

Table 2 Parameter description

Parameter

Mandatory

Type

Description

group_id

Yes

String

API group ID

Request

Table 3 Parameter description

Parameter

Mandatory

Type

Description

url_domain

Yes

String

Domain name

A domain name consists of a maximum of 255 characters and must comply with domain name specifications.

Example request:

{
   "url_domain": "www.MyCompany.com"
}

Response

Table 4 Parameter description

Parameter

Type

Description

id

String

Domain ID

url_domain

String

Domain name

status

Integer

CNAME resolution status, which can be:

  • 1: not resolved
  • 2: in progress
  • 3: successful
  • 4: failed

Example response:

{
	"id": "c5e0d5ba62a34d26ad5c709ae22c1a17",
	"url_domain": "www.MyCompany.com",
	"status": 3
}

Status Codes

Table 5 Status codes

Status Code

Description

201

Created

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Server Internal Error