Base URL: https://kvm.dynixvn.net
Xác thực:
- Gửi token trong header X-API-Token: your_token HOẶC trong body/query token.
- Token là cột token trong tài khoản của bạn.
Response chung: Luôn là JSON
Endpoint: /api/getpackage
Method: GET hoặc POST
Token: Tùy chọn
Ví dụ request (có token):
curl "https://kvm.dynixvn.net/api/getpackage" \
-H "X-API-Token: your_token"
Ví dụ request (không token):
curl "https://kvm.dynixvn.net/api/getpackage"
Response mẫu (thành công với token):
{
"status": "success",
"message": "Lấy danh sách gói hosting thành công",
"applied_discount": "20%",
"total_packages": 3,
"data": [
{
"id": 1,
"name": "HOSTING CHEAP 1",
"package_name": "cheap1",
"price_original": 100000,
"price_discounted": 80000,
"discount_percent": 20,
"disk_quota": "10000",
"bandwidth_limit": "unlimited",
"max_subdomains": "unlimited",
"max_parked_domains": "unlimited",
"max_addon_domains": "unlimited",
"description": "Mô tả gói chi tiết",
"language": "vi",
"cpanel_module": "jupiter"
}
]
}
Response mẫu (không token):
{
"status": "success",
"message": "Lấy danh sách gói hosting thành công",
"applied_discount": "Không (guest)",
"total_packages": 3,
"data": [
{
"id": 1,
"name": "HOSTING CHEAP 1",
"price_original": 100000,
"price_discounted": 100000,
"discount_percent": 0
// ... các trường khác
}
]
}
Endpoint: /api/buyhosting
Method: GET hoặc POST
Token: Bắt buộc
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | integer | Yes | ID gói hosting (lấy từ API lấy gói) |
| months | integer | Yes | Số tháng (1-12,24,36) |
| domain | string | Yes | Tên miền (không http/https/www) |
| coupon | string | No | Mã giảm giá |
Request mẫu:
curl -X POST "https://kvm.dynixvn.net/api/buyhosting" \
-H "Content-Type: application/json" \
-H "X-API-Token: your_token" \
-d '{
"id": 1,
"months": 3,
"domain": "example.com",
"coupon": "WELCOME10"
}'
Response thành công:
{
"status": "success",
"message": "Hosting purchased successfully",
"data": {
"transaction_id": "A1B2C3D4",
"domain": "example.com",
"username": "texample",
"password": "R@nd0mP@ss123",
"package": "HOSTING CHEAP 1",
"months": 3,
"price": 240000,
"discount_applied": "20%",
"start_date": "2024-01-01 10:30:00",
"end_date": "2024-04-01 10:30:00",
"server_ip": "192.168.1.100",
"coupon_used": true
}
}
Endpoint: /api/actionhosting
Method: GET hoặc POST
Token: Bắt buộc
| Action | Method | Parameters | Description |
|---|---|---|---|
| get_info | GET/POST | hosting_id | Lấy thông tin hosting |
| change_password | POST | hosting_id | Đổi mật khẩu hosting |
| renew | POST | hosting_id, months | Gia hạn hosting |
| delete | POST | hosting_id | Xóa hosting |
Ví dụ lấy thông tin hosting:
curl "https://kvm.dynixvn.net/api/actionhosting?action=get_info&hosting_id=123&token=your_token"
Ví dụ gia hạn hosting:
curl -X POST "https://kvm.dynixvn.net/api/actionhosting" \
-H "Content-Type: application/json" \
-H "X-API-Token: your_token" \
-d '{
"action": "renew",
"hosting_id": 123,
"months": 6
}'
Response thành công (gia hạn):
{
"status": "success",
"message": "Hosting renewed successfully",
"data": {
"new_end_date": "2024-07-01 10:30:00",
"months_added": 6,
"amount_paid": 480000,
"discount_applied": "20%",
"transaction_id": "RENEW1234"
}
}
API /api/buyhosting đã tự động kiểm tra domain trước khi tạo hosting. Nếu domain đã tồn tại trên hệ thống sẽ báo lỗi.
Lỗi domain tồn tại:
{
"status": "error",
"message": "Domain already exists on the system"
}
curl "https://kvm.dynixvn.net/api/getpackage" \
-H "X-API-Token: your_token"
curl -X POST "https://kvm.dynixvn.net/api/buyhosting" \
-H "Content-Type: application/json" \
-H "X-API-Token: your_token" \
-d '{
"id": 1,
"months": 12,
"domain": "mywebsite.com"
}'
curl -X POST "https://kvm.dynixvn.net/api/actionhosting" \
-H "Content-Type: application/json" \
-H "X-API-Token: your_token" \
-d '{
"action": "renew",
"hosting_id": 123,
"months": 6
}'
id từ response của /api/getpackage để mua hostinghosting_id từ response mua hàng để quản lý sau nàytransaction_id để tra cứu giao dịch| Trường | Ý nghĩa | Ví dụ |
|---|---|---|
| price_original | Giá gốc của gói (không chiết khấu) | 100000 |
| price_discounted | Giá sau chiết khấu (nếu có token) | 80000 |
| discount_percent | % chiết khấu đang áp dụng | 20 |
| disk_quota | Dung lượng disk (MB hoặc "unlimited") | "10000" |
| bandwidth_limit | Giới hạn bandwidth | "unlimited" |
| transaction_id | Mã giao dịch duy nhất | "A1B2C3D4" |
| username | Username để đăng nhập hosting | "texample" |
| server_ip | IP server chứa hosting | "192.168.1.100" |