Updated on 2024-06-11 GMT+08:00

Creating a Domain Name

Function

This API is used to create a domain name.

URI

POST /v1.0/cdn/domains

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the corresponding IAM API (value of X-Subject-Token in the response header).

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

domain

Yes

DomainBody object

Body for creating a domain name.

Table 3 DomainBody

Parameter

Mandatory

Type

Description

domain_name

Yes

String

Domain name. The domain name consists of one or more parts, representing domains at different levels. These parts, technically known as labels, are concatenated and delimited by periods (.). A label consists of case-insensitive letters, numbers, and hyphens (-). The domain name can contain up to 75 characters. Do not start or end a domain name with hyphens (-).

business_type

Yes

String

Service type. Possible values: web (website acceleration), download (download acceleration), and video (on-demand service acceleration).

sources

Yes

Array of Sources objects

Origin server settings.

service_area

Yes

String

Service area of the domain name. Possible values: europe (Europe) and outside_mainland_china (outside the Chinese mainland).

enterprise_project_id

No

String

Enterprise project to which the domain name is added. This parameter is valid only when the enterprise project function is enabled. This parameter is mandatory when you use an IAM user to call this API.

Obtain the enterprise project ID by calling the API for listing enterprise projects of Enterprise Project Management Service (EPS).

Table 4 Sources

Parameter

Mandatory

Type

Description

origin_type

Yes

String

Origin server type. Possible values: ipaddr (IP address) and domain (domain name).

ip_or_domain

Yes

String

Non-intranet IP address or domain name of the origin server.

active_standby

Yes

Integer

Whether the origin server is primary or standby. Possible values: 1 (primary) and 0 (standby).

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

domain

CreateDomainResponseBodyContent object

Response to the request for creating a domain name.

Table 6 CreateDomainResponseBodyContent

Parameter

Type

Description

id

String

Domain name ID.

domain_name

String

Domain name.

business_type

String

Service type of the domain name. Possible values:

  • web: website acceleration.
  • download: file download acceleration.
  • video: on-demand service acceleration.

service_area

String

Service area of the domain name. Possible values: europe (Europe) and outside_mainland_china (outside the Chinese mainland).

domain_status

String

Domain name status. Possible values:

  • online: CDN has been enabled for this domain name.
  • offline: CDN has been disabled for this domain name.
  • configuring: The domain name configuration is in progress.
  • configure_failed: The configuration fails.
  • checking: The domain is being reviewed.
  • check_failed: The domain name fails the review.
  • deleting: The domain name is being deleted.

cname

String

CNAME record of the domain name.

sources

Array of Sources objects

Origin server details.

https_status

Integer

Whether HTTPS is enabled for acceleration.

create_time

Long

Time when the domain name was created. The value is the number of milliseconds since the UNIX epoch (Jan 1, 1970).

modify_time

Long

Time when the domain name was modified. The value is the number of milliseconds since the UNIX epoch (Jan 1, 1970).

disabled

Integer

Whether the domain name is banned. Possible values: 0 (not banned) and 1 (banned).

locked

Integer

Whether the domain name is locked. Possible values: 0 (not locked) and 1 (locked).

range_status

String

Whether range-based retrieval is enabled. Possible values: off (disabled) and on (enabled).

follow_status

String

Status of 302 redirect. Possible values: off (disabled) and on (enabled).

origin_status

String

Origin pull status. off: disabled. on: enabled.

Table 7 Sources

Parameter

Type

Description

origin_type

String

Origin server type. Possible values: ipaddr (IP address) and domain (domain name).

ip_or_domain

String

Non-intranet IP address or domain name of the origin server.

active_standby

Integer

Whether the origin server is primary or standby. Possible values: 1 (primary) and 0 (standby).

Example Requests

POST https://cdn.myhuaweicloud.eu/v1.0/cdn/domains

{
  "domain" : {
    "domain_name" : "example1.example2.example3.com",
    "business_type" : "web",
    "sources" : [ {
      "ip_or_domain" : "example.origin.com",
      "origin_type" : "domain",
      "active_standby" : 1
    } ],
    "service_area" : "europe",
    "enterprise_project_id" : "0"
  }
}

Example Responses

Status code: 200

OK

{
  "domain" : {
    "sources" : {
      "ip_or_domain" : "example.origin.com",
      "origin_type" : "domain",
      "active_standby" : 1
    },
    "id" : "ff80*************************07b",
    "domain_name" : "example11.example2.example3.com",
    "business_type" : "web",
    "service_area" : "europe",
    "cname" : "example1.example2.example3.com.c.example4.com",
    "domain_status" : "configuring",
    "https_status" : 0,
    "create_time" : 1513152634467,
    "modify_time" : 1513152634467,
    "disabled" : 0,
    "locked" : 0,
    "range_status" : "off",
    "follow_status" : "off",
    "origin_status" : "on"
  }
}

Status Codes

Status Code

Description

200

OK