GET /api/subnets
子網路清單

GET /api/domains/:domain_id/subnets
區域的子網路清單

GET /api/locations/:location_id/subnets
各個位置上的子網路之清單

GET /api/organizations/:organization_id/subnets
各個組織中的子網路之清單

示例

GET /api/subnets
200
{
  "total": 7,
  "subtotal": 7,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "network": "2.3.4.0",
      "network_type": "IPv4",
      "cidr": 24,
      "mask": "255.255.255.0",
      "priority": null,
      "vlanid": 41,
      "mtu": 1500,
      "gateway": null,
      "dns_primary": null,
      "dns_secondary": null,
      "from": null,
      "to": null,
      "created_at": "2019-11-07 08:37:37 UTC",
      "updated_at": "2019-11-07 08:37:37 UTC",
      "ipam": "None",
      "boot_mode": "DHCP",
      "id": 980190962,
      "name": "one",
      "description": null,
      "network_address": "2.3.4.0/24",
      "dhcp_id": 980190962,
      "dhcp_name": "DHCP Proxy",
      "tftp_id": 298486374,
      "tftp_name": "TFTP Proxy",
      "httpboot_id": null,
      "httpboot_name": null,
      "dns_id": 113629430,
      "template_id": null,
      "template_name": null,
      "dhcp": {
        "name": "DHCP Proxy",
        "id": 980190962,
        "url": "https://somewhere.net:8443"
      },
      "tftp": {
        "name": "TFTP Proxy",
        "id": 298486374,
        "url": "http://somewhere.else"
      },
      "httpboot": null,
      "dns": {
        "name": "DNS Proxy",
        "id": 113629430,
        "url": "http://else.where:45671"
      },
      "template": null
    },
    {
      "network": "3.3.4.0",
      "network_type": "IPv4",
      "cidr": 24,
      "mask": "255.255.255.0",
      "priority": null,
      "vlanid": 42,
      "mtu": 1496,
      "gateway": null,
      "dns_primary": null,
      "dns_secondary": null,
      "from": null,
      "to": null,
      "created_at": "2019-11-07 08:37:37 UTC",
      "updated_at": "2019-11-07 08:37:37 UTC",
      "ipam": "None",
      "boot_mode": "DHCP",
      "id": 298486374,
      "name": "two",
      "description": null,
      "network_address": "3.3.4.0/24",
      "dhcp_id": 980190962,
      "dhcp_name": "DHCP Proxy",
      "tftp_id": 298486374,
      "tftp_name": "TFTP Proxy",
      "httpboot_id": null,
      "httpboot_name": null,
      "dns_id": null,
      "template_id": null,
      "template_name": null,
      "dhcp": {
        "name": "DHCP Proxy",
        "id": 980190962,
        "url": "https://somewhere.net:8443"
      },
      "tftp": {
        "name": "TFTP Proxy",
        "id": 298486374,
        "url": "http://somewhere.else"
      },
      "httpboot": null,
      "dns": null,
      "template": null
    },
    {
      "network": "3.3.4.3",
      "network_type": "IPv4",
      "cidr": 24,
      "mask": "255.255.255.0",
      "priority": null,
      "vlanid": 43,
      "mtu": 1500,
      "gateway": null,
      "dns_primary": null,
      "dns_secondary": null,
      "from": null,
      "to": null,
      "created_at": "2019-11-07 08:37:37 UTC",
      "updated_at": "2019-11-07 08:37:37 UTC",
      "ipam": "None",
      "boot_mode": "DHCP",
      "id": 113629430,
      "name": "three",
      "description": null,
      "network_address": "3.3.4.3/24",
      "dhcp_id": 980190962,
      "dhcp_name": "DHCP Proxy",
      "tftp_id": 298486374,
      "tftp_name": "TFTP Proxy",
      "httpboot_id": null,
      "httpboot_name": null,
      "dns_id": null,
      "template_id": null,
      "template_name": null,
      "dhcp": {
        "name": "DHCP Proxy",
        "id": 980190962,
        "url": "https://somewhere.net:8443"
      },
      "tftp": {
        "name": "TFTP Proxy",
        "id": 298486374,
        "url": "http://somewhere.else"
      },
      "httpboot": null,
      "dns": null,
      "template": null
    },
    {
      "network": "3.3.5.0",
      "network_type": "IPv4",
      "cidr": 24,
      "mask": "255.255.255.0",
      "priority": null,
      "vlanid": 44,
      "mtu": 9000,
      "gateway": null,
      "dns_primary": null,
      "dns_secondary": null,
      "from": null,
      "to": null,
      "created_at": "2019-11-07 08:37:37 UTC",
      "updated_at": "2019-11-07 08:37:37 UTC",
      "ipam": "None",
      "boot_mode": "DHCP",
      "id": 281110143,
      "name": "four",
      "description": null,
      "network_address": "3.3.5.0/24",
      "dhcp_id": null,
      "dhcp_name": null,
      "tftp_id": 298486374,
      "tftp_name": "TFTP Proxy",
      "httpboot_id": null,
      "httpboot_name": null,
      "dns_id": null,
      "template_id": null,
      "template_name": null,
      "dhcp": null,
      "tftp": {
        "name": "TFTP Proxy",
        "id": 298486374,
        "url": "http://somewhere.else"
      },
      "httpboot": null,
      "dns": null,
      "template": null
    },
    {
      "network": "2001:db10:7::",
      "network_type": "IPv6",
      "cidr": 64,
      "mask": "ffff:ffff:ffff:ffff::",
      "priority": null,
      "vlanid": 44,
      "mtu": 9000,
      "gateway": null,
      "dns_primary": null,
      "dns_secondary": null,
      "from": null,
      "to": null,
      "created_at": "2019-11-07 08:37:37 UTC",
      "updated_at": "2019-11-07 08:37:37 UTC",
      "ipam": "None",
      "boot_mode": "DHCP",
      "id": 374648174,
      "name": "seven",
      "description": null,
      "network_address": "2001:db10:7::/64",
      "dhcp_id": null,
      "dhcp_name": null,
      "tftp_id": null,
      "tftp_name": null,
      "httpboot_id": null,
      "httpboot_name": null,
      "dns_id": 113629430,
      "template_id": null,
      "template_name": null,
      "dhcp": null,
      "tftp": null,
      "httpboot": null,
      "dns": {
        "name": "DNS Proxy",
        "id": 113629430,
        "url": "http://else.where:45671"
      },
      "template": null
    },
    {
      "network": "2001:db10::",
      "network_type": "IPv6",
      "cidr": 64,
      "mask": "ffff:ffff:ffff:ffff::",
      "priority": null,
      "vlanid": null,
      "mtu": 1500,
      "gateway": null,
      "dns_primary": null,
      "dns_secondary": null,
      "from": null,
      "to": null,
      "created_at": "2019-11-07 08:37:37 UTC",
      "updated_at": "2019-11-07 08:37:37 UTC",
      "ipam": "None",
      "boot_mode": "DHCP",
      "id": 51848956,
      "name": "six",
      "description": null,
      "network_address": "2001:db10::/64",
      "dhcp_id": null,
      "dhcp_name": null,
      "tftp_id": null,
      "tftp_name": null,
      "httpboot_id": null,
      "httpboot_name": null,
      "dns_id": 113629430,
      "template_id": null,
      "template_name": null,
      "dhcp": null,
      "tftp": null,
      "httpboot": null,
      "dns": {
        "name": "DNS Proxy",
        "id": 113629430,
        "url": "http://else.where:45671"
      },
      "template": null
    },
    {
      "network": "10.0.0.0",
      "network_type": "IPv4",
      "cidr": 24,
      "mask": "255.255.255.0",
      "priority": null,
      "vlanid": null,
      "mtu": 1500,
      "gateway": null,
      "dns_primary": null,
      "dns_secondary": null,
      "from": null,
      "to": null,
      "created_at": "2019-11-07 08:37:37 UTC",
      "updated_at": "2019-11-07 08:37:37 UTC",
      "ipam": "None",
      "boot_mode": "DHCP",
      "id": 1018350795,
      "name": "five",
      "description": null,
      "network_address": "10.0.0.0/24",
      "dhcp_id": 980190962,
      "dhcp_name": "DHCP Proxy",
      "tftp_id": 298486374,
      "tftp_name": "TFTP Proxy",
      "httpboot_id": null,
      "httpboot_name": null,
      "dns_id": 113629430,
      "template_id": null,
      "template_name": null,
      "dhcp": {
        "name": "DHCP Proxy",
        "id": 980190962,
        "url": "https://somewhere.net:8443"
      },
      "tftp": {
        "name": "TFTP Proxy",
        "id": 298486374,
        "url": "http://somewhere.else"
      },
      "httpboot": null,
      "dns": {
        "name": "DNS Proxy",
        "id": 113629430,
        "url": "http://else.where:45671"
      },
      "template": null
    }
  ]
}

