All Products
Search
Document Center

ApsaraVideo Media Processing:AddMediaWorkflow

Last Updated:Mar 25, 2024

Creates a media workflow.

Operation description

  • 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 Workflow activities. You can view and run the workflows that are created by calling this operation in the ApsaraVideo Media Processing (MPS) console.
  • MPS media workflows can be automatically triggered only by using the prefix of the file path. Automatic triggering by using the suffix is not supported. For more information about the trigger rules, see Workflow triggering rules for files.

QPS limits

You can call this API operation up to 100 times per second per account. Requests that exceed this limit are dropped, and you will experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see QPS limits.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
NamestringYes

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 value must be encoded in the UTF-8 format.
mediaworkflow-example
TopologystringYes

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

Note The Object Storage Service (OSS) bucket must reside in the same region as your MPS service.
TriggerModestringNo

The triggering mode of the media workflow. Valid values:

  • OssAutoTrigger: The media workflow is automatically triggered.
  • NotInAuto: The media workflow is not automatically triggered.
OssAutoTrigger

Sample topology

Note The OSS bucket must reside in the same region as your MPS service.
{
  "Activities": {
    "mediaworkflow-example": {
      "Parameters": {
        "Outputs": "[{\"OutputObject\":\"examplebucket/output/{RunId}/TRANSCODE_165941222****/{FileName}\",\"TemplateId\":\"S00000001-200010\",\"TemplateName\":\"MP4-Low definition\"}]",
        "OutputBucket": "examplebucket",
        "OutputLocation": "oss-cn-shanghai"
      },
      "Type": "Transcode"
    },
    "Act-Start": {
      "Parameters": {
        "PipelineId": "a7d481f07d8c45da88c71853ce7d****",
        "InputFile": "{\"Bucket\":\"example-input\",\"Location\":\"oss-cn-shanghai\",\"ObjectPrefix\":\"mps-test/input/\"}"
      },
      "Type": "Start"
    },
    "Act-Report": {
      "Parameters": {
        "PublishType": "Manual"
      },
      "Type": "Report"
    }
  },
  "Dependencies": {
    "mediaworkflow-example": ["Act-Report"],
    "Act-Start": ["mediaworkflow-example"],
    "Act-Report": []
  }
}

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

F1D21261-ADB9-406A-1234-491382139D59
MediaWorkflowobject

The information about the media workflow.

CreationTimestring

The time when the media workflow was created.

016-04-01T05:29:37Z
MediaWorkflowIdstring

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

e00732b977da427d9177a4deb1aa****
Statestring

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

Active
TriggerModestring

The triggering mode of the media workflow. Valid values:

  • OssAutoTrigger: The media workflow is automatically triggered.
  • NotInAuto: The media workflow is not automatically triggered.
OssAutoTrigger
Namestring

The name of the media workflow.

mediaworkflow-example
Topologystring

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

{mediaworkflow","State":"Active","Topology":"{\"Activities\":{\"Act-Start\":{\"Parameters\":{\"PipelineId\":\"130266f58161436a80bf07cb12c8****\",\"InputFile\":\"{\\\"Bucket\\\": \\\"example-bucket-****\\\",\\\"Location\\\": \\\"cn-shanghai\\\"}\"},\"Type\":\"Start\"},\"Act-Report\":{\"Parameters\":{},\"Type\":\"Report\"},\"Act-Transcode-M3U8\":{\"Parameters\":{\"Outputs\":\"[{\\\"Object\\\":\\\"transcode/{ObjectPrefix}{FileName}\\\",\\\"TemplateId\\\": \\\"957d1719ee85ed6527b90cf62726****\\\"}]\",\"OutputBucket\":\"example-bucket-****\",\"OutputLocation\":\"cn-shanghai\"},\"Type\":\"Transcode\"}},\"Dependencies\":{\"Act-Start\":[\"Act-Transcode-M3U8\"],\"Act-Report\":[],\"Act-Transcode-M3U8\":[\"Act-Report\"]}}","MediaWorkflowId":"93ab850b4f6f44eab54b6e91d24d****"}]},"RequestId":"16CD0CDD-457E-420D-9755-8385075A1234"}

Examples

Sample success responses

JSONformat

{
  "RequestId": "F1D21261-ADB9-406A-1234-491382139D59",
  "MediaWorkflow": {
    "CreationTime": "016-04-01T05:29:37Z",
    "MediaWorkflowId": "e00732b977da427d9177a4deb1aa****",
    "State": "Active",
    "TriggerMode": "OssAutoTrigger",
    "Name": "mediaworkflow-example",
    "Topology": "{mediaworkflow\",\"State\":\"Active\",\"Topology\":\"{\\\"Activities\\\":{\\\"Act-Start\\\":{\\\"Parameters\\\":{\\\"PipelineId\\\":\\\"130266f58161436a80bf07cb12c8****\\\",\\\"InputFile\\\":\\\"{\\\\\\\"Bucket\\\\\\\": \\\\\\\"example-bucket-****\\\\\\\",\\\\\\\"Location\\\\\\\": \\\\\\\"cn-shanghai\\\\\\\"}\\\"},\\\"Type\\\":\\\"Start\\\"},\\\"Act-Report\\\":{\\\"Parameters\\\":{},\\\"Type\\\":\\\"Report\\\"},\\\"Act-Transcode-M3U8\\\":{\\\"Parameters\\\":{\\\"Outputs\\\":\\\"[{\\\\\\\"Object\\\\\\\":\\\\\\\"transcode/{ObjectPrefix}{FileName}\\\\\\\",\\\\\\\"TemplateId\\\\\\\": \\\\\\\"957d1719ee85ed6527b90cf62726****\\\\\\\"}]\\\",\\\"OutputBucket\\\":\\\"example-bucket-****\\\",\\\"OutputLocation\\\":\\\"cn-shanghai\\\"},\\\"Type\\\":\\\"Transcode\\\"}},\\\"Dependencies\\\":{\\\"Act-Start\\\":[\\\"Act-Transcode-M3U8\\\"],\\\"Act-Report\\\":[],\\\"Act-Transcode-M3U8\\\":[\\\"Act-Report\\\"]}}\",\"MediaWorkflowId\":\"93ab850b4f6f44eab54b6e91d24d****\"}]},\"RequestId\":\"16CD0CDD-457E-420D-9755-8385075A1234\"}"
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history