桌面
查询VNC会话列表
1.接口说明
接口路径:/hpc/openapi/v2/desktop/vnc
请求方式:GET
请求数据类型:application/json
接口描述:查询VNC会话列表
2.请求消息
请求参数:
Headers:
名称 | 类型 | 必填 | 描述 | 示例 |
---|---|---|---|---|
token | string | 是 | 接口凭证 | eyJhbGciOiJIUzI1N... |
3.请求示例
cURL请求示例
curl --location 'https://api01.xxx.com:65106/hpc/openapi/v2/desktop/vnc' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODYyMTI2MDg1MTkiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.szavkT_QGGEWMbSjvWON7aeflkwl0btTf0XBeUwsyks'
Java请求示例
import okhttp3.*;
public class QueryVNCListDemo {
public static final String TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODY5MDg1MDkyMzEiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.U7pZKgO_K6NuRwOWPxblDfgRpGeVxS-BYieOdLhGDK4";
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://api01.xxx.com:65106/hpc/openapi/v2/desktop/vnc")
.method("GET", null)
.addHeader("token", TOKEN)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Python请求示例
import requests
url = "https://api01.xxx.com:65106/hpc/openapi/v2/desktop/vnc"
payload = {}
headers = {
'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODYyMTI2MDg1MTkiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.szavkT_QGGEWMbSjvWON7aeflkwl0btTf0XBeUwsyks'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
4.响应消息
返回参数:
名称 | 类型 | 描述 | 示例 |
---|---|---|---|
msg | string | 信息 | success |
code | string | 状态码 | 0 |
data | object | 图形数据 | |
total | number | 总数 | 1 |
list | array | 图形列表 | |
id | string | 主键ID | e272e9bc5e6d40fbbcc39d82f172f63a |
createDate | string | 创建时间 | 2023-02-02 11:59:45 |
hostname | string | 节点名称 | gv101 |
jobs | string | 作业ID | SIG |
length | string | 分辨率长度 | 1080 |
name | string | 会话名称 | gv101:4 |
sid | string | 会话ID | 4 |
user | string | 所属用户 | test_1215 |
width | string | 分辨率宽度 | 1920 |
ip | string | 节点ip | 10.0.41.101 |
sessionId | string | 会话唯一标识 | 100 |
返回示例:
{
"code": "0",
"msg": "success",
"data": {
"total": 1,
"list": [
{
"id": "e272e9bc5e6d40fbbcc39d82f172f63a",
"createDate": "2023-02-02 11:59:45",
"hostname": "gv101",
"jobs": "SIG",
"length": "1080",
"width": "1920",
"name": "gv101:4",
"sid": "4",
"user": "test_1215",
"ip": "10.0.41.101",
"sessionId": "gv101--test_1215--SIG--4"
}
]
}
}
5.错误码
错误码 | 说明 |
---|---|
0 | 成功 |
10001 | 内部错误 |
10003 | 参数不全 |
10004 | 参数无效 |
10008 | 权限不足 |
10009 | 不支持的版本 |
10010 | 角色映射错误 |
10011 | 调用频次过高 |
10012 | 内容大小超限 |
815201 | 所有VNC节点均过载或者SSH不通,VNC会话创建失败 |
815008 | 桌面服务异常 |
815010 | 桌面会话不存在,删除失败 |