參數

參數名字 描述
domain_id
選填

區域的 ID

Validations:

  • Must be a String

location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

search
選填

篩選結果

Validations:

  • Must be a String

order
選填

Sort field and order, eg. ‘id DESC’

Validations:

  • Must be a String

page
選填

頁數,從 1 開始

Validations:

  • Must be a number.

per_page
選填

每頁要傳回的結果數量

Validations:

  • Must be a number.

Search fields

Field name 類型 Possible values
boot_mode string
dns_primary string
dns_secondary string
domain string
gateway string
ipam string
location string
location_id integer
mask string
mtu integer
name text
network string
nic_delay integer
organization string
organization_id integer
params text
type string
vlanid integer

GET /api/subnets/:id
顯示子網路

示例

GET /api/subnets/980190962-one
200
{
  "network": "2.3.4.0",
  "network_type": "IPv4",
  "cidr": 24,
  "mask": "255.255.255.0",
  "priority": null,
  "vlanid": 41,
  "mtu": 1500,
  "gateway": null,
  "dns_primary": null,
  "dns_secondary": null,
  "from": null,
  "to": null,
  "created_at": "2019-11-07 08:37:37 UTC",
  "updated_at": "2019-11-07 08:37:37 UTC",
  "ipam": "None",
  "boot_mode": "DHCP",
  "id": 980190962,
  "name": "one",
  "description": null,
  "network_address": "2.3.4.0/24",
  "dhcp_id": 980190962,
  "dhcp_name": "DHCP Proxy",
  "tftp_id": 298486374,
  "tftp_name": "TFTP Proxy",
  "httpboot_id": null,
  "httpboot_name": null,
  "dns_id": 113629430,
  "template_id": null,
  "template_name": null,
  "dhcp": {
    "name": "DHCP Proxy",
    "id": 980190962,
    "url": "https://somewhere.net:8443"
  },
  "tftp": {
    "name": "TFTP Proxy",
    "id": 298486374,
    "url": "http://somewhere.else"
  },
  "httpboot": null,
  "dns": {
    "name": "DNS Proxy",
    "id": 113629430,
    "url": "http://else.where:45671"
  },
  "template": null,
  "domains": [
    {
      "id": 22495316,
      "name": "mydomain.net"
    }
  ],
  "interfaces": [],
  "parameters": [],
  "locations": [
    {
      "id": 255093256,
      "name": "Location 1",
      "title": "Location 1",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 447626438,
      "name": "Organization 1",
      "title": "Organization 1",
      "description": null
    }
  ]
}

