更新实例指纹
最近更新:2025-04-18 19:07:06
更新实例指纹
const update = async () => {
const res = await sdk.update(
"c78f137783584d18946955cac****",
"fad77b07f127427da825d3df****",
{
flag: 0,
sessionId: "fad77b07f127427da825d3df****",
sessionName: "实例名称112233",
browser: {
system: "Windows 10",
uaVersion: "122",
publicIp: "192.168.0.171",
ipChannel: "ipdata",
kernel: "chrome",
kernelVersion: "122",
},
}
);
};
参数
名称 | 类型 | 是否必须 | 字段含义 | 备注 |
flag | int | 否 | 更新标识 | 0: 更新基础信息 2:更新指纹信息 4:更新代理信息 8:清除 cookie 16:清除缓存 |
cookies 结构
名称 | 类型 | 是否必须 | 字段含义 | 备注 |
creation_utc | float64 | 是 | Cookie 创建的 UTC 时间戳 | 以浮点数形式表示 |
expires_utc | float64 | 否 | Cookie 过期的 UTC 时间戳 | 以浮点数形式表示,若值为 0 可能表示不过期 |
has_expires | int | 否 | 表示是否有过期时间 | 可以用不同整数值代表不同状态,如 1 表示有过期时间,0 表示无 |
host_key | string | 是 | 关联的主机键 | 用于标识 Cookie 所属的主机 |
is_httponly | int | 否 | 表示是否为 HttpOnly Cookie | 通常用 1 表示是,0 表示否,HttpOnly 的 Cookie 不能通过脚本访问 |
is_persistent | int | 否 | 表示是否为持久化 Cookie | 用不同整数值代表不同状态,如 1 表示持久化,0 表示非持久化 |
is_same_party | int | 否 | 表示是否为 SameParty Cookie | 用于跨站请求相关的安全控制,用不同整数值代表不同状态 |
is_secure | int | 否 | 表示是否为安全 Cookie | 通常用 1 表示是,0 表示否,安全 Cookie 仅在 HTTPS 连接中传输 |
last_access_utc | float64 | 否 | 最后访问的 UTC 时间戳 | 以浮点数形式表示,记录最后一次访问该 Cookie 的时间 |
last_update_utc | float64 | 否 | 最后更新的 UTC 时间戳 | 以浮点数形式表示,记录最后一次更新该 Cookie 的时间 |
name | string | 是 | Cookie 的名称 | 用于标识该 Cookie 的唯一名称 |
path | string | 是 | Cookie 适用的路径 | 表示该 Cookie 在哪些路径下是有效的 |
priority | int | 否 | Cookie 的优先级 | 不同整数值代表不同优先级,如 1 表示低,2 表示中,3 表示高 |
samesite | int | 否 | 表示 SameSite 属性值 | 用于控制跨站请求时 Cookie 的发送,不同整数值代表不同属性值 |
source_port | int | 否 | 源端口号 | 记录创建该 Cookie 的源端口号 |
source_scheme | int | 否 | 源协议方案 | 不同整数值代表不同协议,如 1 表示 HTTP,2 表示 HTTPS |
top_frame_site_key | string | 否 | 顶级框架的站点键 | 用于标识顶级框架的站点信息 |
value | string | 是 | Cookie 的值 | 存储 Cookie 的实际内容 |
browser 结构
名称 | 类型 | 是否必须 | 字段含义 | 备注 |
system | string | 是 | 操作系统 | 目前支持: Windows 7,Windows 8,Windows 8.1,Windows 10,Windows 11 |
uaVersion | string | 否 | ua 大版本号 | 范围 100-124 |
publicIp | string | 是 | 公网 ip | 代理 IP,未设置代理,将会取所在主机IP |
ipChannel | string | 否 | ip 检测渠道 | 可为空,枚举 ip2location,ipdata |
kernel | string | 是 | 内核类型 | 枚举 chrome,firefox |
kernelVersion | string | 是 | 内核版本 | 107,119,122 |
proxy | object | 否 | 代理信息 | |
site_accounts | array | 否 | 账号信息 | 数组,每个元素为一个账号信息,包含 user,pwd,site |
- 请求
{
"flag": 0,
"sessionId": "c61458b4d8464453b9f120dfbea736db",
"sessionName": "实例名称",
"browser": {
"system": "",
"uaVersion": "",
"publicIp": "192.168.0.171",
"ipChannel": "",
"kernel": "chrome",
"kernelVersion": "127",
"proxy": {
"protocol": "http",
"host": "192.168.0.171",
"port": 10809,
"userName": "",
"password": ""
}
}
}
interface
提供接口数据,方便用户快速使用
/** 环境信息 */
export interface EnvData {
id: number;
userId: string;
companyId: string;
apiKey: string;
sessionId: string;
/** 名称 */
sessionName: string;
productId: string;
/**
* 服务器类型
*
* @description 海外:包含“hwtest” 其他国内
*/
cloudId: string;
/** 到期类型 到期类型 1:不过期 2:到期时间 3:剩余时长(单位秒)*/
expiredType: number;
/** 到期时间 */
expired: number;
sessionLogId: number;
/** rpa连接ws地址 */
browserUrl: string;
/**
* 状态 1:运行 2:关闭 3:删除
*/
status: number;
checktime: string;
errorNum: number;
duration: number;
clientNum: number;
info: null;
/** 环境信息 */
browser: any;
/** 更新日期 */
updatedAt: string;
/** 创建日期 */
createdAt: string;
}
/** 环境列表数据 */
export interface SessionListData {
/** 环境列表信息 */
list: envData[];
/** 总数 */
total: number;
/** 每页显示条数 */
pageSize: number;
/** 当前页 */
currentPage: number;
}
export interface SessionListResponse {
reqId: string;
/**
* 状态码 200:成功
*/
code: number;
msg: "OK";
/** 环境信息 */
data: SessionListData;
}
// 请求接口 ********************************************
/** 账号信息 */
export interface IAccounts {
/** 账号 */
user: string;
/** 密码 */
pwd: string;
/** 站点 */
site: string;
}
/** 代理信息 */
export interface IProxy {
/** 协议类型 */
protocol: string;
/** 地址 */
host: string;
/** 端口 */
port: number;
/** 账号 */
userName: string;
/** 密码 */
password: string;
}
/** 环境信息 */
export interface IBrowser {
/**
* 操作系统
*
* @description 目前支持: Windows 7,Windows 8,Windows 8.1,Windows 10,Windows 11
*/
system: string;
/**
* ua 大版本号
* @description 范围 100-124
*/
uaVersion?: string;
/**
* 公网 ip
* @description 设置代理取代理里的 IP
*/
publicIp: string;
/**
* ip 检测渠道
* @description 可为空,枚举 ip2location,ipdata
*/
ipChannel?: string;
/**
* 内核类型 chrome,firefox
*/
kernel: string;
/**
* 内核版本 107,119,122
*/
kernelVersion: string;
/** 代理信息 */
proxy?: IProxy;
/** 账号信息 */
site_accounts?: IAccounts[];
}
/** 环境创建入参 */
export interface ICreateReqParams {
/** 实例名称 */
sessionName: string;
/** 产品 ID,决定主机所在的区域 */
productId: string;
/** 到期类型 1:不过期 2:到期时间 3:剩余时长(单位秒)*/
expiredType: number;
/**
* 到期时间
* @description 当 expiredType = 1 时 值为 Unix 时间戳,expiredType = 2 时为时长秒数
*/
expired: number;
/** 环境指纹信息 */
browser: IBrowser;
}
/** 环境更新信息入参 */
export interface IUpdateReqParams {
/**
* 更新标识 0:更新基础信息 2:更新指纹信息 4:更新代理信息 8:清除 cookie 16:清除缓存
*/
flag?: number;
sessionId: string;
sessionName: string;
browser: IBrowser;
}