Daftar lokasi dimana anda dapat menyebarkan VPS. Melewati id lokasi sebagai lokasi_id ketika anda membuat server.
Ambil daftar semua lokasi datacenter yang tersedia di mana Anda dapat menyebarkan server VPS.
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);
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "New Jersey",
"country_name": "United States",
"country_code": "US",
"is_active": true
}
]
}
| Ruas | Jenis | Deskripsi |
|---|---|---|
id |
integer | Identifier lokasi. Gunakan sebagai lokasi_id ketika membuat server. |
name |
string | Nama lokasi yang dapat dibaca manusia |
country_name |
string | Negara lokasi berada di |
country_code |
string | ISO 3166-1 Alpha-2 kode negara, huruf besar |
is_active |
boolean | Apakah lokasi menerima server baru |
| 200 | Daftar lokasi berhasil diambil. |
| 403 | Hilang atau token API tak valid, atau token kurang izin yang diperlukan |
Ambil lokasi tunggal berdasarkan id. Responnya adalah satu objek lokasi dengan ruas di atas.
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
}
Setiap server VPS.org saat ini berjalan di lokasi New Jersey, USA, yang melayani pelanggan di seluruh dunia lebih dari IPv4 dan IPv6. Selalu membaca titik akhir lokasi daripada hardcoding sebuah id, sehingga integrasi Anda mengambil lokasi baru ketika mereka ditambahkan.