接口调用说明
推荐使用 Lua 语言 通过 HTTP 方式调用。同时也支持 OpenUrl 方式,将指令中的 http://127.0.0.1:361/ 替换为 361:// 即可。
异步状态文件
/var/mobile/script_status状态定义
1 成功
0 失败
-1 无权限
注意:部分接口为异步操作,需检测上述文件是否存在。文件不存在说明尚未结束,存在则读取文件值判断结果(1为成功)。
GET
1. 一键新机 (newDevice)
参数:bid 表示目标 App,多个用逗号分隔。
说明:异步操作,需检测 /var/mobile/script_status。
说明:异步操作,需检测 /var/mobile/script_status。
http://127.0.0.1:361/cmd?fun=newDevice&bid=com.xxx.a,cn.yyy.bGET
2. 生成备份记录 (newBackup)
参数:bid 表示目标 App。
说明:异步操作,用于给当前环境创建一个备份。
说明:异步操作,用于给当前环境创建一个备份。
http://127.0.0.1:361/cmd?fun=newBackup&bid=com.xxx.aGET
3. 获取备份记录 (getBackups)
返回 JSON 包含备份列表、时间及当前关联的备份 ID。
http://127.0.0.1:361/cmd?fun=getBackups&bid=com.xxx.aGET
4. 重命名备份记录
参数:index/indexup/backname 任选其一。index 为行号,indexup 为相对于当前的偏移(1上0下)。
http://127.0.0.1:361/cmd?fun=renameBackup&bid=com.xxx&index=0&name=NewNameGET
5. 删除备份记录
index=-1 时表示删除对应 App 的所有备份记录。
http://127.0.0.1:361/cmd?fun=deleteBackup&bid=com.xxx&index=0GET
6. 还原备份记录 (restoreBackup)
说明:异步操作。将设备环境还原至指定的备份状态。
http://127.0.0.1:361/cmd?fun=restoreBackup&bid=com.xxx&index=0GET
7. 获取虚拟设备信息
返回 IDFA、IDFV、iOS 版本、SSID、IMEI、UDID 等详细虚拟参数。
http://127.0.0.1:361/cmd?fun=getCurrentVDInfo&bid=com.xxxGET
8. 设置 IDFA
手动修改指定 App 环境的 IDFA 值。
http://127.0.0.1:361/cmd?fun=setCurrentVDInfo&bid=com.xxx&idfa=89B0...EB2GET
9. 获取机器码与权限
返回设备 deviceId 以及授权截止时间 endDate。
http://127.0.0.1:361/cmd?fun=licenseGET
10. 自动开关设置
fun 可选:autoBackup(自动备份), autoAppLaunch(自动启动), autoIP(自动换IP)。
http://127.0.0.1:361/cmd?fun=autoBackup&open=1GET
11. 卸载 App
通过 BundleID 卸载指定应用。
http://127.0.0.1:361/cmd?fun=uninstallApp&bid=com.xxxGET
12. 跳转至 App
快速启动并跳转至指定应用。
http://127.0.0.1:361/cmd?fun=goToApp&bid=com.xxxLua 示例代码
function newDevice()
local sz = require("sz");
local http = require("szocket.http");
local res, code = http.request("http://127.0.0.1:361/cmd?fun=newDevice&bid=com.apple.weather");
if code == 200 then
local resJson = sz.json.decode(res);
if resJson.status == 1 then
dialog("接口调用成功,正在执行新机...", 2);
-- 建议在此循环检测 /var/mobile/script_status
elseif resJson.status == 0 then
dialog("失败: " .. resJson.errMsg, 2);
end
end
end
-- 启动应用
runApp("cn.tinyapps.RST");
mSleep(5000); -- 等待5秒启动
newDevice();