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 Օգտագործողի անուն
ram, ram_unit integer, string Հիշողության չափը և դրա միավորը (ՄԲ կամ ԳԲ)
disk_space integer սկավառակի չափը ԳԲ- ներում
disk_space_total integer սկավառակի չափը, ՄԲ
transfer, transfer_unit integer, string Ամսական տվյալների փոխանցման թույլատրելի ծավալը և դրա միավորը (GB կամ TB)
disk_space_unit string Ցուցակային_տեղիի միավոր (ԳԲ)
includes_ipv4 boolean Արդյո՞ք պլանը ներառում է հանրային IPv4 հասցե։ Պլանները, որոնք չունեն այդպիսին, միայն IPv6 են, IPv4 հասցե կարելի է ավելացնել $2.00/month-ի դիմաց։
monthly_price, price string Ամսական գինը USD- ում որպես տատանվող տող. գինը նույն արժեքն է:
hourly_price string Ժամանակի արժեքը USD- ում որպես տատանվող տող
cpu_type_name string CPU-ի տեսակը, օրինակ, Shared. Անգամ CPU-ի տեսակ չունեցող պլանների համար, օրինակ GPU պլանի համար։
is_active boolean Միշտ ճիշտ այս ցուցակում, քանի որ անակտիվ պլանները չեն վերադարձվում
is_gpu, gpu_count, gpu_model boolean, integer, string Արդյո՞ք պլանը ներառում է հատուկ GPU-ներ, քանի՞ և որ մոդել
Պատասխանը չի ասում, թե պլանը ներառում է IPv4 հասցե։ 512 ՄԲ պլանը միայն IPv6 է, մյուս պլանները ներառում են IPv4։ Հաշվի առեք գինը, նախքան պլան ընտրելը կայքի համար, որը պետք է հասանելի լինի IPv4-ով։

Պատասխանի կարգավիճակի կոդեր

200 Սխալ մուտքագրում
403 Հաշվառված կամ օրինական API token-ը բացակայում է, կամ token-ը չունի անհրաժեշտ թույլտվություն
ՍՏԱՆԱԼ /api/v1/plans/{uuid}/

Ստացեք պլանի մանրամասները

Վերադարձնում է մեկ ակտիվ պլան վերևի դաշտերով։ Անակտիվ կամ անհայտ uuid- ը վերադարձնում է 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": ""
}