VPS.org API

REST API belgelendirmesi

Konumlar API'si

VPS'yi yerleştireceğiniz yerleri listeler. Bir sunucu oluşturduğunuzda bir yerin id'sini location_id olarak geçiniz.

Uç noktalar 2 endpoints
Temel Yol /api/v1/locations
ELDE ETMEK /api/v1/locations/

Tüm Konumları Listele

VPS sunucularını dağıtacağınız tüm mevcut veri merkezi konumlarının bir listesini al.

Örnek Talep

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);

Örnek Yanıt

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

Yanıt Alanları

Alan Tip Açıklama
id integer Konum tanımlayıcı. Bir sunucu oluştururken location_id olarak kullan.
name string İnsan tarafından okunabilir konum adı
country_name string Konum ülkesi
country_code string ISO 3166-1 alfa-2 ülke kodu, büyük harf
is_active boolean Konum yeni sunucuları kabul edip etmediğini gösterir

Yanıt Durum Kodları

200 Konum listesi başarıyla alındı.
403 Eksik veya geçersiz API token'ı, ya da token'ın gerekli izinleri yok
ELDE ETMEK /api/v1/locations/{id}/

Bir konum alın

Tek bir konum id'si ile alın. Cevap, yukarıdaki alanlarla tek bir konum nesnesi.

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
}

Sunucularınızın çalıştığı yer

Her VPS.org sunucusu şu anda New Jersey, ABD' deki IPv4 ve IPv6 üzerinden tüm dünyadaki müşterilere hizmet veren yerimizde çalışır. Bir kimlik kodlama yerine her zaman konumların son noktasını okuyun, böylece entegrasyonunuz yeni konumlar eklendiğinde onları alacak.