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
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
mts:AddMediaWorkflow | create | *All Resources * |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
Name | string | Yes | The name of the media workflow.
| mediaworkflow-example |
Topology | string | Yes | 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.
| |
TriggerMode | string | No | The triggering mode of the media workflow. Valid values:
| OssAutoTrigger |
Sample topology
{
"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
Examples
Sample success responses
JSON
format
{
"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 time | Summary of changes | Operation |
---|