Imports a workflow and its child nodes that are specified by the FlowSpec field to DataStudio.
Operation description
-
This API does not support importing multiple workflow definitions. If you define more than one workflow definition in the FlowSpec, all workflow definitions except the first one are ignored.
-
This is an asynchronous API. Calling this API returns an asynchronous task object. You must call the GetJobStatus API to query the execution status of the task.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dataworks:* |
update |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ProjectId |
integer |
Yes |
The DataWorks workspace ID. You can log on to the DataWorks console and go to the Workspace page to query the ID. You must configure this parameter to specify the DataWorks workspace to which the API operation is applied. |
123456 |
| Spec |
string |
Yes |
The FlowSpec information for this workflow. For more information, see FlowSpec. Note
How to quickly obtain a FlowSpec template?
Note
This interface supports creating both the workflow and its internal nodes simultaneously. Therefore, please pay close attention to the ID specified in the FlowSpec. If the provided ID already exists, the operation will be treated as an update. A create operation is performed only if the ID is omitted or does not exist. |
{ "version": "1.1.0", "kind": "CycleWorkflow", "spec": { "name": "Asynchronous_Workflow_Creation_Test", "id": "632647691239009XXXX", "type": "CycleWorkflow", "workflows": [ { "script": { "path": "XX/OpenAPI_Test/Workflow_Test/Asynchronous_Workflow_Creation_Test", "runtime": { "command": "WORKFLOW" } }, "id": "632647691239009XXXX", "trigger": { "type": "Scheduler", "cron": "00 03 00 * * ?", "startTime": "1970-01-01 00:00:00", "endTime": "9999-01-01 00:00:00", "timezone": "Asia/Shanghai", "delaySeconds": 0 }, "strategy": { "timeout": 0, "instanceMode": "T+1", "rerunMode": "Allowed", "rerunTimes": 3, "rerunInterval": 180000, "failureStrategy": "Break" }, "name": "Asynchronous_Workflow_Creation_Test", "inputs": {}, "outputs": { "nodeOutputs": [ { "data": "632647691239009XXXX", "artifactType": "NodeOutput", "refTableName": "Asynchronous_Workflow_Creation_Test" } ] }, "nodes": [ { "recurrence": "Normal", "id": "742981001612325XXXX", "timeout": 0, "instanceMode": "T+1", "rerunMode": "Allowed", "rerunTimes": 3, "rerunInterval": 180000, "script": { "path": "XX/OpenAPI_Test/Workflow_Test/Asynchronous_Workflow_Creation_Test/111", "runtime": { "command": "ODPS_SQL" }, "content": "select now();\n" }, "trigger": { "type": "Scheduler", "cron": "00 24 00 * * ?", "startTime": "1970-01-01 00:00:00", "endTime": "9999-01-01 00:00:00", "timezone": "Asia/Shanghai", "delaySeconds": 0 }, "name": "111", "inputs": {}, "outputs": { "nodeOutputs": [ { "data": "742981001612325XXXX", "artifactType": "NodeOutput", "refTableName": "111" } ] } }, { "recurrence": "Normal", "id": "595182137303408XXXX", "timeout": 0, "instanceMode": "T+1", "rerunMode": "Allowed", "rerunTimes": 3, "rerunInterval": 180000, "script": { "path": "XX/OpenAPI_Test/Workflow_Test/Asynchronous_Workflow_Creation_Test/222", "runtime": { "command": "ODPS_SQL" }, "content": "select now();\n select 1;" }, "trigger": { "type": "Scheduler", "cron": "00 00 00 * * ?", "startTime": "1970-01-01 00:00:00", "endTime": "9999-01-01 00:00:00", "timezone": "Asia/Shanghai", "delaySeconds": 0 }, "name": "222", "inputs": {}, "outputs": { "nodeOutputs": [ { "data": "595182137303408XXXX", "artifactType": "NodeOutput", "refTableName": "222" } ] } } ], "dependencies": [ { "nodeId": "595182137303408XXXX", "depends": [ { "type": "Normal", "output": "742981001612325XXXX", "refTableName": "111" } ] } ] } ] } } |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| RequestId |
string |
The request ID. |
7C352CB7-CD88-50CF-9D0D-E81BDF020E7F |
| AsyncJob |
object |
The status information of the asynchronous task. |
|
| Completed |
boolean |
Indicates whether the asynchronous task is complete. |
false |
| CreateTime |
integer |
The time when the asynchronous task was created. This value is a UNIX timestamp. |
1706581425000 |
| Error |
string |
The error message returned if the asynchronous task fails. |
target folder already exists: XXXX |
| Id |
string |
The ID of the asynchronous task. |
1234567691239009XXXX |
| Progress |
integer |
The progress of the asynchronous task. Valid values: 0 to 100. |
0 |
| Response |
string |
The response. Note
The workflow ID is returned. |
632647691239009XXXX |
| Status |
string |
The status of the asynchronous task. Valid values:
|
Running |
| Type |
string |
The type of the asynchronous task. Valid values:
|
Create |
Examples
Success response
JSON format
{
"RequestId": "7C352CB7-CD88-50CF-9D0D-E81BDF020E7F",
"AsyncJob": {
"Completed": false,
"CreateTime": 1706581425000,
"Error": "target folder already exists: XXXX",
"Id": "1234567691239009XXXX",
"Progress": 0,
"Response": "632647691239009XXXX",
"Status": "Running",
"Type": "Create"
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.