查询主机信息

该接口通过鉴权接口颁发的token作为访问令牌,查询主机信息时需要确保主机id正确。可用于查询主机状态等主机的基础信息。

1.接口描述

接口请求地址:GET v1/pve/open/one/{id}

2.输入参数

参数名称 描述 是否必选 类型 Location
Finovy-Access-Token 令牌-口令 yes string header
id 主机ID yes string path

3.输出参数

参数名称 描述 类型
id 主机ID string
name 主机名称 string
gpuConfiguration GPU配置 string
gpuNumber GPU数量 int
memory 内存数 int
cpu cpu核数 int
rigidDisk 硬盘数 int
operatingSystem 操作系统(Windows,Windows Server,Ubuntu Server,Debian) string
hostAccount 用户名(登录用户名) string
hostPw 密码 string
address 主机连接地址 string
port 主机连接端口 int
pveMachineType 主机使用范围,用途(0:普通办公、1:图像处理、2:算法区域) string
createTime 主机创建时间 long
expirationTime 主机到期时间,有可能为空 long
mac MAC地址,有可能为空 string
ipv4 ip地址,有可能为空 string
useType 主机类型(0按量,1包时段) string
status 主机状态(0已关机 1开机中 2已开机 3扣费中 4关机中 5已过期) string
area 主机区域(0华南、1华西、2国际) string

4.示例

示例1:请求成功示例

输入示例

GET https://client.xuandashi.com/v1/pve/open/one/2dRVVRTTOJ
Finovy-Access-Token: 3V41hUWEwlwKH44m7SpJOs
<公共请求参数>

输出示例

{
    "code":0,
    "data":{
        "id": "rEJjwEY5Wt",
        "name": "渲大师rEJjwEY5Wt",
        "gpuConfiguration": "-",
        "gpuNumber": null,
        "memory": 16,
        "cpu": 4,
        "rigidDisk": 128,
        "operatingSystem": "Windows",
        "hostAccount": "root",
        "hostPw": "EYAHeOJi",
        "useType": "0",
        "status": "0",
        "address": "gx-xds-rdp.songmao-idc.com",
        "port": 54220,
        "mac": "22:C1:25:8F:A1:AE",
        "ipv4": "gx-xds-rdp.songmao-idc.com:54220",
        "pveMachineType": "0",
        "area": "0",
        "createTime": 1692071029000,
        "expirationTime": null
    },
    "msg":"success",
    "success":true,
    "traceId":"xxxxxxxxxxxxxx"
}

5.错误码

详情可查看通用错误码

6.Java请求示例

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main{
    public static void main(String[] args) throws IOException {
        URL url = new URL("https://client.xuandashi.com/v1/pve/open/one/2dRVVRTTOJ");
        HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
        httpConn.setRequestMethod("GET");

        httpConn.setRequestProperty("Content-Type", "application/json");
        httpConn.setRequestProperty("Finovy-Access-Token", "3V41hUWEwlwKH44m7SpJOs");
        
        InputStream responseStream = httpConn.getResponseCode() / 100 == 2
                ? httpConn.getInputStream()
                : httpConn.getErrorStream();
        Scanner s = new Scanner(responseStream).useDelimiter("\\A");
        String response = s.hasNext() ? s.next() : "";
        System.out.println(response);
    }
}