VPS.org API

REST API Documentation

Standort-API

Liste die Orte auf, an denen du einen VPS bereitstellen kannst. Lege die ID eines Standorts als location_id vor, wenn du einen Server erstellst.

Endpunkte 2 endpoints
Basispfad /api/v1/locations
ERHALTEN /api/v1/locations/

Alle Standorte auflisten

Rufen Sie eine Liste aller verfügbaren Rechenzentrumsstandorte auf, an denen Sie VPS-Server bereitstellen können.

Beispielanfrage

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

Beispielantwort

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

Antwortfelder

Feld Typ Description
id integer Standortkennung. Verwenden Sie es als location_id beim Erstellen eines Servers.
name string Name des lesbaren Ortes
country_name string Land ist der Standort in
country_code string ISO 3166-1 Alpha-2-Ländercode, Großbuchstaben
is_active boolean Ob der Standort neue Server akzeptiert

Antwortstatuscodes

200 Liste der Standorte erfolgreich abgerufen
403 Fehlendes oder ungültiges API-Token oder dem Token fehlt die erforderliche Berechtigung
ERHALTEN /api/v1/locations/{id}/

Einen Standort ermitteln

Abrufen eines einzigen Standorts durch seine ID. Die Antwort ist ein Standortobjekt mit den oben genannten Feldern.

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
}

Wo Ihre Server laufen

Jeder VPS.org Server läuft derzeit in unserem Standort New Jersey, USA, der Kunden weltweit über IPv4 und IPv6 bedient. Lesen Sie immer den Endpunkt der Standorte statt einer Hardcodierung einer ID, so dass Ihre Integration neue Standorte aufnimmt, wenn sie hinzugefügt werden.