跳转到内容
EN

导入项目素材

POST /cut/v1/projects/{project_id}/media:import

Import a URL, data URI or existing file into a writable project media library. Select binding from bindings.list or omit it to use default_upload. Save library_id and asset_id from the result and use them as libraryId and assetId inside execute script media references; overwrites follow the source asset latest version.

支持状态: supported

参数

名称位置类型必填说明
project_idpathstringtrueProject identifier returned by its create or list operation; use the id, not a display name.

请求体 (application/json)

必填: true

名称类型说明
bindingstringWritable binding name from project bindings; omission uses default_upload.
sourceobjectExactly one input source for the imported asset.
source.urlstringPublicly readable source URL to import.
source.data_uristringInline data URI containing the source bytes.
source.file_idstringExisting platform file id whose bytes should be imported.
display_namestringOptional human-readable display name for the new media asset.
{
"type": "object",
"description": "Import one external asset into a writable project library.",
"properties": {
"binding": {
"type": "string",
"description": "Writable binding name from project bindings; omission uses default_upload."
},
"source": {
"type": "object",
"description": "Exactly one input source for the imported asset.",
"properties": {
"url": {
"type": "string",
"description": "Publicly readable source URL to import.",
"format": "uri",
"example": "https://media.example/clip.mp4"
},
"data_uri": {
"type": "string",
"description": "Inline data URI containing the source bytes."
},
"file_id": {
"type": "string",
"description": "Existing platform file id whose bytes should be imported."
}
},
"oneOf": [
{
"required": [
"url"
],
"not": {
"anyOf": [
{
"required": [
"data_uri"
]
},
{
"required": [
"file_id"
]
}
]
}
},
{
"required": [
"data_uri"
],
"not": {
"anyOf": [
{
"required": [
"url"
]
},
{
"required": [
"file_id"
]
}
]
}
},
{
"required": [
"file_id"
],
"not": {
"anyOf": [
{
"required": [
"url"
]
},
{
"required": [
"data_uri"
]
}
]
}
}
]
},
"display_name": {
"type": "string",
"description": "Optional human-readable display name for the new media asset."
}
},
"required": [
"source"
]
}

响应

HTTP 200

Requested resource or operation result; use its revision when preparing a guarded edit.

application/json

名称 类型 说明
library_id string Identifier of a library present in the project bindings.
asset_id string Asset identifier returned by media import or praxis.media asset operations.
info object Source media facts returned after import.
info.library_id string Destination library containing the imported asset.
info.asset_id string New asset identifier to use in execute script MediaRef objects.
info.version integer Current source asset version after import.
info.kind string video is moving footage; audio is sound-only; image is a still visual.
info.duration_sec number Source media duration, when time-based. In seconds, not frames or microseconds.
info.width integer Source visual width in pixels, if available.
info.height integer Source visual height in pixels, if available.
info.fps number Source frames per second, if the source is video.
info.has_audio boolean True when the source includes an audio stream.