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 vCPUs ਦੀ ਗਿਣਤੀ
ram, ram_unit integer, string ਮੈਮੋਰੀ ਮਾਤਰਾ ਅਤੇ ਇਸ ਦੀ ਇਕਾਈ (MB ਜਾਂ GB)
disk_space integer ਡਿਸਕ ਸਾਈਜ਼ GB ਵਿੱਚ
disk_space_total integer ਡਿਸਕ ਸਾਈਜ਼ ਮੈਬਾ ਵਿੱਚ
transfer, transfer_unit integer, string ਮਹੀਨਾਵਾਰ ਡਾਟਾ ਟਰਾਂਸਫਰ ਲਾਇਸੈਂਸ ਅਤੇ ਇਸ ਦੀ ਇਕਾਈ (GB ਜਾਂ TB)
disk_space_unit string ਡਿਸਕ ਥਾਂ ਦੀ ਇਕਾਈ (GB) (_S)
includes_ipv4 boolean ਕੀ ਪਲਾਨ ਵਿੱਚ ਪਬਲਿਕ IPv4 ਐਡਰੈੱਸ ਸ਼ਾਮਲ ਹੈ। ਬਿਨਾਂ ਪਲਾਨ IPv6 ਹੀ ਹਨ; ਇੱਕ IPv4 ਐਡਰੈੱਸ $2.00/ਮਹੀਨੇ ਲਈ ਸ਼ਾਮਲ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ।
monthly_price, price string ਮਹੀਨਾਵਾਰ ਕੀਮਤ USD ਵਿੱਚ ਦਸ਼ਮਲਵ ਸਤਰ ਵਾਂਗ ਹੈ । ਕੀਮਤ ਇੱਕੋ ਹੀ ਹੈ ।
hourly_price string ਘੰਟਾ ਕੀਮਤ USD ਵਿੱਚ ਦਸ਼ਮਲਵ ਸਤਰ ਵਾਂਗ
cpu_type_name string CPU ਕਿਸਮ, ਉਦਾਹਰਨ ਲਈ ਸਾਂਝਾ । CPU ਕਿਸਮ ਤੋਂ ਬਿਨਾਂ ਯੋਜਨਾਵਾਂ ਲਈ ਛੱਡਿਆ ਗਿਆ, ਜਿਵੇਂ ਕਿ GPU ਯੋਜਨਾ ।
is_active boolean ਇਸ ਲਿਸਟ ਵਿੱਚ ਹਮੇਸ਼ਾ ਸੱਚ ਹੈ, ਕਿਉਂਕਿ ਨਾ- ਸਰਗਰਮ ਯੋਜਨਾਵਾਂ ਵਾਪਸ ਨਹੀਂ ਕੀਤੀਆਂ ਜਾਂਦੀਆਂ ਹਨ
is_gpu, gpu_count, gpu_model boolean, integer, string ਕੀ ਯੋਜਨਾ ਵਿੱਚ ਸਮਰਪਿਤ GPU ਸ਼ਾਮਲ ਹਨ, ਕਿੰਨੇ ਅਤੇ ਕਿਹੜਾ ਮਾਡਲ ਹੈ
ਜਵਾਬ ਵਿੱਚ ਇਹ ਨਹੀਂ ਕਿਹਾ ਗਿਆ ਹੈ ਕਿ ਕੀ ਯੋਜਨਾ ਵਿੱਚ IPv4 ਐਡਰੈੱਸ ਸ਼ਾਮਲ ਹੈ । 512 MB ਯੋਜਨਾ 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": ""
}