Method: edits.apks.addexternallyhosted
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
创建新的 APK,而无需将 APK 本身上传到 Google Play,而是将 APK 托管在指定网址。此功能仅适用于使用 Google Play 企业版,且应用已配置为仅限向相应组织分发应用的组织。
HTTP 请求
POST https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/edits/{editId}/apks/externallyHosted
网址采用 gRPC 转码语法。
路径参数
参数 |
packageName |
string
应用的软件包名称。
|
editId |
string
修改内容的标识符。
|
请求正文
请求正文中包含结构如下的数据:
字段 |
externallyHostedApk |
object (ExternallyHostedApk )
外部托管的 APK 的定义及其位置。
|
响应正文
针对创建新的外部托管的 APK 的响应。
如果成功,响应正文将包含结构如下的数据:
字段 |
externallyHostedApk |
object (ExternallyHostedApk )
外部托管的 APK 的定义及其位置。
|
授权范围
需要以下 OAuth 范围:
https://www.googleapis.com/auth/androidpublisher
ExternallyHostedApk
定义适用于此应用的 APK,该 APK 在外部托管且未上传到 Google Play。此功能仅适用于使用 Google Play 企业版,且应用已配置为仅限向相应组织分发应用的组织。
JSON 表示法 |
{
"packageName": string,
"applicationLabel": string,
"versionCode": integer,
"versionName": string,
"fileSize": string,
"fileSha1Base64": string,
"fileSha256Base64": string,
"iconBase64": string,
"minimumSdk": integer,
"certificateBase64s": [
string
],
"externallyHostedUrl": string,
"maximumSdk": integer,
"nativeCodes": [
string
],
"usesFeatures": [
string
],
"usesPermissions": [
{
object (UsesPermission )
}
]
} |
字段 |
packageName |
string
软件包名称。
|
applicationLabel |
string
应用标签。
|
versionCode |
integer
此 APK 的版本代码。
|
versionName |
string
此 APK 的版本名称。
|
fileSize |
string (int64 format)
此 APK 的文件大小(以字节为单位)。
|
fileSha1Base64 |
string
此 APK 的 sha1 校验和,表示为 base64 编码字节数组。
|
fileSha256Base64 |
string
此 APK 的 sha256 校验和,以 base64 编码字节数组表示。
|
iconBase64 |
string
APK 中的图标图片,采用 base64 编码字节数组的形式。
|
minimumSdk |
integer
此 APK 的最低目标 SDK。
|
certificateBase64s[] |
string
用于为此 APK 签名的证书(如果使用证书链,则为证书数组),以 base64 编码字节数组表示。
|
externallyHostedUrl |
string
托管 APK 的网址。此网址必须是 https 网址。
|
maximumSdk |
integer
此 APK 支持的最高 SDK(可选)。
|
nativeCodes[] |
string
此 APK 支持的原生代码环境(可选)。
|
usesFeatures[] |
string
此 APK 所需的功能(可选)。
|
usesPermissions[] |
object (UsesPermission )
此 APK 请求的权限。
|
UsesPermission
JSON 表示法 |
{
"name": string,
"maxSdkVersion": integer
} |
字段 |
name |
string
所请求的权限的名称。
|
maxSdkVersion |
integer
(可选)需要该权限的最高 SDK 版本。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eCreates a new APK hosted at a specified URL instead of uploading it to Google Play, restricted to Managed Play organizations.\u003c/p\u003e\n"],["\u003cp\u003eRequires an HTTP POST request to \u003ccode\u003ehttps://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/edits/{editId}/apks/externallyHosted\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe request body defines the externally-hosted APK with details like package name, version code, checksums, and hosting URL.\u003c/p\u003e\n"],["\u003cp\u003eThe response provides the details of the successfully created externally hosted APK.\u003c/p\u003e\n"],["\u003cp\u003eThis functionality requires the \u003ccode\u003ehttps://www.googleapis.com/auth/androidpublisher\u003c/code\u003e authorization scope.\u003c/p\u003e\n"]]],["This document details the process of creating an externally hosted APK for Managed Play applications. The core action is sending a `POST` request to a specific endpoint with the `packageName` and `editId`. The request body includes an `externallyHostedApk` object, defining the APK's metadata like its URL, version, checksums, supported SDKs, and required permissions. The server returns the same object in the response upon successful creation. This process is authorized with the `androidpublisher` scope.\n"],null,["# Method: edits.apks.addexternallyhosted\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.ApksAddExternallyHostedResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [ExternallyHostedApk](#ExternallyHostedApk)\n - [JSON representation](#ExternallyHostedApk.SCHEMA_REPRESENTATION)\n- [UsesPermission](#UsesPermission)\n - [JSON representation](#UsesPermission.SCHEMA_REPRESENTATION)\n- [Try it!](#try-it)\n\nCreates a new APK without uploading the APK itself to Google Play, instead hosting the APK at a specified URL. This function is only available to organizations using Managed Play whose application is configured to restrict distribution to the organizations.\n\n### HTTP request\n\n`POST https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/edits/{editId}/apks/externallyHosted`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|---------------|-----------------------------------|\n| `packageName` | `string` Package name of the app. |\n| `editId` | `string` Identifier of the edit. |\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"externallyHostedApk\": { object (/android-publisher/api-ref/rest/v3/edits.apks/addexternallyhosted#ExternallyHostedApk) } } ``` |\n\n| Fields ||\n|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `externallyHostedApk` | `object (`[ExternallyHostedApk](/android-publisher/api-ref/rest/v3/edits.apks/addexternallyhosted#ExternallyHostedApk)`)` The definition of the externally-hosted APK and where it is located. |\n\n### Response body\n\nResponse for creating a new externally hosted APK.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"externallyHostedApk\": { object (/android-publisher/api-ref/rest/v3/edits.apks/addexternallyhosted#ExternallyHostedApk) } } ``` |\n\n| Fields ||\n|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `externallyHostedApk` | `object (`[ExternallyHostedApk](/android-publisher/api-ref/rest/v3/edits.apks/addexternallyhosted#ExternallyHostedApk)`)` The definition of the externally-hosted APK and where it is located. |\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/androidpublisher`\n\nExternallyHostedApk\n-------------------\n\nDefines an APK available for this application that is hosted externally and not uploaded to Google Play. This function is only available to organizations using Managed Play whose application is configured to restrict distribution to the organizations.\n\n| JSON representation |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"packageName\": string, \"applicationLabel\": string, \"versionCode\": integer, \"versionName\": string, \"fileSize\": string, \"fileSha1Base64\": string, \"fileSha256Base64\": string, \"iconBase64\": string, \"minimumSdk\": integer, \"certificateBase64s\": [ string ], \"externallyHostedUrl\": string, \"maximumSdk\": integer, \"nativeCodes\": [ string ], \"usesFeatures\": [ string ], \"usesPermissions\": [ { object (/android-publisher/api-ref/rest/v3/edits.apks/addexternallyhosted#UsesPermission) } ] } ``` |\n\n| Fields ||\n|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `packageName` | `string` The package name. |\n| `applicationLabel` | `string` The application label. |\n| `versionCode` | `integer` The version code of this APK. |\n| `versionName` | `string` The version name of this APK. |\n| `fileSize` | `string (`[int64](https://developers.google.com/discovery/v1/type-format)` format)` The file size in bytes of this APK. |\n| `fileSha1Base64` | `string` The sha1 checksum of this APK, represented as a base64 encoded byte array. |\n| `fileSha256Base64` | `string` The sha256 checksum of this APK, represented as a base64 encoded byte array. |\n| `iconBase64` | `string` The icon image from the APK, as a base64 encoded byte array. |\n| `minimumSdk` | `integer` The minimum SDK targeted by this APK. |\n| `certificateBase64s[]` | `string` A certificate (or array of certificates if a certificate-chain is used) used to sign this APK, represented as a base64 encoded byte array. |\n| `externallyHostedUrl` | `string` The URL at which the APK is hosted. This must be an https URL. |\n| `maximumSdk` | `integer` The maximum SDK supported by this APK (optional). |\n| `nativeCodes[]` | `string` The native code environments supported by this APK (optional). |\n| `usesFeatures[]` | `string` The features required by this APK (optional). |\n| `usesPermissions[]` | `object (`[UsesPermission](/android-publisher/api-ref/rest/v3/edits.apks/addexternallyhosted#UsesPermission)`)` The permissions requested by this APK. |\n\nUsesPermission\n--------------\n\nA permission used by this APK.\n\n| JSON representation |\n|------------------------------------------------------|\n| ``` { \"name\": string, \"maxSdkVersion\": integer } ``` |\n\n| Fields ||\n|-----------------|-------------------------------------------------------------------------------------|\n| `name` | `string` The name of the permission requested. |\n| `maxSdkVersion` | `integer` Optionally, the maximum SDK version for which the permission is required. |"]]