Overview
Menu

CreateSchedule

1. API Description

Domain name for API request: mps.tencentcloudapi.com.

This API is used to create a scheme for media files uploaded to a specified COS bucket. A scheme may include the following tasks:

  1. Video transcoding (with watermark)
  2. Animated screenshot generating
  3. Time point screencapturing
  4. Sampled screencapturing
  5. Image sprite generating
  6. Adaptive bitrate streaming
  7. Intelligent content moderation (detection of pornographic and sensitive content)
  8. Intelligent content analysis (labeling, categorization, thumbnail generation, labeling by frame)
  9. Intelligent content recognition (face, full text, text keyword, full speech, and speech keyword)

Note: A scheme is disabled upon creation. You need to manually enable it.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter NameRequiredTypeDescription
ActionYesStringCommon Params. The value used for this API: CreateSchedule.
VersionYesStringCommon Params. The value used for this API: 2019-06-12.
RegionNoStringCommon Params. This parameter is not required for this API.
ScheduleNameYesStringThe scheme name (max 128 characters). This name should be unique across your account.
TriggerYesWorkflowTriggerThe trigger of the scheme. If a file is uploaded to the specified bucket, the scheme will be triggered.
Activities.NYesArray of ActivityThe subtasks of the scheme.
OutputStorageNoTaskOutputStorageThe bucket to save the output file. If you do not specify this parameter, the bucket in Trigger will be used.
OutputDirNoStringThe directory to save the media processing output file, which must start and end with /, such as /movie/201907/.
If you do not specify this, the file will be saved to the trigger directory.
TaskNotifyConfigNoTaskNotifyConfigThe notification configuration. If you do not specify this parameter, notifications will not be sent.

3. Output Parameters

Parameter NameTypeDescription
ScheduleIdIntegerThe scheme ID.
RequestIdStringThe unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Configuring a transcoding rule

This example shows you how to create a scheme for the bucket "evan-test-1300828900". It will be triggered whenever an MP4 or FLV file is uploaded to the bucket's /input/ directory. After it is triggered, a transcoding task (template ID 10) will be executed multiple times.

Input Example

POST / HTTP/1.1
Host: mps.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateSchedule
<Common request parameters>

{
    "ScheduleName": "evan_test7",
    "Trigger": {
        "Type": "CosFileUpload",
        "CosFileUploadTrigger": {
            "Bucket": "evan-test-1300828900",
            "Region": "ap-guangzhou",
            "Dir": "/input/",
            "Formats": [
                "mp4",
                "flv"
            ]
        }
    },
    "Activities": [
        {
            "ActivityType": "input",
            "ReardriveIndex": [
                1,
                2
            ]
        },
        {
            "ActivityType": "action-trans",
            "ReardriveIndex": [
                3
            ],
            "ActivityPara": {
                "TranscodeTask": {
                    "Definition": 10
                }
            }
        },
        {
            "ActivityType": "action-trans",
            "ReardriveIndex": [
                6,
                7
            ],
            "ActivityPara": {
                "TranscodeTask": {
                    "Definition": 10
                }
            }
        },
        {
            "ActivityType": "action-trans",
            "ReardriveIndex": [
                4,
                5
            ],
            "ActivityPara": {
                "TranscodeTask": {
                    "Definition": 10
                }
            }
        },
        {
            "ActivityType": "action-trans",
            "ReardriveIndex": [
                10
            ],
            "ActivityPara": {
                "TranscodeTask": {
                    "Definition": 10
                }
            }
        },
        {
            "ActivityType": "action-trans",
            "ReardriveIndex": [
                10
            ],
            "ActivityPara": {
                "TranscodeTask": {
                    "Definition": 10
                }
            }
        },
        {
            "ActivityType": "action-trans",
            "ReardriveIndex": [
                10
            ],
            "ActivityPara": {
                "TranscodeTask": {
                    "Definition": 10
                }
            }
        },
        {
            "ActivityType": "action-trans",
            "ReardriveIndex": [
                8
            ],
            "ActivityPara": {
                "TranscodeTask": {
                    "Definition": 10
                }
            }
        },
        {
            "ActivityType": "action-trans",
            "ReardriveIndex": [
                9
            ],
            "ActivityPara": {
                "TranscodeTask": {
                    "Definition": 10
                }
            }
        },
        {
            "ActivityType": "action-trans",
            "ReardriveIndex": [
                10
            ],
            "ActivityPara": {
                "TranscodeTask": {
                    "Definition": 10
                }
            }
        },
        {
            "ActivityType": "output",
            "ActivityPara": {}
        }
    ],
    "OutputStorage": {
        "Type": "COS",
        "CosOutputStorage": {
            "Bucket": "evan-test-1300828900",
            "Region": "ap-nanjing"
        }
    },
    "OutputDir": "output/"
}

Output Example

{
    "Response": {
        "RequestId": "6ca31e3a-6b8e-4b4e-9256-fdc700064ef3",
        "ScheduleId": 157482
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error CodeDescription
FailedOperation.CosStatusInavlidOperation failed: COS service is suspended.
FailedOperation.InvalidMpsUserOperation failed: unauthorized MPS user.
InternalErrorInternal error.
InternalError.AccessDBErrorData error.
InternalError.GenDefinitionInternal error: failed to generate template ID.
InvalidParameterValueIncorrect parameter value.
LimitExceeded.TooMuchTemplateLimit reached: the number of templates exceeds the limit.
ResourceNotFound.CosBucketNameInvalidThe resource does not exist: invalid COS bucket name.
ResourceNotFound.CosBucketNotExistThe resource does not exist: the COS bucket does not exist.