參數

參數名字 描述
location_id
選填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
選填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

show_hidden_parameters
選填

Display hidden parameter values

Validations:

  • Must be one of: true, false, 1, 0.


POST /api/subnets
建立子網路

示例

POST /api/subnets
{
  "subnet": {
    "name": "QA2",
    "network_type": "IPv6",
    "network": "2001:db8::",
    "mask": "ffff:ffff:ffff:ffff::",
    "ipam": "None"
  }
}
201
{
  "network": "2001:db8::",
  "network_type": "IPv6",
  "cidr": 64,
  "mask": "ffff:ffff:ffff:ffff::",
  "priority": null,
  "vlanid": null,
  "mtu": 1500,
  "gateway": null,
  "dns_primary": null,
  "dns_secondary": null,
  "from": null,
  "to": null,
  "created_at": "2019-11-07 08:38:14 UTC",
  "updated_at": "2019-11-07 08:38:14 UTC",
  "ipam": "None",
  "boot_mode": "DHCP",
  "id": 1018350830,
  "name": "QA2",
  "description": null,
  "network_address": "2001:db8::/64",
  "dhcp_id": null,
  "dhcp_name": null,
  "tftp_id": null,
  "tftp_name": null,
  "httpboot_id": null,
  "httpboot_name": null,
  "dns_id": null,
  "template_id": null,
  "template_name": null,
  "dhcp": null,
  "tftp": null,
  "httpboot": null,
  "dns": null,
  "template": null,
  "domains": [],
  "interfaces": [],
  "parameters": [],
  "locations": [],
  "organizations": []
}

參數

參數名字 描述
location_id
選填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
選填

Set the current organization context for the request

Validations:

  • Must be a Integer

subnet
必填

Validations:

  • Must be a Hash

subnet[name]
必填

子網路名稱

Validations:

  • Must be a String

subnet[description]
選填 , 允許空值

Subnet description

Validations:

  • Must be a String

subnet[network_type]
選填 , 允許空值

