VPS.org API

وثائق REST 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 المبلغ الشهري لنقل البيانات ووحدته (جيغا بايت أو تيرابايت)
disk_space_unit string وحدة مساحة القرص (جيغابايت)
includes_ipv4 boolean ما إذا كانت الخطة تتضمن عنوانا عاما لـ IPv4. الخطط التي لا تتضمن عنوانا عاما هي IPv6 فقط؛ ويمكن إضافة عنوان IPv4 مقابل 2.00 دولار شهريا.
monthly_price, price string السعر الشهري بدولارات الولايات المتحدة كسلسلة عشرية. السعر هو نفس القيمة.
hourly_price string السعر في الساعة بدولارات الولايات المتحدة كسلسلة عشرية
cpu_type_name string نوع وحدة المعالجة المركزية، مثل المشتركة. يحذف بالنسبة للخطط بدون نوع وحدة المعالجة المركزية، مثل خطة وحدة المعالجة الرسومية.
is_active boolean دائما صحيح في هذه القائمة، لأن الخطط غير النشطة لا تعاد
is_gpu, gpu_count, gpu_model boolean, integer, string ما إذا كانت الخطة تشمل وحدات معالجة رسومية مخصصة، وكم عددها، وأي طراز منها
لا يذكر الرد ما إذا كانت الخطة تتضمن عنوان IPv4. خطة 512 ميغابايت هي IPv6 فقط؛ الخطط الحالية الأخرى تشمل IPv4. مقارنة مع صفحة التسعير قبل اختيار خطة لموقع يجب أن يكون قابلا للوصول عبر IPv4.

رموز حالة الاستجابة

200 قائمة الخطط المسترجعة بنجاح
403 رمز API مفقود أو غير صحيح، أو يفتقر الرمز إلى الإذن المطلوب
يحصل /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": ""
}