创建资产
功能介绍
该接口用于在资产库中添加上传新的媒体资产。可上传的资产类型包括:分身数字人模型、背景图片、素材图片、素材视频、PPT等。
资产类型是IMAGE时,通过system_properties来区分背景图片(BACKGROUND_IMG)、素材图片(MATERIAL_IMG)。
资产类型是VIDEO时,通过system_properties来区分素材视频(MATERIAL_VIDEO)、名片视频(BUSSINESS_CARD_VIDEO)。
MetaStudio平台生成的视频,system_properties带CREATED_BY_PLATFORM。
调用方法
请参见如何调用API。
URI
POST /v1/{project_id}/digital-assets
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
项目ID,获取方法请参考获取项目ID。 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
否 |
String |
用户Token。使用Token鉴权方式时必选。 通过调用IAM服务获取用户Token接口获取。 响应消息头中X-Subject-Token的值。 |
Authorization |
否 |
String |
使用AK/SK方式认证时必选,携带的鉴权信息。 |
X-Sdk-Date |
否 |
String |
使用AK/SK方式认证时必选,请求的发生时间。 格式为(YYYYMMDD'T'HHMMSS'Z')。 |
X-App-UserId |
否 |
String |
第三方用户ID。不允许输入中文。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
asset_name |
是 |
String |
资产名称。 |
asset_description |
否 |
String |
资产描述。 |
asset_type |
是 |
String |
资产类型。 公共资产类型:
分身数字人资产:
3D数字人资产:
|
asset_owner |
否 |
String |
项目ID。 说明:
|
review_config |
否 |
ReviewConfig object |
内容审核配置。 |
tags |
否 |
Array of strings |
标签列表。 |
asset_extra_meta |
否 |
AssetExtraMeta object |
资产元数据。根据资产类型选择其中一个填写。 |
system_properties |
否 |
Array of SystemProperty objects |
设置系统属性。 |
shared_config |
否 |
SharedConfig object |
共享配置 |
is_need_generate_cover |
否 |
Boolean |
是否需要生成封面。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
human_model_meta |
否 |
HumanModelAssetMeta object |
数字人模型元数据。 |
voice_model_meta |
否 |
VoiceModelAssetMeta object |
音色模型元数据。 |
ppt_meta |
否 |
PPTAssetMeta object |
PPT资产元数据信息。 |
animation_meta |
否 |
AnimationAssetMeta object |
动作动画资产元数据。 |
scene_meta |
否 |
SceneAssetMeta object |
场景元数据。 |
material_meta |
否 |
MaterialAssetMeta object |
素材元数据。 |
human_model_2d_meta |
否 |
HumanModel2DAssetMeta object |
分身模型元数据 |
image_meta |
否 |
ImageAssetMeta object |
图片元数据 |
video_meta |
否 |
VideoAssetMeta object |
视频元数据,自动提取获得。 |
audio_meta |
否 |
AudioAssetMeta object |
音频元数据,自动提取获得。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
style_id |
否 |
String |
数字人模型风格ID。
|
modeling_type |
否 |
String |
数字人模型建模类型。
|
modeling_job_id |
否 |
String |
建模任务ID。 |
model_properties |
否 |
HumanModelMetaProperties object |
记录模型配置信息 |
components |
否 |
Array of ComponentInfo objects |
可替换组件列表。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
whole_model_base_file_id |
否 |
String |
当前模型中的WHOLE_MODEL是基于哪个file_id生成的,如果当前记录的信息与MAIN文件的file_id一致,那就认为已经生成过,无需再进行全模型导出 |
load_model_file_id |
否 |
String |
当前用于加载的file_id信息,若为空或未匹配到,则使用MAIN文件 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
component_name |
是 |
String |
组件名称。 |
component_type |
是 |
String |
组件类型。 |
component_desc |
否 |
String |
组件描述。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
order |
否 |
Integer |
展示顺序 |
model_type |
否 |
String |
音色资产类型。
|
sex |
否 |
String |
音色性别。
默认UNKNOW。 |
language |
否 |
String |
音色语言。
默认UNKNOW。 |
speed_ratio |
否 |
Float |
语速缩放比例 |
volume_ratio |
否 |
Float |
音量缩放比例 |
external_voice_meta |
否 |
ExternalVoiceAssetMeta object |
第三方TTS音色元数据。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
provider |
是 |
String |
第三方TTS供应商类型。
|
mobvoi_voice_meta |
否 |
MobvoiVoiceAssetMeta object |
出门问问TTS音色元数据。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
auto_analysis |
否 |
Boolean |
PPT是否需要自动解析。 |
ppt_analysis_status |
否 |
String |
PPT解析状态。
|
error_info |
否 |
ErrorResponse object |
错误信息 |
page_count |
否 |
Integer |
PPT页面总数。 |
pages |
否 |
Array of PPTPageInfo objects |
PPT页面图片。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
page_no |
否 |
Integer |
页面编号。 |
file_id |
否 |
String |
页面对应图片文件ID。 |
page_content |
否 |
String |
讲解词(从备注中提取)。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
style_id |
否 |
String |
数字人模型风格ID。 |
duration |
否 |
Float |
动作动画时长。 |
auto_analysis |
否 |
Boolean |
动作是否需要自动解析。 |
voice_delay |
否 |
Float |
语音延迟播放时长。 单位秒。 使用场景举例:入场动画3秒,voice_delay设置成4秒,则语音从入场动画开始后第4秒开始播放。 |
animation_insert_restriction |
否 |
String |
动画插入位置限制。
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
components |
否 |
Array of SceneComponentInfo objects |
可操作组件列表(如屏幕,灯光,摄像机)。 |
default_configs |
否 |
Map<String,SceneComponentInfo> |
默认场景设置(机位,初始人位置)。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
index |
否 |
Integer |
组件索引。 |
component_name |
是 |
String |
组件名称。 |
component_type |
是 |
String |
组件类型。
|
component_desc |
否 |
String |
组件描述。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
components |
否 |
Array of MaterialComponentInfo objects |
可替换的素材组件列表。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
component_name |
是 |
String |
素材组件名称。 |
component_type |
是 |
String |
素材组件类型。
|
component_desc |
否 |
String |
素材组件描述。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
is_action_editable |
否 |
Boolean |
分身数字人的动作是否可编辑。默认不可编辑。 |
is_real_background |
否 |
Boolean |
是否是实景分身数字人。实景分身数字人不做背景替换。 |
support_live |
否 |
Boolean |
是否支持直播 |
model_version |
否 |
String |
分身数字人模型版本。默认是V2版本模型。
|
model_resolution |
否 |
String |
分身数字人模型分辨率。默认是1080P。
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
codec |
否 |
String |
图片编码格式,自动提取。 |
width |
否 |
Integer |
图片宽度,自动提取 |
height |
否 |
Integer |
图片高度,自动提取 |
size |
否 |
Number |
大小 |
mode |
否 |
String |
Horizontal=横向;Vertical=纵向 |
error_info |
否 |
ErrorResponse object |
错误信息 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
video_codec |
否 |
String |
视频编码格式 |
width |
否 |
Integer |
视频宽度 |
height |
否 |
Integer |
视频高度 |
frame_rate |
否 |
String |
帧率 |
video_bit_rate |
否 |
Integer |
视频平均码率,单位kbps |
duration |
否 |
Integer |
时长,单位秒 |
audio_codec |
否 |
String |
音频编码格式 |
audio_bit_rate |
否 |
Integer |
音频平均码率,单位kbps |
audio_channels |
否 |
Integer |
音频声道数 |
sample |
否 |
Integer |
采样率,HZ |
mode |
否 |
String |
Horizontal=横向;Vertical=纵向 |
error_info |
否 |
ErrorResponse object |
错误信息 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
duration |
否 |
Integer |
时长,单位秒 |
audio_codec |
否 |
String |
音频编码格式 |
audio_bit_rate |
否 |
Integer |
音频平均码率,单位kbps |
audio_channels |
否 |
Integer |
音频声道数 |
sample |
否 |
Integer |
采样率,HZ |
error_info |
否 |
ErrorResponse object |
错误信息 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
action |
否 |
String |
操作。
|
key |
否 |
String |
系统属性。 公共资产属性:
分身数字人资产属性:
3D数字人资产属性:
|
value |
否 |
String |
属性值。 |
响应参数
状态码: 200
参数 |
参数类型 |
描述 |
---|---|---|
X-Request-Id |
String |
请求ID。 |
参数 |
参数类型 |
描述 |
---|---|---|
asset_id |
String |
数字资产ID。 |
状态码: 400
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码。 |
error_msg |
String |
错误描述。 |
请求示例
POST https://{endpoint}/v1/6a6a1f8354f64dd9b9a614def7b59d83/digital-assets { "asset_name" : "云笙模型", "asset_description" : "数字人员工", "asset_type" : "HUMAN_MODEL", "tags" : [ "数字人员工" ] }
响应示例
状态码: 200
成功。
{ "asset_id" : "93769b5a-c8c6-4692-9c95-53933a1f0c93" }
状态码: 400
{ "error_code" : "MSS.00000003", "error_msg" : "Invalid parameter" }
SDK代码示例
SDK代码示例如下。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.metastudio.v1.region.MetaStudioRegion; import com.huaweicloud.sdk.metastudio.v1.*; import com.huaweicloud.sdk.metastudio.v1.model.*; import java.util.List; import java.util.ArrayList; public class CreateDigitalAssetSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); MetaStudioClient client = MetaStudioClient.newBuilder() .withCredential(auth) .withRegion(MetaStudioRegion.valueOf("<YOUR REGION>")) .build(); CreateDigitalAssetRequest request = new CreateDigitalAssetRequest(); CreateDigitalAssetRequestBody body = new CreateDigitalAssetRequestBody(); List<String> listbodyTags = new ArrayList<>(); listbodyTags.add("数字人员工"); body.withTags(listbodyTags); body.withAssetType(CreateDigitalAssetRequestBody.AssetTypeEnum.fromValue("HUMAN_MODEL")); body.withAssetDescription("数字人员工"); body.withAssetName("云笙模型"); request.withBody(body); try { CreateDigitalAssetResponse response = client.createDigitalAsset(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkmetastudio.v1.region.metastudio_region import MetaStudioRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkmetastudio.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = __import__('os').getenv("CLOUD_SDK_AK") sk = __import__('os').getenv("CLOUD_SDK_SK") projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) \ client = MetaStudioClient.new_builder() \ .with_credentials(credentials) \ .with_region(MetaStudioRegion.value_of("<YOUR REGION>")) \ .build() try: request = CreateDigitalAssetRequest() listTagsbody = [ "数字人员工" ] request.body = CreateDigitalAssetRequestBody( tags=listTagsbody, asset_type="HUMAN_MODEL", asset_description="数字人员工", asset_name="云笙模型" ) response = client.create_digital_asset(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" metastudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := metastudio.NewMetaStudioClient( metastudio.MetaStudioClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.CreateDigitalAssetRequest{} var listTagsbody = []string{ "数字人员工", } assetDescriptionCreateDigitalAssetRequestBody:= "数字人员工" request.Body = &model.CreateDigitalAssetRequestBody{ Tags: &listTagsbody, AssetType: model.GetCreateDigitalAssetRequestBodyAssetTypeEnum().HUMAN_MODEL, AssetDescription: &assetDescriptionCreateDigitalAssetRequestBody, AssetName: "云笙模型", } response, err := client.CreateDigitalAsset(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
状态码 |
描述 |
---|---|
200 |
成功。 |
400 |
请求传参异常,包含错误码及对应描述。 |
错误码
请参见错误码。