桌面
获取VNC会话打开地址
1.接口说明
接口路径:/hpc/openapi/v2/desktop/vnc/{sessionId}/launchurl
请求方式:GET
请求数据类型:application/json
接口描述:获取VNC会话打开地址
2.请求消息
请求参数:
路径参数
参数名称 | 示例 | 备注 |
---|---|---|
sessionId | gv101--test_1215--SIG--4 | 会话唯一标识 |
Headers:
名称 | 类型 | 必填 | 描述 | 示例 |
---|---|---|---|---|
token | string | 是 | 接口凭证 | eyJhbGciOiJIUzI1N... |
3.请求示例
cURL请求示例
curl --location 'https://api01.xxx.com:65106/hpc/openapi/v2/desktop/vnc/gv101--test_1215--SIG--4/launchurl' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODYxMjMzNDY1NjgiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.iQUBzN32jiCeeFuJ9lFS_XjBpxenEEupQRiyA3Ef334'
Java请求示例
import okhttp3.*;
public class GetVNCLaunchUrlDemo {
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/gv101--test_1215--SIG--4/launchurl")
.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/gv101--test_1215--SIG--4/launchurl"
payload = {}
headers = {
'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODYxMjMzNDY1NjgiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.iQUBzN32jiCeeFuJ9lFS_XjBpxenEEupQRiyA3Ef334'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
4.响应消息
返回参数:
名称 | 类型 | 描述 | 示例 |
---|---|---|---|
msg | string | 信息 | success |
code | string | 状态码 | 0 |
data | object | 返回信息 | |
withDomain | boolean | novncurl是否包含domain true:直接访问novncurl即可登录vnc false:需要拼接 获取授权区域地址接口 中返回的hpcUrls | false |
novncUrl | string | vnc会话打开地址 | /vnc.html?path=/vncws?token=94e35e96-a29c-11ed-8bea-525400dc9fc8&mm=dI066SLnQbjx4k1Lgue5Iw==&resize=remote |
返回示例:
{
"code": "0",
"msg": "success",
"data": {
"novncUrl": "/vnc.html?path=/vncws?token=94e35e96-a29c-11ed-8bea-525400dc9fc8&mm=dI066SLnQbjx4k1Lgue5Iw==&resize=remote",
"withDomain": false
}
}
5.错误码
错误码 | 说明 |
---|---|
0 | 成功 |
10001 | 内部错误 |
10003 | 参数不全 |
10004 | 参数无效 |
10008 | 权限不足 |
10009 | 不支持的版本 |
10010 | 角色映射错误 |
10011 | 调用频次过高 |
10012 | 内容大小超限 |
815201 | 所有VNC节点均过载或者SSH不通,VNC会话创建失败 |
815008 | 桌面服务异常 |
815010 | 桌面会话不存在,删除失败 |