VPS.org API

Dokumentasi API REST

API Lokasi

Daftar lokasi dimana anda dapat menyebarkan VPS. Melewati id lokasi sebagai lokasi_id ketika anda membuat server.

Titik akhir 2 endpoints
Jalur Dasar /api/v1/locations
MENDAPATKAN /api/v1/locations/

Daftar Semua Lokasi

Ambil daftar semua lokasi datacenter yang tersedia di mana Anda dapat menyebarkan server VPS.

Contoh Permintaan

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

Contoh Jawaban

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

Kolom Respons

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

Kode Status Respons

200 Daftar lokasi berhasil diambil.
403 Hilang atau token API tak valid, atau token kurang izin yang diperlukan
MENDAPATKAN /api/v1/locations/{id}/

Cari Lokasi

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
}

Tempat Para Server Anda Lari

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.