Creates a media workflow.

Usage notes

You can call this operation to define the topology, activities, and dependencies of a media workflow. The topology is represented by a directed acyclic graph (DAG) in the console. For more information, see Media workflow activities. You can view and run the workflows that are created by calling this operation in the ApsaraVideo Media Processing (MPS) console.

Limits on QPS

You can call this operation up to 100 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation. For more information, see QPS limit.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes AddMediaWorkflow

The operation that you want to perform. Set the value to AddMediaWorkflow.

Name String Yes mediaworkflow-example

The name of the media workflow.

  • The value cannot be empty.
  • The name cannot be the same as that of an existing media workflow within the current Alibaba Cloud account.
  • The name can be up to 64 characters in length.
  • The name can contain only UTF-8 characters.
Topology String Yes null

The topology of the media workflow. The value must be a JSON object that contains the activity list and activity dependencies. For more information, see the Sample topology section of this topic.

TriggerMode String No OssAutoTrigger

The trigger mode of the media workflow. Valid values:

  • OssAutoTrigger: The media workflow is automatically triggered.
  • NotInAuto: The media workflow is not automatically triggered.
Sample 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": [
    ]
  }
}

Response parameters

Parameter Type Example Description
RequestId String F1D21261-ADB9-406A-1234-491382139D59

The ID of the request.

MediaWorkflow Object

The information about the media workflow.

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

The time when the media workflow was created.

MediaWorkflowId String e00732b977da427d9177a4deb1aa****

The ID of the media workflow. We recommend that you keep this ID for later operations on this workflow.

State String Active

The status of the media workflow. By default, the created workflow is in the Active state.

TriggerMode String OssAutoTrigger

The trigger mode of the media workflow. Valid values:

  • OssAutoTrigger: The media workflow is automatically triggered.
  • NotInAuto: The media workflow is not automatically triggered.
Name String mediaworkflow-example

The name of the media workflow.

Topology String null

The topology of the media workflow. The value is a JSON object that contains the activity list and activity dependencies.

Examples

Sample requests

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
&<Common request parameters>

Sample success responses

XML format

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 format

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\":[]}}"
  }
}

Error codes

For a list of error codes, visit the API Error Center.