You need to enable JavaScript to run this app.
导航
【旧版】同步执行命令 RunSyncCommand
最近更新时间:2024.06.17 19:36:22首次发布时间:2023.09.04 14:55:45
复制全文
我的收藏
有用
有用
无用
无用

在一个或多个云手机实例中同步执行命令。

请求方式

使用 POST 方式发起请求。

请求参数

下表仅列出了接口特有的请求参数和部分公共参数。完整的公共参数列表,参考 公共请求参数

字段
位置
类型
必填
说明
ActionQueryString公共参数,OpenAPI 接口名称RunSyncCommand
VersionQueryString公共参数,OpenAPI 接口版本2022-08-01

Body 参数

字段
类型
必填
说明
product_idstring实例所归属的业务 ID
pod_id_list[]string实例 ID 列表,对多个实例批量执行命令操作时,支持的最大实例数量为 100
commandstring待执行的命令;支持的最大长度为1024字节

返回结果

通用返回参数,请参考 ResponseMetadata 结构说明

Result 字段包含以下参数:

字段
类型
说明
product_idstring实例所归属的业务 ID
commandstring对指定的实例执行的命令
statuslist命令执行状态,参考以下 Status 数据格式说明

Status 数据格式

字段类型说明
pod_idstring实例 ID
successbool命令是否执行成功
detailstring命令执行结果详情

示例

请求示例

POST https://open.volcengineapi.com?Action=RunSyncCommand
&Version=2022-08-01
&<通过header传入的公共请求参数>

{
    "product_id":"1608456935646xxxxxx",
    "pod_id_list":["7299381659819xxxxxx", "7297074858797xxxxxx"],
    "command":"ls"
}

返回示例

{
    "ResponseMetadata": {
        "Action": "RunSyncCommand",
        "Region": "cn-north-1",
        "RequestId": "202311141957287BA1B88E6834E96FD0A7",
        "Service": "ACEP",
        "Version": "2022-08-01"
    },
    "Result": {
        "product_id": "1608456935646xxxxxx",
        "command": "ls",
        "status": [
            {
                "pod_id": "7299381659819xxxxxx",
                "success": true,
                "detail": "acct\napex\nbin\nvendor\n"
            },
            {
                "pod_id": "7297074858797xxxxxx",
                "success": true,
                "detail": "acct\napex\nbin\nvendor\n"
            }
        ]
    }
}