VPS.org API

Dokumintaasje

Plannen API

List de tsjinnerplannen dy jo ynsette kinne, mei har boarnen en prizen. Jou de uuid fan in plan troch as plan_ uuid as jo in tsjinner oanmeitsje of de grutte feroarje.

Einpunten 2
Basispaad /api/v1/plans
KRIJE /api/v1/plans/

List alle plannen

Jout alle aktive plannen werom, it goedkeapste earst. De list hat gjin filters en past op ien side.

Tagongsrjochten fereaske: plans:list

Foarbyldfersyk

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

Foarbyldantwurd

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

Antwurdfjilden

Fjild Type Beskriuwing
uuid string Plan-identifikator. Brûk it as plan_uuid of new_plan_uuid.
cpu integer Oantal vCPU' s
ram, ram_unit integer, string Unthâldgrutte en har ienheid (MB of GB)
disk_space integer Skiifgrutte yn GB
disk_space_total integer Skiifgrutte yn MB
transfer, transfer_unit integer, string Moanlikse gegevensoerdracht en de ienheid dêrfan (GB of TB)
disk_space_unit string Ienheid fan skiifromte (GB)
includes_ipv4 boolean Oft it plan in iepenbier IPv4 adres befettet. Plannen sûnder in iepenbier IPv4 adres binne allinne IPv6. In IPv4 adres kin taheakke wurde foar $2.00/moanne.
monthly_price, price string Moanlikse priis yn USD as desimaal tekenrige. price is deselde wearde.
hourly_price string Oerepriis yn USD as desimaal tekenrige
cpu_type_name string CPU- type, bygelyks dield. Net brûkt foar plannen sûnder CPU- type, lykas it GPU- plan.
is_active boolean Altyd wier yn dizze list, om' t net- aktive plannen net weromjûn wurde
is_gpu, gpu_count, gpu_model boolean, integer, string Oft it plan spesjale GPU's befettet, hoefolle en hokker model
It antwurd seit net oft in plan in IPv4- adres befettet. It 512 MB- plan is allinne IPv6; de oare plannen befetsje IPv4. Ferlykje mei de priisside foardat jo in plan kieze foar in side dy' t oer IPv4 berikber wêze moat.

Antwurdstatuskoades

200 Suksesfol ophelle plannenlist
403 Untbrekkend of ûnjildich API-token, of it token hat net de fereaske tagongsrjochten
KRIJE /api/v1/plans/{uuid}/

Plandetails krije

Jout ien aktyf plan werom mei de boppesteande fjilden. In net- aktive of ûnbekende uuid jout 404 werom.

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