Trigger file workflow¶
Triggers the workflow associated with the specified file and returns the actual number triggered.
POST https://moi.matrixorigin.cn/newmoi/catalog/file/trigger_workflow
Preparation before calling¶
First query the file list to obtain the target file and the volume to which it belongs. Prepare a list of personal access tokens, target workspace IDs, volume IDs, and file IDs that have access to the target workspace.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed throughX-Workspace-IDHeader.$VOLUME_ID: ID of the root volume to which the file belongs.$FILE_ID: The file ID to trigger the associated workflow.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/file/trigger_workflow" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"volume_id": '"$VOLUME_ID"',
"file_ids": ["'"$FILE_ID"'"]
}'
Request body¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Yes |
ID of the root volume to which the file belongs. |
|
string[] |
Yes |
List of file IDs to trigger. |
[] after a type means an array. For example, string[] is an array of strings.
Successful response¶
When successful, 200 is returned. triggered indicates the number of associated workflows actually triggered this time.
{
"code": "OK",
"msg": "OK",
"data": {
"triggered": 1
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
The number of associated workflows actually triggered this time. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "请求参数无效",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
Invalid volume ID or file ID list. |
Check the resource identifier in the request body. |
|
|
The current identity does not have read permission to the target volume. |
Use credentials with read permissions. |
|
|
The server failed to trigger the associated workflow. |
Try again later and confirm the execution status via the relevant workflow page. |