Updated on 2024-03-25 GMT+08:00

Creating a Custom Line

Function

This API is used to create a custom line.

Calling Method

For details, see Calling APIs.

URI

POST /v2.1/customlines

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Resolution line name. The value consists of 1 to 80 characters including letters, digits, hyphens (-), underscores (_), and periods (.). The name of each resolution line set by one account must be unique.

ip_segments

Yes

Array of strings

IP address range. The start IP address is separated from the end IP address with a hyphen (-). The IP address ranges cannot overlap. If the start and end IP addresses are the same, there is only one IP address in the range. Set the value to IP1-IP1. Currently, only IPv4 addresses are supported. You can specify a maximum of 50 IP address ranges.

description

No

String

Custom line description. A maximum of 255 characters are allowed. It is left blank by default.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

line_id

String

Resolution line ID

name

String

Custom line name

ip_segments

Array of strings

IP address range

created_at

String

Time when the custom line was created

updated_at

String

Time when the custom line was updated

status

String

Resource status

description

String

Custom line description

Example Requests

Creating a custom line and setting the IP address range to 1.1.1.1-1.1.1.1 and 1.1.1.2-1.1.1.3

POST https://{endpoint}/v2.1/customlines

{
  "name" : "customline",
  "ip_segments" : [ "1.1.1.1-1.1.1.1", "1.1.1.2-1.1.1.3" ],
  "description" : "123"
}

Example Responses

Status code: 200

Request for creating a custom line

{
  "line_id" : "custom_2ce45ef669fc87870169fcbada7a0007",
  "name" : "customline",
  "ip_segments" : [ "1.1.1.1-1.1.1.1", "1.1.1.2-1.1.1.3" ],
  "status" : "PENDING_CREATE",
  "created_at" : "2019-04-10T12:03:17.827",
  "updated_at" : null,
  "description" : "123"
}

Status Codes

Status Code

Description

200

Request for creating a custom line

Error Codes

See Error Codes.