Type or protocol, IPv4 or IPv6, defaults to IPv4

Validations:

  • Must be one of: IPv4, IPv6.

subnet[network]
必填

子網路

Validations:

  • Must be a String

subnet[mask]
必填

這個子網路的網路遮罩

Validations:

  • Must be a String

subnet[gateway]
選填 , 允許空值

Subnet gateway

Validations:

  • Must be a String

subnet[dns_primary]
選填 , 允許空值

這個子網路的主要 DNS

Validations:

  • Must be a String

subnet[dns_secondary]
選填 , 允許空值

這個子網路的次要 DNS

Validations:

  • Must be a String

subnet[ipam]
選填 , 允許空值

這個子網路的 IP 位址自動建議模式,有效的值為「DHCP」、「Internal DB」、「None」

Validations:

  • Must be a String

subnet[from]
選填 , 允許空值

IP 自動建議的起始 IP 位址

Validations:

  • Must be a String

subnet[to]
選填 , 允許空值

IP 自動建議的結尾 IP 位址

Validations:

  • Must be a String

subnet[vlanid]
選填 , 允許空值

這個子網路的 VLAN ID

Validations:

  • Must be a String

subnet[mtu]
選填 , 允許空值

MTU for this subnet

Validations:

  • Must be a Integer

subnet[domain_ids]
選填 , 允許空值

這個子網路所屬於的網域

Validations:

  • Must be an array of any type

subnet[dhcp_id]
選填 , 允許空值

DHCP Proxy ID to use within this subnet

Validations:

  • Must be a number.

subnet[tftp_id]
選填 , 允許空值

TFTP Proxy ID to use within this subnet

Validations:

  • Must be a number.

subnet[httpboot_id]
選填 , 允許空值

HTTPBoot Proxy ID to use within this subnet

Validations:

  • Must be a number.

subnet[dns_id]
選填 , 允許空值

DNS Proxy ID to use within this subnet

Validations:

  • Must be a number.

subnet[template_id]
選填 , 允許空值

Template HTTP(S) Proxy ID to use within this subnet

Validations:

  • Must be a number.

subnet[boot_mode]
選填 , 允許空值

指定給這個子網路的介面卡的預設啟動模式,有效的值為「Static」、「DHCP」

Validations:

  • Must be a String

subnet[subnet_parameters_attributes]
選填 , 允許空值

參數陣列(名稱、值)

Validations:

  • Must be an array of any type

subnet[location_ids]
選填 , 允許空值

將位置取代為特定 ID

Validations:

  • Must be an array of any type

subnet[organization_ids]
選填 , 允許空值

將組織取代為特定 ID。

Validations:

  • Must be an array of any type


PUT /api/subnets/:id
更新子網路

示例

PUT /api/subnets/1018350829
{
  "subnet": {
    "subnet_parameters_attributes": [
      {
        "name": "new_key",
        "value": "new_value"
      }
    ]
  }
}
200
{
  "network": "135.31.20.0",
  "network_type": "IPv4",
  "cidr": 24,
  "mask": "255.255.255.0",
  "priority": null,
  "vlanid": null,
  "mtu": 1500,
  "gateway": null,
  "dns_primary": null,
  "dns_secondary": null,
  "from": null,
  "to": null,
  "created_at": "2019-11-07 08:38:14 UTC",
  "updated_at": "2019-11-07 08:38:14 UTC",
  "ipam": "None",
  "boot_mode": "DHCP",
  "id": 1018350829,
  "name": "subnet116",
  "description": null,
  "network_address": "135.31.20.0/24",
  "dhcp_id": null,
  "dhcp_name": null,
  "tftp_id": null,
  "tftp_name": null,
  "httpboot_id": null,
  "httpboot_name": null,
  "dns_id": null,
  "template_id": null,
  "template_name": null,
  "dhcp": null,
  "tftp": null,
  "httpboot": null,
  "dns": null,
  "template": null,
  "domains": [],
  "interfaces": [],
  "parameters": [
    {
      "priority": 40,
      "created_at": "2019-11-07 08:38:14 UTC",
      "updated_at": "2019-11-07 08:38:14 UTC",
      "id": 767575245,
      "name": "new_key",
      "parameter_type": "string",
      "value": "new_value"
    }
  ],
  "locations": [
    {
      "id": 255093256,
      "name": "Location 1",
      "title": "Location 1",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 447626438,
      "name": "Organization 1",
      "title": "Organization 1",
      "description": null
    }
  ]
}

參數

參數名字 描述
location_id
選填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
選填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

