更新时间:2022-08-25 GMT+08:00
分享

请求SessionID

应用场景

认证用户名和密码前,建立会话。

前提条件

终端正常启动且网络正常。

接口概述

该操作获取一个新的SessionID,为下一步登录验证用户名和密码做准备。

SessionID放在响应头的Set-Cookie字段。

请求URL

/action.cgi?ActionID=WEB_RequestSessionIDAPI

 /**
     * 请求会话id
     *
     * @return 返回sessionid
     */
    private static String initSeesionId() {
        String uri = baseUrl + "/action.cgi?ActionID=WEB_RequestSessionIDAPI";
        Map<String, String> header = new HashMap<>();
        HttpClientUtil.post(uri, null, header);
        return HttpClientUtil.sessionId;
    }

请求成功返回报文

HTTP/1.1 200 OK
Set-Cookie: SessionID=161419d23001a280c8cab12b4c93b1cb1757c5e99243e470d17104aa7314b8ca; Path=/; Secure; HttpOnly
Connection: Keep-Alive
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: sameorigin
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000; includeSubdomains
Content-Security-Policy: script-src 'self' 'unsafe-eval' 'unsafe-inline' ;img-src 'self'
Content-Type: text/plain
Response-Result: 1
Content-Length: 83

{"success":1,"data":"{\"acSessionId\":\"\",\"szTermType\":\"Terminal Type\"}"}

相关文档