Download OpenAPI specification:Download
「さくらのVPS」が提供するAPIの利用方法を公開しております。
「さくらのVPS」が提供するAPIはまだ一部の機能に制限しておりますが、順次機能を追加していく予定です。
本ドキュメントの著作権は、さくらインターネット株式会社に帰属しています。
法律によって認められる範囲を超えて、本ドキュメントを複製、改変、頒布その他の方法で利用することは一切禁止とします。
ただし、本ドキュメント内のコード(仕様として示しているリクエストとレスポンスの文字列すべてを指します)は、
CC BY 4.0 国際ライセンスで提供されます。
APIにアクセスするためには、認証のためのAPIキー(トークン文字列)が必要です。
APIキーの発行はVPSコントロールパネルから行えます。また、APIの機能としても提供しております。
初めてAPIキーを発行する場合は、VPSコントロールパネルから「ロールの追加」と「APIキーの追加」を行ってください。
このドキュメント内では発行したAPIキー(トークン文字列)の例としてSAMPLETOKENSAMPLETOKENSAMPLETOK
と記載します。
https://secure.sakura.ad.jp/vps/api/v7/(エンドポイント)
となります。Authorization: Bearer SAMPLETOKENSAMPLETOKENSAMPLETOK
を指定します。# リクエストのサンプル
curl -H 'Authorization: Bearer SAMPLETOKENSAMPLETOKENSAMPLETOK' \
'https://secure.sakura.ad.jp/vps/api/v7/servers'
APIへのリクエストが成功したか失敗したかは、HTTPレスポンスのステータスコードで判断が可能です。
結果 | ステータスコード |
---|---|
成功 (要求を受け付けた) | 2xx |
失敗(要求が受け付けられなかった) | 4xx, 5xx |
リクエストに成功すると、HTTPレスポンスのボディにはコンテンツ(データ)がJSON形式(UTF-8)で入っています。 ただしコンテンツ(データ)を返さないリクエストの場合はボディは空です。
# コンテンツ(データ)のサンプル
{
"id": 1,
"name": "sample_data"
}
リクエストに失敗すると、HTTPレスポンスのボディには失敗した理由などがJSON形式(UTF-8)で入っています。
# 失敗した場合のボディのサンプル
{
"code": "not_found",
"message": "見つかりませんでした"
}
429
となりますpage | integer |
per_page | integer [ 1 .. 100 ] Default: 10 |
id | string idで絞り込む。カンマ区切りで100件まで指定可能。 |
switch | integer switchのid 対象のスイッチに接続されているサーバーに絞り込む |
zone_code | string Enum: "tk1" "tk2" "tk3" "os1" "os2" "os3" "is1" ゾーンコードで絞り込む
|
service_type | string Enum: "linux" "windows" サービスタイプで絞り込む |
ipv4_address | string Example: ipv4_address=192.0.2.0 IPアドレスで絞り込む |
monitoring_resource_id | string サーバー監視リソースIDで絞り込む |
sort | string Enum: "service_code" "-service_code" "name" "-name" "storage_size_gibibytes" "-storage_size_gibibytes" "memory_mebibytes" "-memory_mebibytes" "cpu_cores" "-cpu_cores" "hostname" "-hostname" "ipv6_hostname" "-ipv6_hostname" "ipv4_address" "-ipv4_address" "ipv6_address" "-ipv6_address" "zone_code" "-zone_code" "ipv4_ptr" "-ipv4_ptr" "ipv6_ptr" "-ipv6_ptr" データの並び順。項目名の頭に
|
search | string 名前、説明文、ホスト名、ipv4アドレス、ipv6アドレス、サービスコードから部分一致検索 |
{- "results": [
- {
- "id": 0,
- "name": "string",
- "description": "string",
- "service_type": "linux",
- "service_status": "on_trial",
- "cpu_cores": 2,
- "memory_mebibytes": 1024,
- "storage": [
- {
- "port": 0,
- "type": "ssd",
- "size_gibibytes": 100
}
], - "zone": {
- "code": "tk1",
- "name": "石狩第1"
}, - "options": [
- "SQL Server Web Edition"
], - "version": "v5",
- "ipv4": {
- "address": "198.51.100.2",
- "netmask": "255.255.254.0",
- "gateway": "198.51.100.1",
- "nameservers": [
- "203.0.113.1"
], - "hostname": "example.jp",
- "ptr": "example.jp"
}, - "ipv6": {
- "address": "2001:e42:102:1501:153:121:89:107",
- "prefixlen": 64,
- "gateway": "fe80::1",
- "nameservers": [
- "2001:e42::1"
], - "hostname": "example.jp",
- "ptr": "example.jp"
}, - "contract": {
- "plan_code": 3439,
- "plan_name": "さくらのVPS(v5) 1G IK01",
- "service_code": "100000000000"
}, - "power_status": "power_on"
}
], - "count": 100,
}
{- "id": 0,
- "name": "string",
- "description": "string",
- "service_type": "linux",
- "service_status": "on_trial",
- "cpu_cores": 2,
- "memory_mebibytes": 1024,
- "storage": [
- {
- "port": 0,
- "type": "ssd",
- "size_gibibytes": 100
}
], - "zone": {
- "code": "tk1",
- "name": "石狩第1"
}, - "options": [
- "SQL Server Web Edition"
], - "version": "v5",
- "ipv4": {
- "address": "198.51.100.2",
- "netmask": "255.255.254.0",
- "gateway": "198.51.100.1",
- "nameservers": [
- "203.0.113.1"
], - "hostname": "example.jp",
- "ptr": "example.jp"
}, - "ipv6": {
- "address": "2001:e42:102:1501:153:121:89:107",
- "prefixlen": 64,
- "gateway": "fe80::1",
- "nameservers": [
- "2001:e42::1"
], - "hostname": "example.jp",
- "ptr": "example.jp"
}, - "contract": {
- "plan_code": 3439,
- "plan_name": "さくらのVPS(v5) 1G IK01",
- "service_code": "100000000000"
}, - "power_status": "power_on"
}
server_id required | integer サーバーID |
name required | string 名前 |
description required | string 説明 |
{- "name": "string",
- "description": "string"
}
{- "id": 0,
- "name": "string",
- "description": "string",
- "service_type": "linux",
- "service_status": "on_trial",
- "cpu_cores": 2,
- "memory_mebibytes": 1024,
- "storage": [
- {
- "port": 0,
- "type": "ssd",
- "size_gibibytes": 100
}
], - "zone": {
- "code": "tk1",
- "name": "石狩第1"
}, - "options": [
- "SQL Server Web Edition"
], - "version": "v5",
- "ipv4": {
- "address": "198.51.100.2",
- "netmask": "255.255.254.0",
- "gateway": "198.51.100.1",
- "nameservers": [
- "203.0.113.1"
], - "hostname": "example.jp",
- "ptr": "example.jp"
}, - "ipv6": {
- "address": "2001:e42:102:1501:153:121:89:107",
- "prefixlen": 64,
- "gateway": "fe80::1",
- "nameservers": [
- "2001:e42::1"
], - "hostname": "example.jp",
- "ptr": "example.jp"
}, - "contract": {
- "plan_code": 3439,
- "plan_name": "さくらのVPS(v5) 1G IK01",
- "service_code": "100000000000"
}, - "power_status": "power_on"
}
server_id required | integer サーバーID |
force | boolean Default: false 強制停止を行うか |
{- "force": false
}
{- "code": "not_authenticated",
- "message": "認証情報が含まれていません。"
}
server_id required | integer サーバーID |
disc_id required | integer ディスクID |
{- "disc_id": 0
}
{- "code": "invalid",
- "message": "Invalid input.",
- "errors": {
- "foo": [
- {
- "code": "required",
- "message": "この項目は必須です"
}
]
}
}
server_id required | integer サーバーID |
layout required | string Enum: "ja" "en-us" 指定したいキー配列の名称 |
{- "layout": "ja"
}
{- "layout": "ja"
}
server_id required | integer サーバーID |
hostname required | string ホスト名 |
{- "hostname": "example.jp"
}
{- "ptr": "example.jp"
}
server_id required | integer サーバーID |
{- "results": [
- {
- "id": 0,
- "device": "eth0",
- "connectable_to_global_network": true,
- "connect_to": "global",
- "mac": "9C:A3:BA:00:00:00",
- "switch_id": 1
}
], - "count": 100,
}
server_id required | integer サーバーID |
interface_id required | integer サーバーインターフェースID |
{- "id": 0,
- "device": "eth0",
- "connectable_to_global_network": true,
- "connect_to": "global",
- "mac": "9C:A3:BA:00:00:00",
- "switch_id": 1
}
server_id required | integer サーバーID |
interface_id required | integer サーバーインターフェースID |
switch_id required | integer or null スイッチID |
{- "switch_id": 1
}
{- "id": 0,
- "device": "eth0",
- "connectable_to_global_network": true,
- "connect_to": "global",
- "mac": "9C:A3:BA:00:00:00",
- "switch_id": 1
}
server_id required | integer サーバーID |
hostname required | string ホスト名 |
{- "hostname": "example.jp"
}
{- "ptr": "example.jp"
}
server_id required | integer サーバーID |
type required | string Enum: "vga" "cirrus" ビデオデバイスの種類 |
{- "type": "vga"
}
{- "type": "vga"
}
{- "cpu_performance_limit": "enabled",
- "network_bandwidth_limit": "enabled",
- "outbound_port_25_blocking": "enabled",
- "storage_iops_limit": "enabled"
}
server_id required | integer サーバーID |
page | integer |
per_page | integer [ 1 .. 100 ] Default: 10 |
monitoring_resource_id | string サーバー監視リソースIDで絞り込む |
{- "results": [
- {
- "id": 0,
- "name": "string",
- "description": "string",
- "monitoring_resource_id": "string",
- "update_status": "waiting",
- "settings": {
- "enabled": true,
- "health_check": {
- "protocol": "ping",
- "interval_minutes": 1
}, - "notification": {
- "email": {
- "enabled": true
}, - "incoming_webhook": {
- "enabled": true,
- "slack_team_name": "string",
- "slack_channel_name": "string"
}, - "interval_hours": 1
}
}
}
], - "count": 100,
}
server_id required | integer サーバーID |
name required | string <= 255 characters 名前 |
description required | string <= 10000 characters 説明 |
required | object |
{- "name": "string",
- "description": "string",
- "settings": {
- "enabled": true,
- "health_check": {
- "protocol": "ping",
- "interval_minutes": 1
}, - "notification": {
- "email": {
- "enabled": true
}, - "interval_hours": 1
}
}
}
{- "id": 0,
- "name": "string",
- "description": "string",
- "monitoring_resource_id": "string",
- "update_status": "waiting",
- "settings": {
- "enabled": true,
- "health_check": {
- "protocol": "ping",
- "interval_minutes": 1
}, - "notification": {
- "email": {
- "enabled": true
}, - "incoming_webhook": {
- "enabled": true,
- "slack_team_name": "string",
- "slack_channel_name": "string"
}, - "interval_hours": 1
}
}
}
server_id required | integer サーバーID |
server_monitoring_id required | integer サーバー監視ID |
page | integer |
per_page | integer [ 1 .. 100 ] Default: 10 |
{- "id": 0,
- "name": "string",
- "description": "string",
- "monitoring_resource_id": "string",
- "update_status": "waiting",
- "settings": {
- "enabled": true,
- "health_check": {
- "protocol": "ping",
- "interval_minutes": 1
}, - "notification": {
- "email": {
- "enabled": true
}, - "incoming_webhook": {
- "enabled": true,
- "slack_team_name": "string",
- "slack_channel_name": "string"
}, - "interval_hours": 1
}
}
}
server_id required | integer サーバーID |
server_monitoring_id required | integer サーバー監視ID |
name required | string <= 255 characters 名前 |
description required | string <= 10000 characters 説明 |
required | object |
{- "name": "string",
- "description": "string",
- "settings": {
- "enabled": true,
- "health_check": {
- "protocol": "ping",
- "interval_minutes": 1
}, - "notification": {
- "email": {
- "enabled": true
}, - "interval_hours": 1
}
}
}
{- "id": 0,
- "name": "string",
- "description": "string",
- "monitoring_resource_id": "string",
- "update_status": "waiting",
- "settings": {
- "enabled": true,
- "health_check": {
- "protocol": "ping",
- "interval_minutes": 1
}, - "notification": {
- "email": {
- "enabled": true
}, - "incoming_webhook": {
- "enabled": true,
- "slack_team_name": "string",
- "slack_channel_name": "string"
}, - "interval_hours": 1
}
}
}
server_id required | integer サーバーID |
server_monitoring_id required | integer サーバー監視ID |
{- "last_checked_at": "2024-04-15T23:59:59+09:00",
- "status": "healthy",
- "last_status_changed_at": "2024-04-01T23:59:59+09:00"
}
page | integer |
per_page | integer [ 1 .. 100 ] Default: 10 |
id | string idで絞り込む。カンマ区切りで100件まで指定可能。 |
switch | integer switchのid 対象のスイッチに接続されているサーバーに絞り込む |
zone_code | string Enum: "tk1" "tk2" "tk3" "os1" "os2" "os3" "is1" ゾーンコードで絞り込む
|
sort | string Enum: "service_code" "-service_code" "name" "-name" "storage_size_gibibytes" "-storage_size_gibibytes" "ipv4_address" "-ipv4_address" "zone_code" "-zone_code" データの並び順。項目名の頭に
|
{- "results": [
- {
- "id": 0,
- "name": "string",
- "description": "string",
- "service_status": "in_preparation",
- "setting_status": "done",
- "storage": [
- {
- "type": "ssd",
- "size_gibibytes": 100
}
], - "zone": {
- "code": "tk1",
- "name": "石狩第1"
}, - "ipv4": {
- "address": "198.51.100.2",
- "netmask": "255.255.254.0"
}, - "contract": {
- "plan_code": 3439,
- "plan_name": "さくらのVPS(v5) NFS 200GB OS03",
- "service_code": "100000000000"
}, - "power_status": "power_on"
}
], - "count": 100,
}
{- "id": 0,
- "name": "string",
- "description": "string",
- "service_status": "in_preparation",
- "setting_status": "done",
- "storage": [
- {
- "type": "ssd",
- "size_gibibytes": 100
}
], - "zone": {
- "code": "tk1",
- "name": "石狩第1"
}, - "ipv4": {
- "address": "198.51.100.2",
- "netmask": "255.255.254.0"
}, - "contract": {
- "plan_code": 3439,
- "plan_name": "さくらのVPS(v5) NFS 200GB OS03",
- "service_code": "100000000000"
}, - "power_status": "power_on"
}
nfs_server_id required | integer NFSのID |
name required | string 名前 |
description required | string 説明 |
{- "name": "string",
- "description": "string"
}
{- "id": 0,
- "name": "string",
- "description": "string",
- "service_status": "in_preparation",
- "setting_status": "done",
- "storage": [
- {
- "type": "ssd",
- "size_gibibytes": 100
}
], - "zone": {
- "code": "tk1",
- "name": "石狩第1"
}, - "ipv4": {
- "address": "198.51.100.2",
- "netmask": "255.255.254.0"
}, - "contract": {
- "plan_code": 3439,
- "plan_name": "さくらのVPS(v5) NFS 200GB OS03",
- "service_code": "100000000000"
}, - "power_status": "power_on"
}
nfs_server_id required | integer NFSのID |
address required | string ipv4アドレス |
netmask required | string ネットマスク |
{- "address": "string",
- "netmask": "string"
}
{- "code": "invalid",
- "message": "Invalid input.",
- "errors": {
- "foo": [
- {
- "code": "required",
- "message": "この項目は必須です"
}
]
}
}
nfs_server_id required | integer NFSのID |
switch_id required | integer or null スイッチID |
{- "switch_id": 1
}
{- "id": 0,
- "device": "eth0",
- "connect_to": "switch",
- "mac": "9C:A3:BA:00:00:00",
- "switch_id": 1
}
同一ゾーン内で作成可能なスイッチ数は最大20です
name required | string 名前 |
description required | string 説明 |
zone_code required | string Enum: "tk2" "tk3" "os3" "is1" ゾーンコード
|
{- "name": "string",
- "description": "string",
- "zone_code": "tk2"
}
{- "id": 0,
- "name": "string",
- "description": "string",
- "switch_code": "string",
- "zone": {
- "code": "tk2",
- "name": "石狩第1"
}, - "server_interfaces": [ ],
- "nfs_server_interfaces": [ ],
- "external_connection": null
}
page | integer |
per_page | integer [ 1 .. 100 ] Default: 10 |
id | string idで絞り込む。カンマ区切りで100件まで指定可能。 |
zone_code | string Enum: "tk1" "tk2" "tk3" "os1" "os2" "os3" "is1" ゾーンコードで絞り込む
|
interface | integer interfaceのid 対象のインターフェースに接続されているスイッチに絞り込む |
sort | string Enum: "name" "-name" "zone" "-zone" "interfaces_count" "-interfaces_count" データの並び順。項目名の頭に
|
search | string 名前と説明文から部分一致検索 |
{- "results": [
- {
- "id": 0,
- "name": "string",
- "description": "string",
- "switch_code": "string",
- "zone": {
- "code": "tk1",
- "name": "石狩第1"
}, - "server_interfaces": [
- 0
], - "nfs_server_interfaces": [
- 0
], - "external_connection": {
- "service_code": "100000000000",
- "type": "cloud",
- "services": [
- {
- "service_category": "cloud",
- "service_name": "クラウド東京第1ゾーン",
- "switch_code": "111111111111"
}
]
}
}
], - "count": 100,
}
{- "id": 0,
- "name": "string",
- "description": "string",
- "switch_code": "string",
- "zone": {
- "code": "tk1",
- "name": "石狩第1"
}, - "server_interfaces": [
- 0
], - "nfs_server_interfaces": [
- 0
], - "external_connection": {
- "service_code": "100000000000",
- "type": "cloud",
- "services": [
- {
- "service_category": "cloud",
- "service_name": "クラウド東京第1ゾーン",
- "switch_code": "111111111111"
}
]
}
}
switch_id required | integer スイッチID |
name required | string 名前 |
description required | string 説明 |
{- "name": "string",
- "description": "string"
}
{- "id": 0,
- "name": "string",
- "description": "string",
- "switch_code": "string",
- "zone": {
- "code": "tk1",
- "name": "石狩第1"
}, - "server_interfaces": [
- 0
], - "nfs_server_interfaces": [
- 0
], - "external_connection": {
- "service_code": "100000000000",
- "type": "cloud",
- "services": [
- {
- "service_category": "cloud",
- "service_name": "クラウド東京第1ゾーン",
- "switch_code": "111111111111"
}
]
}
}
{- "results": [
- {
- "id": 0,
- "name": "string",
- "description": "string",
- "license_required": true
}
], - "count": 100,
}
{- "results": [
- {
- "id": 0,
- "code": "tk1",
- "name": "string",
- "can_use_local": true,
- "can_use_hybrid": true
}
], - "count": 100,
}
name required | string <= 100 characters 名前 |
role required | integer ロールID |
{- "name": "string",
- "role": 0
}
{- "id": 0,
- "name": "string",
- "role": 0,
- "token": "string"
}
order | string Enum: "id" "-id" "name" "-name" データの並び順。項目名の頭に
|
role | integer roleのid。ロールで絞り込む |
search | string 名前から部分一致検索 |
{- "results": [
- {
- "id": 0,
- "name": "string",
- "role": 0,
- "token": "string"
}
], - "count": 100,
}
api_key_id required | integer APIキーID |
name required | string <= 100 characters 名前 |
role required | integer ロールID |
{- "name": "string",
- "role": 0
}
{- "id": 0,
- "name": "string",
- "role": 0,
- "token": "string"
}
name required | string <= 100 characters 名前 |
description required | string <= 512 characters 説明 |
permission_filtering required | string Enum: "enabled" "disabled" 利用できる権限を制限するか |
allowed_permissions required | Array of strings 利用できる権限。permission_filteringがenabledの場合のみ指定可能。権限の一覧を取得する |
resource_filtering required | string Enum: "enabled" "disabled" 利用できるリソースを制限するか |
required | object or null 利用できるリソース。resource_filteringがenabledの場合のみ指定可能。 |
{- "name": "string",
- "description": "string",
- "permission_filtering": "enabled",
- "allowed_permissions": [
- "get-server-list",
- "get-server",
- "put-server"
], - "resource_filtering": "enabled",
- "allowed_resources": {
- "servers": [
- 1,
- 2,
- 3
], - "switches": [
- 1,
- 2,
- 3
], - "nfs_servers": [
- 1,
- 2,
- 3
]
}
}
{- "id": 0,
- "name": "string",
- "description": "string",
- "permission_filtering": "enabled",
- "allowed_permissions": [
- "get-server-list",
- "get-server",
- "put-server"
], - "resource_filtering": "enabled",
- "allowed_resources": {
- "servers": [
- 1,
- 2,
- 3
], - "switches": [
- 1,
- 2,
- 3
], - "nfs_servers": [
- 1,
- 2,
- 3
]
}
}
order | string Enum: "id" "-id" "name" "-name" データの並び順。項目名の頭に
|
search | string 名前と説明文から部分一致検索 |
{- "results": [
- {
- "id": 0,
- "name": "string",
- "description": "string",
- "permission_filtering": "enabled",
- "allowed_permissions": [
- "get-server-list",
- "get-server",
- "put-server"
], - "resource_filtering": "enabled",
- "allowed_resources": {
- "servers": [
- 1,
- 2,
- 3
], - "switches": [
- 1,
- 2,
- 3
], - "nfs_servers": [
- 1,
- 2,
- 3
]
}
}
], - "count": 100,
}
{- "id": 0,
- "name": "string",
- "description": "string",
- "permission_filtering": "enabled",
- "allowed_permissions": [
- "get-server-list",
- "get-server",
- "put-server"
], - "resource_filtering": "enabled",
- "allowed_resources": {
- "servers": [
- 1,
- 2,
- 3
], - "switches": [
- 1,
- 2,
- 3
], - "nfs_servers": [
- 1,
- 2,
- 3
]
}
}
role_id required | integer ロールID |
name required | string <= 100 characters 名前 |
description required | string <= 512 characters 説明 |
permission_filtering required | string Enum: "enabled" "disabled" 利用できる権限を制限するか |
allowed_permissions required | Array of strings 利用できる権限。permission_filteringがenabledの場合のみ指定可能。権限の一覧を取得する |
resource_filtering required | string Enum: "enabled" "disabled" 利用できるリソースを制限するか |
required | object or null 利用できるリソース。resource_filteringがenabledの場合のみ指定可能。 |
{- "name": "string",
- "description": "string",
- "permission_filtering": "enabled",
- "allowed_permissions": [
- "get-server-list",
- "get-server",
- "put-server"
], - "resource_filtering": "enabled",
- "allowed_resources": {
- "servers": [
- 1,
- 2,
- 3
], - "switches": [
- 1,
- 2,
- 3
], - "nfs_servers": [
- 1,
- 2,
- 3
]
}
}
{- "id": 0,
- "name": "string",
- "description": "string",
- "permission_filtering": "enabled",
- "allowed_permissions": [
- "get-server-list",
- "get-server",
- "put-server"
], - "resource_filtering": "enabled",
- "allowed_resources": {
- "servers": [
- 1,
- 2,
- 3
], - "switches": [
- 1,
- 2,
- 3
], - "nfs_servers": [
- 1,
- 2,
- 3
]
}
}
category | string Example: category=server カテゴリーで絞り込む |
code | string Example: code=get-server-list,get-server,put-server コードで絞り込む。カンマ区切りで複数指定可能。 |
{- "results": [
- {
- "code": "get-server-list",
- "name": "サーバー一覧の取得",
- "category": "server"
}
], - "count": 100,
}