You need to enable JavaScript to run this app.
云手机

云手机

复制全文
文件分发
分发文件至单实例 DistributeFile
复制全文
分发文件至单实例 DistributeFile

新建文件分发任务,将文件分发到指定业务下的云机实例,并可选择同时执行应用安装任务。

请求方式

使用 POST 方式发起请求。

请求参数

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

字段
位置
类型
必填
说明
ActionQueryString公共参数,OpenAPI 接口名称DistributeFile
VersionQueryString公共参数,OpenAPI 接口版本2020-10-25

Body 参数

字段
类型
必填
说明
product_idString业务 ID,可在「云手机控制台-业务管理-业务详情」中获取
instance_idString实例 ID,可通过调用 ListInstance 接口获取
file_md5String文件的 MD5 值

file_format

String

获取文件的方式:

  • volc_tos(火山引擎对象存储,默认)
  • url(URL 下载,目前仅支持火山引擎域名)

volc_tos_file

Object

保存文件的火山引擎对象存储信息,参考以下 TosInfo 结构说明
注:访问火山引擎对象存储中的文件,需要为接口开通访问权限。详细信息,参考 常见问题 中的说明

url_file

Object

获取文件的 URL,参考以下 UrlFile 结构说明
注:如需使用暂不支持的域名,请联系火山引擎云手机技术支持

file_dirString在云机中存储文件的路径(默认:/data/file_ds
after_distribution_actionObject文件分发完成后执行的操作,参考以下 AfterDistributionAction 结构说明

TosInfo 结构说明

字段
类型
必填
说明
tos_bucketString火山引擎对象存储中的存储桶名称,例如:test-bucket
tos_file_pathString存储桶下的目录和应用安装文件名称(不能以 / 开头),例如:cloudphone/gameApk/wedance.apk
endpointString火山引擎对象存储服务地址(地域节点),若为空,则使用默认值:tos-cn-beijing.volces.com
regionString火山引擎对象存储服务区域,若为空,则使用默认值:cn-beijing

UrlFile 结构说明

字段
类型
必填
说明
urlString保存文件的 URL

AfterDistributionAction 结构说明

字段
类型
必填
说明

action

Integer

操作类型,枚举值包括:

  • 1(apk 安装)
install_apk_paramObject应用安装参数,参考以下 InstallAPKParam 结构说明

InstallAPKParam 结构说明

字段
类型
必填
说明

option_list

Array of Integer

应用安装可选参数列表:

  • 1(ApkInstallAllowTest,允许测试)
  • 2(ApkInstallReplaceExisting,替换现存)
  • 3(ApkInstallGrantAllPerm,获取全部许可)
  • 4(ApkInstallABI,覆盖默认 ABI)
  • 5(ApkInstallInternalFlash,内部闪存)
  • 6(ApkInstallAllowDowngrade,允许降级)

返回结果

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

Result 字段包含以下参数:

字段
类型
说明
distribution_task_idString文件分发任务 ID,用于通过调用 GetFileDistributionResult 接口,获取任务执行结果

示例

请求示例

POST https://open.volcengineapi.com?Action=DistributeFile
&Version=2020-10-25
&<通过header传入的公共请求参数>

{
    "product_id": "14677396781xxxxxxxx",
    "instance_id": "i-1726334685xxxxxx",
    "file_md5": "65258bd04c93e89df3fcd0xxxxxxxxxx",
    "file_format": "volc_tos",
    "volc_tos_file": {
        "tos_bucket": "cloudphone",
        "tos_file_path": "chess.apk",
        "endpoint": "tos-cn-beijing.volces.com",
        "region": "cn-beijing"
    },
    "url_file": {
        "url": "https://xxx.xxx.com/gameAPK/chess.apk"
    },
    "file_dir": "/data/file_ds",
    "after_distribution_action": {
        "action": 1,
        "install_apk_param": {
            "option_list": [2,6]
        }
    }
}

返回示例

{
    "ResponseMetadata": {
        "Action": "DistributeFile",
        "Region": "cn-north-1",
        "RequestId": "202203091616060101980160152617650B",
        "Service": "iPaaS",
        "Version": "2020-10-25"
    },
    "Result": {
        "distribution_task_id": "fd-142xxxxxx"
    }
}
最近更新时间:2024.05.09 17:19:40
这个页面对您有帮助吗?
有用
有用
无用
无用