桌面

创建VNC会话

1.接口说明

接口路径:/hpc/openapi/v2/desktop/vnc

请求方式:PUT

请求数据类型:application/json

接口描述:创建VNC会话,一个用户只能创建一个VNC会话,重复调用接口,返回之前已经创建的VNC会话,每天凌晨1点清理空闲的VNC会话(长时间无客户端链接的会话)

2.请求消息

请求参数:

Headers:

名称 类型 必填 描述 示例
tokenstring接口凭证eyJhbGciOiJIUzI1N...

3.请求示例

cURL请求示例

curl --location --request PUT 'https://api01.xxx.com:65106/hpc/openapi/v2/desktop/vnc' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODYxMjMzNDY1NjgiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.iQUBzN32jiCeeFuJ9lFS_XjBpxenEEupQRiyA3Ef334'

Java请求示例

import okhttp3.*;

public class CreateVNCDemo {

    public static final String TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODY5MDg1MDkyMzEiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.U7pZKgO_K6NuRwOWPxblDfgRpGeVxS-BYieOdLhGDK4";

    public static void main(String[] args) throws Exception {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        MediaType mediaType = MediaType.parse("text/plain");
        RequestBody body = RequestBody.create(mediaType, "");
        Request request = new Request.Builder()
                .url("https://api01.xxx.com:65106/hpc/openapi/v2/desktop/vnc")
                .method("PUT", body)
                .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.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODYxMjMzNDY1NjgiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.iQUBzN32jiCeeFuJ9lFS_XjBpxenEEupQRiyA3Ef334'
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)

4.响应消息

返回参数:

名称 类型 描述 示例
msgstring信息success
codestring状态码0
dataobject图形数据
idstring主键IDe272e9bc5e6d40fbbcc39d82f172f63a
createDatestring创建时间2023-02-02 11:59:45
hostnamestring节点名称gv101
jobsstring作业IDSIG
lengthstring分辨率长度1080
namestring会话名称gv101:4
sidstring会话ID4
userstring所属用户test_1215
widthstring分辨率宽度1920
ipstring节点ip10.0.41.101
sessionIdstring会话唯一标识100

返回示例:

{
  "code": "0",
  "msg": "success",
  "data": {
    "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 桌面会话不存在,删除失败

results matching ""

    No results matching ""