调用AddMediaWorkflow新增媒体工作流。

使用说明

本接口可以定义媒体工作流的拓扑结构(DAG)、活动以及依赖关系。活动详情,请参见媒体工作流活动介绍。使用本接口创建的工作流可以在媒体处理控制台查看并调用。

QPS限制

本接口的单用户QPS限制为100次/秒。超过限制,API调用会被限流,这可能会影响您的业务,请合理调用。更多信息,请参见QPS限制

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String AddMediaWorkflow

操作接口名,系统规定参数,取值:AddMediaWorkflow

Name String mediaworkflow-example

媒体工作流名称。

  • 不能为空串。
  • 同一账号下的工作流名称不可重复。
  • 不超过64个字符。
  • UTF-8编码。
Topology String {"Activities":{"Act-Transcode-M3U8":{"Parameters":{"Outputs":[{"OutputObject":"transcode%2F%7BObjectPrefix%7D%7BFileName%7D","TemplateId":"957d1719ee85ed6527b90cf62726****"}],"OutputBucket":"example-vod-hls","OutputLocation":"oss-cn-hangzhou"},"Type":"Transcode"},"Act-Start":{"Name":"Act-Start","Parameters":{"PipelineId":"130266f58161436a80bf07cb12c8****","InputFile":{"Bucket":"example-vod","Location":"oss-cn-hangzhou"}},"Type":"Start"},"Act-Report":{"Name":"Act-Report","Parameters":{},"Type":"Report"}},"Dependencies":{"Act-Transcode-M3U8":["Act-Report"],"Act-Start":["Act-Transcode-M3U8"],"Act-Report":[]}}

媒体工作流拓扑结构。格式为JSON对象,包括活动列表及活动依赖。更多信息请参见下文Topology示例

TriggerMode String OssAutoTrigger

触发模式。 取值:

  • OssAutoTrigger:自动触发。
  • NotInAuto:不自动触发。
Topology示例

{
  "Activities": {
    "Act-Transcode-M3U8": {
      "Parameters": {
        "Outputs": [
          {
            "OutputObject": "transcode%2F%7BObjectPrefix%7D%7BFileName%7D",
            "TemplateId": "957d1719ee85ed6527b90cf62726****"
          }
        ],
        "OutputBucket": "example-vod-hls",
        "OutputLocation": "oss-cn-hangzhou"
      },
      "Type": "Transcode"
    },
    "Act-Start": {
      "Name": "Act-Start",
      "Parameters": {
        "PipelineId": "130266f58161436a80bf07cb12c8****",
        "InputFile": {
          "Bucket": "example-vod",
          "Location": "oss-cn-hangzhou"
        }
      },
      "Type": "Start"
    },
    "Act-Report": {
      "Name": "Act-Report",
      "Parameters": {
      },
      "Type": "Report"
    }
  },
  "Dependencies": {
    "Act-Transcode-M3U8": [
      "Act-Report"
    ],
    "Act-Start": [
      "Act-Transcode-M3U8"
    ],
    "Act-Report": [
    ]
  }
}

返回数据

名称 类型 示例值 描述
RequestId String F1D21261-ADB9-406A-1234-491382139D59

请求ID。

MediaWorkflow Object

媒体工作流详细信息。

CreationTime String 016-04-01T05:29:37Z

创建时间。

MediaWorkflowId String e00732b977da427d9177a4deb1aa****

媒体工作流ID。建议您保存此ID便于后续对此工作流进行其他操作。

State String Active

媒体工作流状态。新建的工作流默认为Active(激活)状态。

TriggerMode String OssAutoTrigger

触发模式。取值:

  • OssAutoTrigger:自动触发。
  • NotInAuto:不自动触发。
Name String mediaworkflow-example

媒体工作流名称。

Topology String {"Activities":{"Act-Transcode-M3U8":{"Parameters":{"Outputs":[{"OutputObject":"transcode%2F%7BObjectPrefix%7D%7BFileName%7D","TemplateId":"957d1719ee85ed6527b90cf62726****"}],"OutputBucket":"example-vod-hls","OutputLocation":"oss-cn-hangzhou"},"Type":"Transcode"},"Act-Start":{"Name":"Act-Start","Parameters":{"PipelineId":"130266f58161436a80bf07cb12c8****","InputFile":{"Bucket":"example-vod","Location":"oss-cn-hangzhou"}},"Type":"Start"},"Act-Report":{"Name":"Act-Report","Parameters":{},"Type":"Report"}},"Dependencies":{"Act-Transcode-M3U8":["Act-Report"],"Act-Start":["Act-Transcode-M3U8"],"Act-Report":[]}}

