Chụp ảnh chụp một máy chủ, liệt kê chúng và xóa những cái bạn không cần nữa.
Trả lại những bức ảnh chụp trong tài khoản của bạn, mới nhất trước, 25 mỗi trang.
Cần quyền: snapshots:list
curl -X GET "https://admin.vps.org/api/v1/snapshots/" \
-H "Authorization: Bearer YOUR_API_TOKEN"
import requests
url = "https://admin.vps.org/api/v1/snapshots/"
headers = {"Authorization": "Bearer YOUR_API_TOKEN"}
response = requests.get(url, headers=headers)
for snapshot in response.json()["results"]:
print(snapshot["uuid"], snapshot["label"], snapshot["ready"])
const response = await fetch('https://admin.vps.org/api/v1/snapshots/', {
headers: { 'Authorization': 'Bearer YOUR_API_TOKEN' }
});
const data = await response.json();
console.log(data.results);
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"uuid": "3f9a1c0e5b7d4e2f8a6c1b3d5e7f9a0b",
"label": "before-upgrade",
"server_hostname": "web-01",
"ready": true,
"deleting": false,
"created_at": "2026-09-14T18:30:00.000000Z",
"size_gb": 3.4
}
]
}
| Địa điểm | Kiểu | Mô tả |
|---|---|---|
uuid |
string | Tên nhận dạng bức ảnh chụp (32 ký tự 16- bit, không dấu gạch ngang) |
label |
string | Từ khóa được đặt khi bức ảnh chụp được tạo |
server_hostname |
string | Tên máy của máy phục vụ mà ảnh chụp được chụp, hoặc rỗng nếu máy phục vụ đó không còn tồn tại |
ready |
boolean | Thật khi chụp ảnh xong |
deleting |
boolean | Thật khi xóa đang diễn ra |
created_at |
datetime | Thời gian tạo (ISO 8601, UTC) |
size_gb |
number | Cỡ nén theo gigabyte |
Trả lại một đối tượng chụp ảnh với các trường ở trên. Dùng nó để hỏi sẵn sàng sau khi tạo một bức ảnh chụp.
curl -X GET "https://admin.vps.org/api/v1/snapshots/3f9a1c0e5b7d4e2f8a6c1b3d5e7f9a0b/" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Đang xếp hàng một bức ảnh chụp của máy phục vụ đã triển khai và trả lại uuid của bức ảnh chụp mới. Bức ảnh chụp được liệt kê ngay lập tức với sẵn sàng được đặt là sai.
Cần quyền: servers:snapshot
| Tham số | Kiểu | Yêu cầu | Mô tả |
|---|---|---|---|
action |
string | Đúng | Chắc phải là bức ảnh chụp |
snapshot_label |
string | Đúng | Một nhãn để nhận diện bức ảnh chụp |
curl -X POST "https://admin.vps.org/api/v1/servers/8c4f2a1e-5b3d-4e6f-9a7b-1c2d3e4f5a6b/snapshot/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"action": "snapshot", "snapshot_label": "before-upgrade"}'
import requests
server_uuid = "8c4f2a1e-5b3d-4e6f-9a7b-1c2d3e4f5a6b"
url = f"https://admin.vps.org/api/v1/servers/{server_uuid}/snapshot/"
headers = {"Authorization": "Bearer YOUR_API_TOKEN"}
data = {"action": "snapshot", "snapshot_label": "before-upgrade"}
response = requests.post(url, headers=headers, json=data)
print(response.json()["snapshot_uuid"])
{
"message": "Snapshot queued successfully",
"snapshot_uuid": "3f9a1c0e5b7d4e2f8a6c1b3d5e7f9a0b"
}
| 200 | Hành động đã được xếp hàng |
| 400 | thiếu action hoặc snapshot_ label, hoặc máy phục vụ chưa được triển khai |
| 402 | Không có phương thức thanh toán trong tập tin, hoặc hóa đơn chưa thanh toán |
| 404 | Không tìm thấy, hoặc nó thuộc về tài khoản khác |
Đang xếp hàng để xóa vĩnh viễn bức ảnh chụp. xóa là đúng cho đến khi nó biến mất.
Cần quyền: snapshots:delete
curl -X DELETE "https://admin.vps.org/api/v1/snapshots/3f9a1c0e5b7d4e2f8a6c1b3d5e7f9a0b/" \
-H "Authorization: Bearer YOUR_API_TOKEN"
{
"message": "Snapshot deletion queued"
}
| 202 | Chấp nhận: yêu cầu đã được xếp hàng |
| 404 | Không tìm thấy, hoặc nó thuộc về tài khoản khác |