在一个或多个云手机实例中执行命令(异步任务)。命令执行的结果通过回调返回,详细信息,参考 回调服务接入指南。
使用 POST 方式发起请求。
下表仅列出了接口特有的请求参数和部分公共参数。完整的公共参数列表,参考 公共请求参数。
字段 | 位置 | 类型 | 必填 | 说明 | 值 |
|---|---|---|---|---|---|
| Action | Query | String | 是 | 公共参数,OpenAPI 接口名称 | RunCommand |
| Version | Query | String | 是 | 公共参数,OpenAPI 接口版本 | 2022-08-01 |
字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| product_id | string | 是 | 实例所归属的业务 ID |
pod_id_list | []string | 是 | 实例 ID 列表,对多个实例批量执行命令操作时,支持的最大实例数量为 100 |
| command | string | 是 | 待执行的命令,支持的最大长度为1024字节。 |
通用返回参数,请参考 ResponseMetadata 结构说明。
Result 字段包含以下参数:
字段 | 类型 | 说明 |
|---|---|---|
| task_id | string | 执行命令任务 ID,用于通过 任务信息查询 接口查看任务执行状态及结果 |
| task_action | string | 任务类型,默认为对应接口 Action 名称,此处为 RunCommand |
| jobs | list | 子任务列表,参考以下 Job 数据格式 |
Job 数据格式
| 字段 | 类型 | 说明 |
|---|---|---|
| pod_id | string | 实例 ID |
| job_id | string | 子任务 ID,每个子任务对应一个实例 |
POST https://open.volcengineapi.com?Action=RunCommand &Version=2022-08-01 &<通过header传入的公共请求参数> { "product_id":"1608456935646xxxxxx", "pod_id_list":["7299381659819xxxxxx", "7297074858797xxxxxx"], "command":"ls", "permission_type":"root" }
{ "ResponseMetadata": { "Action": "RunCommand", "Region": "cn-north-1", "RequestId": "20231114194157594E905FE7A2E5721258", "Service": "ACEP", "Version": "2022-08-01" }, "Result": { "task_id": "7301280763734xxxxxx", "task_action": "RunCommand", "jobs": [ { "job_id": "job-7301280763734xxxxxx-7299381659819xxxxxx", "pod_id": "7299381659819xxxxxx", "job_action": "RunCommand", "status": 10 }, { "job_id": "job-7301280763734xxxxxx-7297074858797xxxxxx", "pod_id": "7297074858797xxxxxx", "job_action": "RunCommand", "status": 10 } ] } }