VPS.org API

REST API Documentation

API σχεδίων

Καταχωρήστε τα σχέδια του διακομιστή που μπορείτε να αναπτύξετε, με τους πόρους και τις τιμές τους.

Τελικά σημεία 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": ""
    }
  ]
}

Πεδία απόκρισης

Πεδίο Τύπος Description
uuid string Αναγνωριστικό σχεδίου. Χρησιμοποιήστε το ως plan_uid ή new_plan_uid.
cpu integer Αριθμός vCPUs
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 Whether the plan includes a public IPv4 address. Plans without one are IPv6 only; an IPv4 address can be added for $2.00/month.
monthly_price, price string Μηνιαία τιμή σε USD ως δεκαδική συμβολοσειρά. τιμή είναι η ίδια τιμή.
hourly_price string Ωριακή τιμή σε USD ως δεκαδική συμβολοσειρά
cpu_type_name string Τύπος ΚΜΕ, για παράδειγμα Shared. Διαθέσιμο για σχέδια χωρίς τύπο ΚΜΕ, όπως το σχέδιο GPU.
is_active boolean Πάντα αληθινός σε αυτή τη λίστα, επειδή τα ανενεργά σχέδια δεν επιστρέφονται
is_gpu, gpu_count, gpu_model boolean, integer, string Αν το σχέδιο περιλαμβάνει ειδικούς GPUs, πόσες και ποιο μοντέλο
Η απάντηση δεν λέει αν ένα σχέδιο περιλαμβάνει διεύθυνση IPv4. Το 512 MB σχέδιο είναι μόνο IPv6.Τα άλλα τρέχοντα σχέδια περιλαμβάνουν IPv4.

Κωδικοί κατάστασης απόκρισης

200 Επιτυχής λίστα σχεδίων
403 Λείπει ή άκυρο API, ή το σύμβολο στερείται της απαιτούμενης άδειας
ΠΑΙΡΝΩ /api/v1/plans/{uuid}/

Λήψη λεπτομερειών προγράμματος

Returns one active plan with the fields above. An inactive or unknown uuid returns 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": ""
}