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.
Ophalen van een lijst van alle beschikbare datacenterlocaties waar u VPS-servers kunt implementeren.
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
}
]
}
| 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 |
| 200 | Lijst met succesvol opgehaalde locaties |
| 403 | Ontbrekende of ongeldige API token, of het token mist de vereiste toestemming |
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
}
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.