VPS.org API

REST API 文件

计划 API

列出您可以部署的服务器计划, 并列出其资源和价格。 当您创建或调整服务器大小时, 传递一个计划的名号为 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 计划标识符。 使用它作为计划或新的计划。
cpu integer 自愿CPU数目
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地址。没有IPv6的计划只能是IPv6;IPv4地址可以每月增加2.00美元。
monthly_price, price string 以小数字串计的月价以美元计。 价格是相同的价值。
hourly_price string 以小数字字符小数字以美元计的小时价格
cpu_type_name string CPU 类型, 例如共享 。 被允许用于没有 CPU 类型的计划, 如 GPU 计划 。
is_active boolean 此列表中总是真实的, 因为不返回不恢复的计划
is_gpu, gpu_count, gpu_model boolean, integer, string 计划是否包括专门的 GPPU、 有多少个、 以及哪个模式
答复没有说明计划是否包含IPv4地址。 512 MB计划仅是IPv6;其他目前的计划包括IPv4。 与定价页面相比,在选择一个必须覆盖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": ""
}