Danh sách các vị trí mà bạn có thể triển khai VPS. Gửi ID của vị trí như là location_ id khi tạo máy chủ.
Lấy danh sách tất cả các vị trí trung tâm dữ liệu sẵn có nơi bạn có thể triển khai máy chủ 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
}
]
}
| Địa điểm | Kiểu | Mô tả |
|---|---|---|
id |
integer | Định danh vị trí. Dùng nó như là location_id khi tạo máy phục vụ. |
name |
string | Tên vị trí đọc được |
country_name |
string | Quốc gia có vị trí |
country_code |
string | Mã quốc gia ISO 3166-1 alpha-2, chữ cái lớn |
is_active |
boolean | Có nên chấp nhận máy chủ mới hay không |
| 200 | Đã truy xuất thành công danh sách địa điểm |
| 403 | Thiếu hoặc không hợp lệ token API, hoặc token không có quyền cần thiết |
Lấy một vị trí đơn theo số ID của nó. Phản hồi là một đối tượng vị trí với các trường trên.
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
}
Mỗi máy chủ VPS.org hiện đang chạy ở New Jersey, Mỹ, nơi phục vụ khách hàng trên toàn thế giới qua IPv4 và IPv6. Luôn đọc điểm cuối của địa điểm thay vì mã hóa một ID, vì vậy việc tích hợp của bạn sẽ lấy địa điểm mới khi chúng được thêm vào.