VPS.org API

REST API-documentatie

Locaties-API

Geef de locaties aan waar u een VPS kunt implementeren. Geef de id van een locatie als locatie_id door wanneer u een server aanmaakt.

Eindpunten 2 endpoints
Basispad /api/v1/locations
KRIJGEN /api/v1/locations/

Alle locaties weergeven

Ophalen van een lijst van alle beschikbare datacenterlocaties waar u VPS-servers kunt implementeren.

Voorbeeldverzoek

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

Voorbeeldantwoord

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

Antwoordvelden

Veld Type Omschrijving
id integer Locatie-identificatie. Gebruik het als location_id bij het aanmaken van een server.
name string Naam van de voor mensen leesbare locatie
country_name string Land waar de locatie zich bevindt
country_code string ISO 3166-1 alpha-2-landcode, hoofdletters
is_active boolean Of de locatie nieuwe servers accepteert

Responsstatuscodes

200 Lijst met succesvol opgehaalde locaties
403 Ontbrekende of ongeldige API token, of het token mist de vereiste toestemming
KRIJGEN /api/v1/locations/{id}/

Een locatie zoeken

Een enkele locatie ophalen door zijn id. Het antwoord is één locatie-object met de velden hierboven.

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
}

Waar uw servers draaien

Elke VPS.org server draait momenteel in onze locatie in New Jersey, USA, die klanten wereldwijd bedient via IPv4 en IPv6. Lees altijd het locatie-eindpunt in plaats van een id-coderen, zodat uw integratie nieuwe locaties oppikt wanneer ze worden toegevoegd.