VPS.org API

REST APIドキュメント

プランAPI

配置可能なサーバプランをリソースと価格で一覧表示します。サーバを作成したりサイズを変更したりするときは、プランの uuid を plan_uuid に渡します。

エンドポイント 2
ベースパス /api/v1/plans
得る /api/v1/plans/

すべてのプランを一覧表示

アクティブなプランをすべて返します。最安値を先にします。リストにはフィルタがありません。現在は一ページに収まります。

必要な権限: plans:list

リクエスト例

cURL
Python
JavaScript
PHP
curl -X GET "https://admin.vps.org/api/v1/plans/" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
import requests

url = "https://admin.vps.org/api/v1/plans/"
headers = {"Authorization": "Bearer YOUR_API_TOKEN"}

response = requests.get(url, headers=headers)
for plan in response.json()["results"]:
    print(plan["uuid"], plan["cpu"], plan["ram"], plan["ram_unit"], plan["monthly_price"])
const response = await fetch('https://admin.vps.org/api/v1/plans/', {
  headers: { 'Authorization': 'Bearer YOUR_API_TOKEN' }
});

const data = await response.json();
console.log(data.results);
$ch = curl_init('https://admin.vps.org/api/v1/plans/');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_API_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$plans = json_decode(curl_exec($ch), true);
curl_close($ch);

回答例

{
  "count": 12,
  "next": null,
  "previous": null,
  "results": [
    {
      "uuid": "ed0ac717-c26c-4d9b-a801-b170c4979028",
      "cpu": 1,
      "ram": 512,
      "ram_unit": "MB",
      "disk_space": 10,
      "disk_space_total": 10240,
      "transfer": 500,
      "transfer_unit": "GB",
      "includes_ipv4": false,
      "price": "2.50",
      "cpu_type_name": "Shared",
      "is_active": true,
      "hourly_price": "0.004",
      "monthly_price": "2.50",
      "is_gpu": false,
      "gpu_count": 0,
      "gpu_model": ""
    },
    {
      "uuid": "14186969-fbaf-43e1-9ab2-b1f1aeb66674",
      "cpu": 1,
      "ram": 2,
      "ram_unit": "GB",
      "disk_space": 25,
      "disk_space_total": 25600,
      "transfer": 1,
      "transfer_unit": "TB",
      "includes_ipv4": true,
      "price": "5.00",
      "cpu_type_name": "Shared",
      "is_active": true,
      "hourly_price": "0.007",
      "monthly_price": "5.00",
      "is_gpu": false,
      "gpu_count": 0,
      "gpu_model": ""
    }
  ]
}

応答フィールド

フィールド タイプ 説明
uuid string 計画識別子。plan_uuid または new_plan_uuid として使用します。
cpu integer vCPU の数
ram, ram_unit integer, string メモリのサイズと単位 (MB または GB)
disk_space integer ディスクサイズ (GB)
disk_space_total integer ディスクサイズ (MB)
transfer, transfer_unit integer, string 月間データ転送料金とその単位(GBまたはTB)
disk_space_unit string ディスク空間の単位 (GB)
includes_ipv4 boolean プランに公開 IPv4 アドレスを含むかどうか。公開 IPv4 アドレスを含まないプランは IPv6 のみです。IPv4 アドレスは月額 $2.00 で追加できます。
monthly_price, price string 月額価格は、USDで十進文字列で表示されます。価格は同じ値です。
hourly_price string 時間単位の価格を小数点文字列で USD で表示します
cpu_type_name string CPU タイプ、例えば共有。GPU プランなど CPU タイプがないプランでは省略します。
is_active boolean このリストでは常にtrueです。非アクティブなプランは返されません。
is_gpu, gpu_count, gpu_model boolean, integer, string プランに専用GPUが含まれているかどうか、数がどれくらいか、どのモデルか
返信はプランが IPv4 アドレスを含むかどうかを示していません。512MB プランは IPv6 のみです。他のプランは IPv4 を含みます。IPv4 上でアクセスできるサイトのプランを選ぶ前に、プランページを比較してください。

応答ステータスコード

200 検索成功した計画の一覧
403 API トークンが無効か欠けています。または、トークンには必要な権限がありません。
得る /api/v1/plans/{uuid}/

プランの詳細を見る

上記のフィールドを含むアクティブなプランを返します。アクティブでないか未知の uid は 404 を返します。

curl -X GET "https://admin.vps.org/api/v1/plans/ed0ac717-c26c-4d9b-a801-b170c4979028/" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
{
  "uuid": "ed0ac717-c26c-4d9b-a801-b170c4979028",
  "cpu": 1,
  "ram": 512,
  "ram_unit": "MB",
  "disk_space": 10,
  "disk_space_total": 10240,
  "transfer": 500,
  "transfer_unit": "GB",
  "includes_ipv4": false,
  "price": "2.50",
  "cpu_type_name": "Shared",
  "is_active": true,
  "hourly_price": "0.004",
  "monthly_price": "2.50",
  "is_gpu": false,
  "gpu_count": 0,
  "gpu_model": ""
}