VPS.org API

REST API sənədləşdirilməsi

Yerləşmə API-si

VPS-i quraşdıra biləcəyiniz yerləri siyahıya al. Verici yaratdığınız zaman yer id-sini location_id olaraq keçin.

Son Nöqtələr 2 endpoints
Əsas Yol /api/v1/locations
AL /api/v1/locations/

Bütün Yerləri Siyahıya Alın

VPS serverləri quraşdıra biləcəyiniz bütün mövcud məlumat mərkəzi yerlərinin siyahısını əldə edin.

Nümunə Sorğu

cURL
Python
JavaScript
PHP
curl -X GET "https://admin.vps.org/api/v1/locations/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"
import requests

url = "https://admin.vps.org/api/v1/locations/"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}

response = requests.get(url, headers=headers)
print(response.json())
const response = await fetch('https://admin.vps.org/api/v1/locations/', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  }
});

const locations = await response.json();
console.log(locations);
$ch = curl_init('https://admin.vps.org/api/v1/locations/');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_TOKEN',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$locations = json_decode($response, true);
curl_close($ch);

Nümunə Cavab

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 1,
      "name": "New Jersey",
      "country_name": "United States",
      "country_code": "US",
      "is_active": true
    }
  ]
}

Cavab Sahələri

Sahə Növü İzahat
id integer Yer identifikatoru. Verici yaradılarkən location_id olaraq istifadə et.
name string Yer adının insan oxuya bilən şəkli
country_name string Yerləşdiriləcəyi ölkə
country_code string ISO 3166-1 alpha-2 ölkə kodu, böyük hərf
is_active boolean Yerin yeni vericiləri qəbul edib etmədiyini göstər

Cavab Status Kodları

200 Məkan siyahısı uğurla əldə edildi
403 API tokeni yoxdu ya da səhvdir, ya da tokenin lazımi icazəsi yoxdur
AL /api/v1/locations/{id}/

Yer

Bir yerin id-si ilə tək bir yerini əldə et. Cavab yuxarıdakı sahələrdən ibarət bir yerin cismidir.

curl -X GET "https://admin.vps.org/api/v1/locations/1/" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
{
  "id": 1,
  "name": "New Jersey",
  "country_name": "United States",
  "country_code": "US",
  "is_active": true
}

Vericilərin işlədiyi yer

Hər VPS.org serveri hazırda bizim New Jersey, USA yerində işləyir, bu da IPv4 və IPv6 üzərindən bütün dünyada müştərilərə xidmət edir. Hər zaman id-ni hardkodlamaq əvəzinə yerlərin son nöqtələrini oxuyun, beləliklə də birləşməniz yeni yerlər əlavə edildikdə onları götürür.