子網路的數字辨識子

Validations:

  • Must be a number.

subnet
必填

Validations:

  • Must be a Hash

subnet[name]
選填

子網路名稱

Validations:

  • Must be a String

subnet[description]
選填 , 允許空值

Subnet description

Validations:

  • Must be a String

subnet[network_type]
選填 , 允許空值

Type or protocol, IPv4 or IPv6, defaults to IPv4

Validations:

  • Must be one of: IPv4, IPv6.

subnet[network]
選填

子網路

Validations:

  • Must be a String

subnet[mask]
選填

這個子網路的網路遮罩

Validations:

  • Must be a String

subnet[gateway]
選填 , 允許空值

Subnet gateway

Validations:

  • Must be a String

subnet[dns_primary]
選填 , 允許空值

這個子網路的主要 DNS

Validations:

  • Must be a String

subnet[dns_secondary]
選填 , 允許空值

這個子網路的次要 DNS

Validations:

  • Must be a String

subnet[ipam]
選填 , 允許空值

這個子網路的 IP 位址自動建議模式,有效的值為「DHCP」、「Internal DB」、「None」

Validations:

  • Must be a String

subnet[from]
選填 , 允許空值

IP 自動建議的起始 IP 位址

Validations:

  • Must be a String

subnet[to]
選填 , 允許空值

IP 自動建議的結尾 IP 位址

Validations:

  • Must be a String

subnet[vlanid]
選填 , 允許空值

這個子網路的 VLAN ID

Validations:

  • Must be a String

subnet[mtu]
選填 , 允許空值

MTU for this subnet

Validations:

  • Must be a Integer

subnet[domain_ids]
選填 , 允許空值

這個子網路所屬於的網域

Validations:

  • Must be an array of any type

subnet[dhcp_id]
選填 , 允許空值

DHCP Proxy ID to use within this subnet

Validations:

  • Must be a number.

subnet[tftp_id]
選填 , 允許空值

TFTP Proxy ID to use within this subnet

Validations:

  • Must be a number.

subnet[httpboot_id]
選填 , 允許空值

HTTPBoot Proxy ID to use within this subnet

Validations:

  • Must be a number.

subnet[dns_id]
選填 , 允許空值

DNS Proxy ID to use within this subnet

Validations:

  • Must be a number.

subnet[template_id]
選填 , 允許空值

Template HTTP(S) Proxy ID to use within this subnet

Validations:

  • Must be a number.

subnet[boot_mode]
選填 , 允許空值

指定給這個子網路的介面卡的預設啟動模式,有效的值為「Static」、「DHCP」

Validations:

  • Must be a String

subnet[subnet_parameters_attributes]
選填 , 允許空值

參數陣列(名稱、值)

Validations:

  • Must be an array of any type

subnet[location_ids]
選填 , 允許空值

將位置取代為特定 ID

Validations:

  • Must be an array of any type

subnet[organization_ids]
選填 , 允許空值

將組織取代為特定 ID。

Validations:

  • Must be an array of any type


DELETE /api/subnets/:id
刪除子網路

示例

DELETE /api/subnets/281110143-four
{
  "subnet": {}
}
200
{
  "id": 281110143,
  "network": "3.3.5.0",
  "mask": "255.255.255.0",
  "priority": null,
  "name": "four",
  "vlanid": 44,
  "created_at": "2019-11-07T08:37:37.209Z",
  "updated_at": "2019-11-07T08:37:37.209Z",
  "dhcp_id": null,
  "tftp_id": 298486374,
  "gateway": null,
  "dns_primary": null,
  "dns_secondary": null,
  "from": null,
  "to": null,
  "dns_id": null,
  "boot_mode": "DHCP",
  "ipam": "None",
  "description": null,
  "mtu": 9000,
  "template_id": null,
  "httpboot_id": null,
  "nic_delay": null,
  "to_label": "four (3.3.5.0/24)",
  "type": "Subnet::Ipv4"
}

參數

參數名字 描述
location_id
選填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
選填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

子網路的數字辨識子

Validations:

  • Must be a number.


GET /api/subnets/:id/freeip
Provides an unused IP address in this subnet

示例

GET /api/subnets/1018350798-subnet186/freeip
200
{
  "freeip": null,
  "errors": {}
}

參數

參數名字 描述
location_id
選填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
選填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

mac
選填

MAC address to reuse the IP for this host

Validations:

  • Must be a String

excluded_ips
選填

IP addresses that should be excluded from suggestion

Validations:

  • Must be an array of any type