欢雨科技项目
  1. RainlyStack API
欢雨科技项目
  • RainlyStack API
    • 创建虚拟机
      POST
    • 删除虚拟机
      POST
    • 重装虚拟机
      POST
    • 重置虚拟机IP
      POST
    • 重置虚拟机密码
      POST
    • 获取虚拟机资源状态
      POST
    • 创建NAT转发
      POST
    • 删除指定NAT转发
      POST
    • 删除虚拟机全部NAT转发
      POST
    • 获取VNC Token
      POST
    • 根据虚拟机ID获取信息
      GET
    • 获取指定虚拟机的NAT转发
      GET
    • 查询虚拟机电源
      GET
    • 取消暂停虚拟机
      GET
    • 暂停虚拟机
      GET
    • 强制关闭虚拟机
      GET
    • 重启虚拟机
      GET
    • 关闭虚拟机
      GET
    • 开启虚拟机
      GET
    • 根据节点ID获取信息
      GET
    • 获取所有节点资源信息
      GET
  1. RainlyStack API

创建虚拟机

POST
https://localhost/api/vms/create
【开发提示】
OSID IPID MAC 可以从【根据节点ID获取信息接口】上获取
OSID是必须填写的 IPID和MAC可以留空自动获取
硬盘可以无限叠加,多个数组分为多块硬盘,is_system_disk = true 代表是系统盘,不要设置两个is_system_disk = true 否则会有很奇怪的事情发生

请求参数

Header 参数

Body 参数application/json

示例
{
    "vms_name": "rainly",
    "vms_label": "KVM",
    "vms_cpu": "4",
    "vms_cpu_quota": 100,
    "vms_ram": "4096",
    "vms_bw_int": "100",
    "vms_bw_out": "100",
    "vms_mac": "52:54:00:12:34:56",
    "vms_vnc_port": "1000",
    "vms_vnc_passwd": "1000",
    "vms_os_username": "root",
    "vms_os_passwd": "mc520.",
    "vms_os_auto": "null",
    "vms_remote_port": "22",
    "vms_nat_limit": "20",
    "vms_backup_limit": "10",
    "vms_snapshot_limit": "10",
    "vms_status": "处理",
    "vms_area_id": 1,
    "vms_node_id": 1,
    "vms_user_id": 1,
    "vms_vlan": 0,
    "vms_ipid": 2,
    "vms_osid": 1,
    "vms_disks": [
        {
            "name": "kvm1-system",
            "path": "/home/kvm/kvm1",
            "size": "100",
            "is_system_disk": true,
            "format": "qcow2",
            "cache": "writeback",
            "iops_read": "2000",
            "iops_write": "2000"
        },
        {
            "name": "kvm1-data",
            "path": "/home/kvm/kvm1",
            "size": "200",
            "format": "qcow2",
            "is_system_disk": false,
            "cache": "writeback",
            "iops_read": "3000",
            "iops_write": "3000"
        }
    ]
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://localhost/api/vms/create' \
--header 'x-api-key;' \
--header 'Content-Type: application/json' \
--data-raw '{
    "vms_name": "rainly",
    "vms_label": "KVM",
    "vms_cpu": "4",
    "vms_cpu_quota": 100,
    "vms_ram": "4096",
    "vms_bw_int": "100",
    "vms_bw_out": "100",
    "vms_mac": "52:54:00:12:34:56",
    "vms_vnc_port": "1000",
    "vms_vnc_passwd": "1000",
    "vms_os_username": "root",
    "vms_os_passwd": "mc520.",
    "vms_os_auto": "null",
    "vms_remote_port": "22",
    "vms_nat_limit": "20",
    "vms_backup_limit": "10",
    "vms_snapshot_limit": "10",
    "vms_status": "处理",
    "vms_area_id": 1,
    "vms_node_id": 1,
    "vms_user_id": 1,
    "vms_vlan": 0,
    "vms_ipid": 2,
    "vms_osid": 1,
    "vms_disks": [
        {
            "name": "kvm1-system",
            "path": "/home/kvm/kvm1",
            "size": "100",
            "is_system_disk": true,
            "format": "qcow2",
            "cache": "writeback",
            "iops_read": "2000",
            "iops_write": "2000"
        },
        {
            "name": "kvm1-data",
            "path": "/home/kvm/kvm1",
            "size": "200",
            "format": "qcow2",
            "is_system_disk": false,
            "cache": "writeback",
            "iops_read": "3000",
            "iops_write": "3000"
        }
    ]
}'

返回响应

🟢200成功
application/json
Body

示例
{}
修改于 2025-10-15 10:52:25
下一页
删除虚拟机
Built with