媒体工作流拓扑结构。格式为JSON对象,包括活动列表及活动依赖。

示例

请求示例

http(s)://mts.cn-hangzhou.aliyuncs.com/?Action=AddMediaWorkflow
&Name=mediaworkflow-example
&Topology={"Activities":{"Act-Transcode-M3U8":{"Parameters":{"Outputs":[{"OutputObject":"transcode%2F%7BObjectPrefix%7D%7BFileName%7D","TemplateId":"957d1719ee85ed6527b90cf62726****"}],"OutputBucket":"example-vod-hls","OutputLocation":"oss-cn-hangzhou"},"Type":"Transcode"},"Act-Start":{"Name":"Act-Start","Parameters":{"PipelineId":"130266f58161436a80bf07cb12c8****","InputFile":{"Bucket":"example-vod","Location":"oss-cn-hangzhou"}},"Type":"Start"},"Act-Report":{"Name":"Act-Report","Parameters":{},"Type":"Report"}},"Dependencies":{"Act-Transcode-M3U8":["Act-Report"],"Act-Start":["Act-Transcode-M3U8"],"Act-Report":[]}}
&TriggerMode=OssAutoTrigger
&<公共请求参数>

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<AddMediaWorkflowResponse>
    <RequestId>F1D21261-ADB9-406A-1234-491382139D59</RequestId>
    <MediaWorkflow>
        <CreationTime>016-04-01T05:29:37Z</CreationTime>
        <MediaWorkflowId>e00732b977da427d9177a4deb1aa****</MediaWorkflowId>
        <State>Active</State>
        <TriggerMode>OssAutoTrigger</TriggerMode>
        <Name>mediaworkflow-example</Name>
        <Topology>{"Activities":{"Act-Transcode-M3U8":{"Parameters":{"Outputs":[{"OutputObject":"transcode%2F%7BObjectPrefix%7D%7BFileName%7D","TemplateId":"957d1719ee85ed6527b90cf62726****"}],"OutputBucket":"example-vod-hls","OutputLocation":"oss-cn-hangzhou"},"Type":"Transcode"},"Act-Start":{"Name":"Act-Start","Parameters":{"PipelineId":"130266f58161436a80bf07cb12c8****","InputFile":{"Bucket":"example-vod","Location":"oss-cn-hangzhou"}},"Type":"Start"},"Act-Report":{"Name":"Act-Report","Parameters":{},"Type":"Report"}},"Dependencies":{"Act-Transcode-M3U8":["Act-Report"],"Act-Start":["Act-Transcode-M3U8"],"Act-Report":[]}}</Topology>
    </MediaWorkflow>
</AddMediaWorkflowResponse>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "F1D21261-ADB9-406A-1234-491382139D59",
  "MediaWorkflow" : {
    "CreationTime" : "016-04-01T05:29:37Z",
    "MediaWorkflowId" : "e00732b977da427d9177a4deb1aa****",
    "State" : "Active",
    "TriggerMode" : "OssAutoTrigger",
    "Name" : "mediaworkflow-example",
    "Topology" : "{\"Activities\":{\"Act-Transcode-M3U8\":{\"Parameters\":{\"Outputs\":[{\"OutputObject\":\"transcode%2F%7BObjectPrefix%7D%7BFileName%7D\",\"TemplateId\":\"957d1719ee85ed6527b90cf62726****\"}],\"OutputBucket\":\"example-vod-hls\",\"OutputLocation\":\"oss-cn-hangzhou\"},\"Type\":\"Transcode\"},\"Act-Start\":{\"Name\":\"Act-Start\",\"Parameters\":{\"PipelineId\":\"130266f58161436a80bf07cb12c8****\",\"InputFile\":{\"Bucket\":\"example-vod\",\"Location\":\"oss-cn-hangzhou\"}},\"Type\":\"Start\"},\"Act-Report\":{\"Name\":\"Act-Report\",\"Parameters\":{},\"Type\":\"Report\"}},\"Dependencies\":{\"Act-Transcode-M3U8\":[\"Act-Report\"],\"Act-Start\":[\"Act-Transcode-M3U8\"],\"Act-Report\":[]}}"
  }
}

错误码

访问错误中心查看更多错误码。