Updated on 2022-08-05 GMT+08:00

Querying the Template List

Function

This API is used to query the templates for creating target servers.

URI

GET /v1/sms/vm/templates

Request

Request parameters

For details about the request parameters, see Table 1.

Table 1 Parameter description

Parameter

Mandatory

Type

Description

name

No

String

Template name

availability_zone

No

String

AZ

region

No

String

Region ID

Number_per_page

No

Integer

Page size. The default value is 50.

Page_num

No

Integer

Start page number. The default value is 0.

Response

Response parameters

For details about the response parameters, see Table 3.

Table 2 Response parameters

Parameter

Type

Description

count

String

Template quantity

templates

String

Template information. For details, see Table 2.

Table 3 templates information

Parameter

Type

Description

name

String

Template name

id

String

Template ID

region

String

Region ID

availability_zone

String

AZ

volumetype

String

Disk type

vpc

Object

VPC information. For details, see Table 4.

nics

Array

Subnet information. For details, see Table 6.

security_groups

Array

Security group. For details, see Table 5.

publicip

Object

EIP information. For details, see Table 7.

Table 4 vpc information

Parameter

Type

Description

id

String

VPC ID

name

String

VPC name

Table 5 security_groups information

Parameter

Type

Description

id

String

Security group ID

name

String

Security group name

Table 6 nics information

Parameter

Type

Description

id

String

Subnet ID

name

String

Subnet name

cidr

String

Subnet gateway/mask

Table 7 publicip information

Parameter

Type

Description

type

String

EIP type. The default value is 5_bgp.

bandwidth_size

Integer

Bandwidth size (Mbit/s).

The value range is 1 to 2000.

The minimum increment for bandwidth adjustment varies depending on the bandwidth range.

The minimum increment is 1 Mbit/s if the allowed bandwidth ranges from 0 to 300 Mbit/s (with 300 Mbit/s included). The minimum increment is 50 Mbit/s if the allowed bandwidth ranges 300 Mbit/s to 1000 Mbit/s (with 1000 Mbit/s included). The minimum increment is 500 Mbit/s if the allowed bandwidth is greater than 1000 Mbit/s.

NOTE:

This parameter is mandatory when sharetype is set to PER and is optional when sharetype is set to WHOLE with an ID specified.

Example

  • Example request
    GET  v1/sms/vm/templates?name=temp1
  • Example response
    { 
      "count":1, 
      "templates":[
        { 
          "name":"temp1",
          "id":"abcdefghijk-aa-bbb",
          
          
          
          
          
          
          "region":"ae-ad-1",
          
          "availability_zone":"AZ1",
          
          
          
          
          "volumetype":"SATA",
          "vpc":{
             "id":"0dae26c9-9a70-4392-93f3-87d53115d171",
             "name":"vpc1" 
          },
          "nics":[
            {
              "id":"157ee789-03ea-45b1-a698-76c92660dd83",
              "name": "subnet-1637",
              "cidr": "192.168.0.0/24"
            }
          ],
         "security_groups":[
            {
              "id":"507ca48f-814c-4293-8706-300564d54620", 
              "name":"default"
            }
          ], 
          "publicip":  {
               "type": "5_bgp",
               "bandwidth_size":10,
          }
        } 
      ] 
    }

Status Codes

See Status Codes.

Error Codes

See Out-of-Date Error Codes.