List de lokaasjes wêr jo in VPS ynsette kinne. Jou in lokaasje- id troch as location_ id as jo in tsjinner oanmeitsje.
In list fan alle beskikbere lokaasjes fan datasintrums ophelle wêr't jo VPS-tsjinners ynsette kinne.
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
}
]
}
| Fjild | Type | Beskriuwing |
|---|---|---|
id |
integer | Lokaasje-identifikator. Brûk it as location_id by it oanmeitsjen fan in tsjinner. |
name |
string | Lokaasjenamme yn minsklike taal |
country_name |
string | Lân wêryn' t de lokaasje leit |
country_code |
string | ISO 3166-1 alfa-2 lânkoade, haadletters |
is_active |
boolean | Oft de lokaasje nije tsjinners akseptearret |
| 200 | Lokaasjelist mei súkses ophelle |
| 403 | Untbrekkend of ûnjildich API-token, of it token hat net de fereaske tagongsrjochten |
Haal in lokaasje op neffens syn id. It antwurd is in lokaasjeobjekt mei de boppesteande fjilden.
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- tsjinner draait op it stuit op ús lokaasje yn New Jersey, USA, dy' t klanten oer de hiele wrâld tsjinnet fia IPv4 en IPv6. Lês altyd de einpunten fan lokaasjes ynstee fan in id hardcode, sadat jo yntegraasje nije lokaasjes opnimt as se tafoege wurde.