API reference
The AIWorkflow (AI analysis workflow) module of the AI Education App Server submits AI analysis workflow tasks for ApsaraVideo VOD media assets and returns the analysis results to your client. This reference describes the request parameters, response structures, data models, and error codes of the operations that the module currently provides.
Prerequisites
The App Server runs locally or is deployed to Function Compute.
An AI workflow is available in the ApsaraVideo VOD console.
SubmitWorkflowJobrequires the ID of this workflow.The configuration file of the App Server specifies the
akandskcredentials and the region.
API specifications
Basic information
Item | Description |
Request URL |
|
Request method | GET or POST. All request samples in this topic use POST. |
|
|
Character encoding | UTF-8. |
Call sequence
The operations in the AIWorkflow module are chained in the following order:
Call
SubmitWorkflowJobwith the media asset ID (MediaId) and the AI workflow ID (WorkflowId) to start an AI analysis workflow task.Call
GetWorkflowTaskwith the workflow task ID (TaskId) and check the returnedStatusfield until it becomesSuccessorFail.After
StatusbecomesSuccess, callGetMediaAiAnalysisorGetMediaAiAnalysisByResultTypewith the sameMediaIdto get the AI analysis results.
Response formats
Operations in the AIWorkflow module fall into two categories. Note the difference in response structures when you integrate them:
Pass-through operations —
SubmitWorkflowJob,GetWorkflowTask, andGetMediaAiAnalysis. Their response structures are the same as those of the corresponding OpenAPI operations in ApsaraVideo VOD.Structured operation —
GetMediaAiAnalysisByResultType. It parses the raw JSON string into a structured object before returning it, so that your client can use the result directly.GetMediaAiAnalysisandGetMediaAiAnalysisByResultTypereturn the same AI analysis data in different formats. The following table describes how to choose between them.
Requirement | Operation |
(Recommended) Use the analysis results in a client without extra parsing, or filter the results by result type. |
|
Keep the response identical to the corresponding OpenAPI operation in ApsaraVideo VOD, or parse the raw content string in your own code. |
|
Workflow management
Before using the AIWorkflow module, you must submit a ticket to request activation of AIWorkflow and obtain a workflow ID.
SubmitWorkflowJob: Submit a workflow task
Submits an AI analysis workflow task for a specified media asset. Request path: /SubmitWorkflowJob. The response structure is the same as that of the SubmitWorkflowJob operation.
The following table describes the request parameters.
Parameter | Type | Required | Description |
| String | Yes | The ID of the ApsaraVideo VOD media asset. |
| String | Yes | The ID of the AI workflow. |
| String | No | The region ID. If you leave this parameter blank, the region in the configuration file is used. |
Sample request:
curl -X POST http://localhost:9000/SubmitWorkflowJob \
-d 'MediaId=YOUR_MEDIA_ID&WorkflowId=YOUR_WORKFLOW_ID®ionId=cn-shanghai'Sample response:
{
"RequestId": "xxx",
"JobId": "job_xxx"
}GetWorkflowTask: Query a workflow task
Queries the execution status and result of a workflow task by task ID. Request path: /GetWorkflowTask. The response structure is the same as that of the GetWorkflowTask operation.
The following table describes the request parameters.
Parameter | Type | Required | Description |
| String | Yes | The ID of the workflow task. |
Sample request:
curl -X POST http://localhost:9000/GetWorkflowTask \
-d 'TaskId=YOUR_TASK_ID'Sample response:
{
"RequestId": "xxx",
"WorkflowTask": {
"TaskId": "task_xxx",
"Status": "Success",
"MediaId": "media_xxx",
"CreateTime": "2026-01-01T00:00:00Z"
}
}The following table describes the valid values of the task status (Status).
Value | Description |
Init | Initialized. The task is submitted but has not started. |
Processing | In progress. Poll the task at intervals of at least several seconds to avoid frequent calls. |
Success | Succeeded. Call |
Fail | Failed. Check the media asset and the workflow configuration based on the returned information. |
AI analysis results
GetMediaAiAnalysis: Get raw AI analysis results
Gets the raw AI analysis data of a media asset as a JSON string. Request path: /GetMediaAiAnalysis.For details, please see GetMediaAiAnalysis.
The response of this operation is cached for 5 minutes.
The following table describes the request parameter MediaId.
Parameter | Type | Required | Description |
| String | Yes | The ID of the ApsaraVideo VOD media asset. |
Sample request:
curl -X POST http://localhost:9000/GetMediaAiAnalysis \
-d 'MediaId=YOUR_MEDIA_ID'Sample response:
{
"RequestId": "xxx",
"AiAnalysisResultList": {
"AiAnalysisResult": [
{
"Title": "Video summary",
"ResultType": "Summary",
"Extra": "",
"Content": "{...}"
},
{
"Title": "Video chapters",
"ResultType": "Chapter",
"Extra": "",
"Content": "[{...}]"
}
]
}
}GetMediaAiAnalysisByResultType: Get analysis results by result type
Gets the AI analysis results of a media asset, filters them by ResultType, and returns structured objects that your client can use directly. Request path: /GetMediaAiAnalysisByResultType.
The following table describes the request parameters.
Parameter | Type | Required | Description |
| String | Yes | The ID of the ApsaraVideo VOD media asset. |
| String | No | The result type filter. Valid values: Summary, Chapter. If you leave this parameter blank, all result types are returned. |
Sample requests:
# Get the summary
curl -X POST http://localhost:9000/GetMediaAiAnalysisByResultType \
-d 'MediaId=YOUR_MEDIA_ID&ResultType=Summary'
# Get the chapters
curl -X POST http://localhost:9000/GetMediaAiAnalysisByResultType \
-d 'MediaId=YOUR_MEDIA_ID&ResultType=Chapter'
# Get all result types
curl -X POST http://localhost:9000/GetMediaAiAnalysisByResultType \
-d 'MediaId=YOUR_MEDIA_ID'Sample response for ResultType=Summary:
{
"AiAnalysisResult": [
{
"Title": "Video summary",
"ResultType": "Summary",
"Extra": "",
"SummaryContent": {
"ParagraphSummary": "This video mainly covers...",
"ConversationalSummary": [],
"MindMapSummary": [],
"MarkdownContent": "# Video summary..."
}
}
]
}For the definitions of the returned fields, see the Data models section.
Data models
The following models define the fields of the AI analysis results that the AIWorkflow module returns.
AiAnalysisResponse
The top-level response structure of AI analysis results. It contains only the AiAnalysisResult field.
Field | Type | Description |
| List | The list of AI analysis results. |
AiAnalysisResult
A single AI analysis result.
Field | Type | Description |
Title | String | The title of the result. |
| String | The result type. Valid values: Summary, Chapter. |
Extra | String | Additional information. |
Content | String | The raw content string. This field is blank after the content is parsed into a structured object. |
|
| The structured content when |
| List of | The structured content when |
SummaryContent
The structured content of the Summary result type.
Field | Type | Description |
| String | The paragraph summary. |
| List of | The conversational summary, organized by speaker. |
| List of | The mind map summary. |
| String | The summary content in Markdown, which you can render directly. |
ConversationalSummary
An element of the conversational summary.
Field | Type | Description |
| String | The speaker ID. |
| String | The name of the speaker. |
Summary | String | The summary content of the speaker. |
MindMapSummary
An element of the mind map summary.
Field | Type | Description |
Title | String | The title of the node. |
Topic | List | The list of subtopics. |
ChapterContentItem
A content element of the Chapter result type.
Field | Type | Description |
| Integer | The ID of the chapter. |
| String | The title of the chapter. |
| Long | The start time of the chapter, in milliseconds. |
| Long | The end time of the chapter, in milliseconds. |
| String | The URL of the chapter thumbnail. |
Summary | String | The summary of the chapter. |
| List of | The key points covered in the chapter. |
KnowledgePoint
An element of the key points.
Field | Type | Description |
| Integer | The ID of the key point. |
Point | String | The name of the key point. |
Description | String | The description of the key point. |
Error codes
HTTP status codes
Status code | Description |
200 | The request is successful. |
400 | Invalid request parameters. This error usually occurs when a required parameter is missing. Check parameters such as |
500 | Internal server error. Check the server logs to locate the exception. |
Business messages
Message | Description |
Empty input parameter | A required parameter is missing. Check required parameters such as |
Common ApsaraVideo VOD error codes
Error code | Description | Solution |
| The AccessKey does not exist. | Check whether the |
| The signature is invalid. | Check whether the |
| The parameter is invalid. | Check the parameter format and value range. |
| The media asset does not exist. | Make sure that |
For the complete list of error codes, see Public error codes.