Navedite lokacije, kjer lahko uporabite VPS. Podajte id lokacije kot lokacijo_ id, ko ustvarite strežnik.
Pridobite seznam vseh razpoložljivih lokacij podatkovnega centra, kjer lahko uporabite VPS strežnike.
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
}
]
}
| Polje | Vrsta | Opis |
|---|---|---|
id |
integer | Identifikator lokacije. Uporabi jo kot lokacijo_ id pri ustvarjanju strežnika. |
name |
string | Ime lokacije, ki se lahko bere v človeku |
country_name |
string | Država, v kateri je lokacija |
country_code |
string | ISO 3166-1 alfa-2 koda države, velika |
is_active |
boolean | Ali lokacija sprejema nove strežnike |
| 200 | Seznam lokacij uspešno pridobljen |
| 403 | Manjkajoči ali neveljavni API žeton, ali token manjka zahtevano dovoljenje |
Pridobite eno lokacijo po id. Odziv je eno lokacijo objekt z zgornjimi polji.
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
}
Vsak strežnik VPS.org trenutno teče v naši lokaciji New Jersey, ZDA, ki služi strankam po vsem svetu preko IPv4 in IPv6. Vedno preberite kraje opazovanja, namesto da trdo kodiranje id, tako da vaša integracija izbere nove lokacije, ko so dodani.