Faʻavasega nofoaga e mafai ai ona e faʻaaogaina se VPS. Tuʻuina atu le id o se nofoaga e pei o le location_id pe a e fausia se 'au'aunaga.
Toe maua se lisi o nofoaga uma o le datacenter e mafai ai ona e faʻaaogaina le VPS.
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
}
]
}
| Aoga | Ituaiga | Faʻamatalaga |
|---|---|---|
id |
integer | Faailoga nofoaga. Faaaoga o se location_id pe a fausia se'server'. |
name |
string | igoa o le nofoaga e faitauina e tagata |
country_name |
string | O le atunuu o le nofoaga |
country_code |
string | ISO 3166-1 alpha-2 country code, capital |
is_active |
boolean | Pe a talia e le nofoaga servers fou |
| 200 | Lisi o nofoaga ua maua ma le manuia |
| 403 | Lelei pe lē talafeagai le tokeni API, po o le tokeni e leai se aia tatau e manaʻomia |
Toe maua se nofoaga fa'aonapo nei e ala i lona id. O le tali o se meatotino o se nofoaga e tasi ma le itu i luga.
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
}
O le a uma VPS.org server i le taimi nei e tatala i lo tatou New Jersey, USA nofoaga, lea e tautuaina tagata faaaoga i le lalolagi atoa i luga o IPv4 ma IPv6. I taimi uma faitau le nofoaga i le tulaga o le faʻaiuga nai lo le hardcoding se id, ina ia mafai ona e faʻaaogaina le faʻaopopoina o nofoaga fou pe a latou faʻaopopoina.