VPS.org API

Constellation name (optional)

Planne API

Lys die bediener planne jy kan gebruik, met hul hulpbronne en pryse. Gee aan 'n plan se uid as plan_uuid wanneer jy 'n bediener skep of hervergroot.

Eindpunte 2
Basispad /api/v1/plans
KRY /api/v1/plans/

Lys alle planne

Gee terug elke aktief plan, goedkoopste eerste. die lys het geen filters en huidiglik pas op een bladsy.

Benodigde toestemming: plans:list

Voorbeeldversoek

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);

Voorbeeldantwoord

{
  "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": ""
    }
  ]
}

Antwoordvelde

Veld Tipe Beskrywing
uuid string Planidentifiseerder. Gebruik dit as plan_uïde of nuwe_plan_uïde.
cpu integer Nommer van perCPUs
ram, ram_unit integer, string Geheue hoeveelheid en sy eenheid (MB of GB)
disk_space integer Skyfgrootte in GB
disk_space_total integer Skyfgrootte in mb
transfer, transfer_unit integer, string Maandelikse data oorplasing en sy eenheid (GB of TB)
disk_space_unit string Eenheid van skyf_ruimte (GB)
includes_ipv4 boolean Of die plan 'n openbare IPv4 adres insluit. Planne sonder een is ipv6 slegs;' n IPv4 adres kan vir $2,00/month bygevoeg word.
monthly_price, price string Maandelikse prys in USD as 'n desimaal string. prys is dieselfde waarde.
hourly_price string USD se duur per uur as 'n desimale string
cpu_type_name string Verwerker-tipe het byvoorbeeld gedeel. Opgelei vir planne sonder 'n Sve-tipe, soos die GPU-plan.
is_active boolean Altyd waar in hierdie lys, omdat onaktiewe planne nie teruggegee word nie
is_gpu, gpu_count, gpu_model boolean, integer, string Of die plan toegewyde GPUs insluit, hoeveel en watter model
Die antwoord sê nie of 'n plan 'n IPv4 adres insluit nie. Die 512 mb plan is IPv6 slegs; die ander huidige planne sluit IPv4 in. Vergelyk met die prakting bladsy voordat jy 'n plan kies vir 'n tuiste wat oor IPv4 bereik kan word.

Reaksiestatuskodes

200 Suksesvol verkryde beplande lys
403 Ontbrekende of ongeldige API-bewys, of die teken het nie die nodige toestemming nie
KRY /api/v1/plans/{uuid}/

Kry Planbesonderhede

Gee terug een aktief plan met die velde hierbo. 'n Onaktiewe of onbekende uid gee terug 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": ""
}