Liệt kê image
/v2/imagesLiệt kê image của máy ảo.
Request
Tham số query
created_atstringBộ lọc so sánh theo ngày giờ tạo tài nguyên. Định dạng ISO 8601 (ví dụ 2015-08-27T09:49:58-05:00). Nếu không ghi múi giờ thì mặc định là UTC.
limitintegerSố item trả về trong một trang. Dùng kèm marker để phân trang.
markerstringID của item cuối cùng đã thấy, dùng để lấy trang tiếp theo.
member_statusstringLọc theo trạng thái member. Giá trị hợp lệ: accepted, pending, rejected, all. Mặc định là accepted.
namestringLọc theo tên image.
os_hiddenbooleanKhi là true, trả về cả image đang bị ẩn. Có từ phiên bản 2.7.
ownerstringLọc theo ID project (tenant); trả về image được chia sẻ bởi owner chỉ định.
protectedbooleanLọc theo thuộc tính protected. Giá trị hợp lệ: true, false. Giá trị khác sẽ trả về 400.
size_maxstringKích thước image tối đa (byte).
size_minstringKích thước image tối thiểu (byte).
statusintegerLọc theo trạng thái image (ví dụ active).
tagstringLọc theo tag. Có thể truyền nhiều lần; các điều kiện là AND (image phải có đủ tất cả tag đã chỉ định).
updated_atstringBộ lọc so sánh theo ngày giờ sửa tài nguyên. Định dạng ISO 8601.
visibilitystringLọc theo visibility. Giá trị hợp lệ: public, private, community, shared, all. Nếu bỏ trống, response trả về image public, private và shared có member status accepted.
sort_dirstringChiều sắp xếp: asc hoặc desc. Mặc định là desc.
sort_keystringSắp xếp theo thuộc tính (ví dụ name, id, updated_at). Mặc định là created_at.
sortstringGộp sort key và chiều sắp xếp. Cho phép nhiều cặp, cách nhau bằng dấu phẩy. Ví dụ: sort=name:asc,status:desc.
Request mẫu
- cURL
- HTTP
curl -ks -H 'Content-Type: application/json' \
-H 'X-Auth-Token: gAAAAA<...>' \
https://api.vietnix.cloud:9292/v2/images
GET https://api.vietnix.cloud:9292/v2/images
Response
Tham số
imagesarraybắt buộcDanh sách các object image.
firststringbắt buộcURI của trang đầu tiên trong response.
nextstringbắt buộcURI của trang tiếp theo. Không xuất hiện ở trang cuối.
schemastringbắt buộcURL của schema mô tả image máy ảo.
Các trường chung trong mỗi object image:
idstringbắt buộcID của image.
namestringbắt buộcTên image, dùng để đọc.
statusstringbắt buộcTrạng thái image (ví dụ active).
visibilitystringbắt buộcVisibility (public, private, shared, ...).
ownerstringbắt buộcID project (tenant) sở hữu image.
sizeintegerbắt buộcKích thước image tính bằng byte.
min_ramintegerbắt buộcRAM tối thiểu cần thiết (MB).
min_diskintegerbắt buộcDung lượng disk tối thiểu (GB).
created_atstringbắt buộcThời điểm tạo (ISO 8601).
updated_atstringbắt buộcThời điểm cập nhật gần nhất (ISO 8601) hoặc null.
protectedbooleanbắt buộcImage có đang được bảo vệ hay không.
tagsarraybắt buộcDanh sách tag.
checksumstringbắt buộcChecksum của image.
disk_formatstringbắt buộcĐịnh dạng disk (ví dụ qcow2, raw).
container_formatstringbắt buộcĐịnh dạng container (ví dụ bare).
os_typestringbắt buộcLoại hệ điều hành (ví dụ linux).
os_distrostringbắt buộcBản phân phối hệ điều hành.
os_hash_algostringbắt buộcThuật toán hash được dùng (ví dụ sha512).
os_hash_valuestringbắt buộcGiá trị hash.
filestringbắt buộcĐường dẫn tới file image, tương đối so với API.
direct_urlstringbắt buộcURL trực tiếp tới file image, nếu có.
Response mẫu
Response body
{
"images": [
{
"os_distro": "fedora42",
"os_admin_user": "root",
"hci_allow_set_password": "True",
"image_validated": "yes",
"name": "Fedora-42-x64",
"disk_format": "qcow2",
"container_format": "bare",
"visibility": "public",
"size": 2189361152,
"virtual_size": 5368709120,
"status": "active",
"checksum": "b372bf54310cc7015035bb45f3867520",
"protected": false,
"min_ram": 0,
"min_disk": 5,
"owner": "a430f930af8e47d7a1820a477129c343",
"os_hidden": false,
"os_hash_algo": "sha512",
"os_hash_value": "8d4281f665bce5594f7f485df224e21c48362d42019f2dfe17c1a4c9086dbfd43a8725cd06809d3582d30d88e887c6da623f8e16c211c242acf61d5bcfd6e6af",
"id": "5f8ee89a-de28-4d4d-9a96-707b0393ee37",
"created_at": "2025-10-02T08:30:39Z",
"updated_at": "2025-10-02T08:44:31Z",
"direct_url": "file:///mnt/vstorage/vols/datastores/glance/5f8ee89a-de28-4d4d-9a96-707b0393ee37",
"tags": [],
"self": "/v2/images/5f8ee89a-de28-4d4d-9a96-707b0393ee37",
"file": "/v2/images/5f8ee89a-de28-4d4d-9a96-707b0393ee37/file",
"schema": "/v2/schemas/image"
}
]
}
Mã trạng thái
Thành công
| Mã trạng thái | Mô tả |
|---|---|
| 200 - OK | Request thành công. |
Lỗi
| Mã trạng thái | Mô tả |
|---|---|
| 400 - Bad Request | Nội dung request không hợp lệ. |
| 401 - Unauthorized | Cần xác thực trước khi gửi request. |
| 403 - Forbidden | Policy của project không cho phép thực hiện thao tác này. |