合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
承载协议 | HTTPS PUT |
|---|---|
接口方向 | 开发者服务器 ->华为服务器 |
接口URL | https://connect-api.cloud.huawei.com/api/games-background-assets-service/v1/open-gw/dev/{devId}/package-versions |
数据格式 | 请求消息:Content-Type: application/json 响应消息:Content-Type: application/json |
参数名称 | 必选(M)/可选(O) | 类型 | 参数说明 |
|---|---|---|---|
devId | M | Long | 开发者ID。 |
参数名称 | 必选(M)/可选(O) | 类型 | 参数说明 |
|---|---|---|---|
modifyPackageVersionReq | M | 修改资源包版本请求体。 |
参数名称 | 必选(M)/可选(O) | 类型 | 参数说明 |
|---|---|---|---|
isDraft | M | Int(32) | 是否草稿:
|
resourceVersion | O | 修改的资源包版本信息。 |
参数名称 | 必选(M)/可选(O) | 类型 | 参数说明 |
|---|---|---|---|
versionId | M | Long | 资源包版本ID。 |
packageName | O | String | 游戏包名。最大长度255个字符。 |
appId | M | String | 游戏APP ID,获取方法参考查询应用信息。 |
version | O | Int | 版本号。 |
startTime | O | Long | 开始下载时间。 |
endTime | O | Long | 结束下载时间。 |
- PUT games-background-assets-service/v1/open/dev/1******7/package-versions HTTP/1.1
- Host: connect-api.cloud.huawei.com
- client_id: 41******68
- Content-Type: application/json
- Authorization: Bearer ******
- {
- "isDraft": 0,
- "resourceVersion": {
- "versionId": 0,
- "packageName": "com.abc.test",
- "appId": "12345678",
- "version": 999999999,
- "startTime": 1752595200000,
- "endTime": 1752699999999,
- }
- }
参数名称 | 必选(M)/可选(O) | 类型 | 参数说明 |
|---|---|---|---|
ret | M | 包含返回码及描述信息的JSON字符串,格式为{"code":retcode, "msg": "description"},retcode为返回码,description为返回码描述信息。 |
参数名称 | 必选(M)/可选(O) | 类型 | 参数说明 |
|---|---|---|---|
code | O | Int | 返回码,请参见错误码。 |
msg | O | String | 返回码描述信息。 |
- {
- "ret": {
- "code": 0,
- "msg": "string"
- }
- }
- public static JSONObject modifyPkgVersion(String domain, String clientId, String token) {
- HttpPut put = new HttpPut(domain + "/api/games-background-assets-service/v1/open-gw/dev/11/package-versions");
- put.setHeader("Authorization", "Bearer " + token);
- put.setHeader("client_id", clientId);
- put.setHeader("requestId", "1");
- JSONObject resourceVersion = new JSONObject();
- resourceVersion.put("packageName", "com.abc.test");
- resourceVersion.put("appId", "12345678");
- resourceVersion.put("version", 999999999);
- resourceVersion.put("startTime", 1752595200000L);
- resourceVersion.put("endTime", 1752699999999L);
- JSONObject modifyRequest = new JSONObject();
- modifyRequest.put("isDraft", 1);
- modifyRequest.put("resourceVersion", resourceVersion);
- StringEntity entity = new StringEntity(modifyRequest.toString(), Charset.forName("UTF-8"));
- entity.setContentEncoding("UTF-8");
- entity.setContentType("application/json");
- put.setEntity(entity);
- try {
- CloseableHttpClient httpClient = HttpClients.createDefault();
- CloseableHttpResponse httpResponse = httpClient.execute(put);
- int statusCode = httpResponse.getStatusLine().getStatusCode();
- if (statusCode == HttpStatus.SC_OK) {
- BufferedReader br = new BufferedReader(
- new InputStreamReader(httpResponse.getEntity().getContent(), Consts.UTF_8));
- String result = br.readLine();
- JSONObject object = JSON.parseObject(result);
- return object;
- }
- } catch (Exception e) {
- System.out.println(e);
- } finally {
- put.releaseConnection();
- }
- return null;
- }
合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
解决方案
精准高效的一站式服务支持,助力开发者商业成功