CreateFile
Creates a file in DataStudio. This operation does not support creating Data Integration node tasks.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dataworks:* |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| FileFolderPath |
string |
No |
The path of the file. |
Business_process/First_Business_Process/MaxCompute/Folder_1/Folder_2 |
| ProjectId |
integer |
No |
The ID of the DataWorks workspace. You can log on to the DataWorks console and go to the Workspace Settings page to obtain the workspace ID. You must specify either this parameter or ProjectIdentifier to determine the DataWorks workspace for this API call. |
10000 |
| FileName |
string |
Yes |
The name of the file. |
File name |
| FileDescription |
string |
No |
The description of the file. |
This is a file description. |
| FileType |
integer |
Yes |
The code type of the file. Different file types have different codes. For more information, see DataWorks nodes. You can call the ListFileType operation to query the code types of files. |
10 |
| Owner |
string |
No |
The Alibaba Cloud user ID of the file owner. If this parameter is left empty, the Alibaba Cloud user ID of the caller is used by default. |
1000000000001 |
| Content |
string |
No |
The code content of the file. Different code types (fileType) have different code formats. You can find the corresponding type of node in Operation Center, right-click the node, and then click View Code to view the specific code format. |
SHOW TABLES; |
| AutoRerunTimes |
integer |
No |
The number of automatic reruns allowed upon an error. The maximum value is 10. |
3 |
| AutoRerunIntervalMillis |
integer |
No |
The interval between automatic reruns upon an error, in milliseconds. The maximum value is 1800000 milliseconds (30 minutes). This parameter corresponds to the Rerun Interval setting under Scheduling Configuration > Time Properties > Auto Rerun upon Error of a DataStudio task in the DataWorks console. The Rerun Interval in the console is in minutes. Make sure to convert the time unit when calling this operation. |
120000 |
| RerunMode |
string |
No |
The rerun property. Valid values:
This parameter corresponds to the Rerun Property setting under Scheduling Configuration > Time Properties > Rerun Property of a DataStudio task in the DataWorks console. |
ALL_ALLOWED |
| Stop |
boolean |
No |
Specifies whether to suspend scheduling. Valid values:
This parameter corresponds to setting the Scheduling Type to Suspend Scheduling under Scheduling Configuration > Time Properties of a DataStudio task in the DataWorks console. |
false |
| ParaValue |
string |
No |
The scheduling parameters. Separate multiple parameters with spaces. This parameter corresponds to the Parameters setting under Scheduling Configuration of a DataStudio task in the DataWorks console. For more information, see Scheduling parameters. |
a=x b=y |
| StartEffectDate |
integer |
No |
The timestamp in milliseconds when automatic scheduling starts. This parameter corresponds to the start time (in milliseconds) of the Effective Date setting under Scheduling Configuration > Time Properties of a DataStudio task in the DataWorks console. |
1671608450000 |
| EndEffectDate |
integer |
No |
The timestamp in milliseconds when automatic scheduling stops. This parameter corresponds to the end time (in milliseconds) of the Effective Date setting under Scheduling Configuration > Time Properties of a DataStudio task in the DataWorks console. |
1671694850000 |
| CronExpress |
string |
No |
The cron expression for periodic scheduling. This parameter corresponds to the cron Expression setting under Scheduling Configuration > Time Property > cron Expression of a DataStudio node in the DataWorks console. After you configure the Scheduling Cycle and Timed Scheduling Time, DataWorks automatically generates the corresponding cron expression. Examples:
Due to the rules of the DataWorks scheduling system, the cron expression has the following limits:
|
00 05 00 * * ? |
| CycleType |
string |
No |
The type of the scheduling cycle. Valid values: NOT_DAY (minute or hour) and DAY (day, week, or month). This parameter corresponds to the Scheduling Cycle setting under Scheduling Configuration > Time Properties of a DataStudio task in the DataWorks console. |
DAY |
| DependentType |
string |
No |
The mode of cross-cycle dependency. Valid values:
|
NONE |
| DependentNodeIdList |
string |
No |
The list of nodes that the current node depends on from the previous cycle. |
abc |
| InputList |
string |
No |
The output names of the upstream files that the file depends on. Separate multiple output names with commas (,). This parameter corresponds to the Parent Node Output Name setting when Same Cycle is selected under Scheduling Configuration > Scheduling Dependency of a DataStudio task in the DataWorks console. |
project_root,project.file1,project.001_out |
| ProjectIdentifier |
string |
No |
The name of the DataWorks workspace. You can log on to the DataWorks console and go to the Workspace Management page to obtain the workspace name. You must configure this parameter or the ProjectId parameter to determine the DataWorks workspace to which the operation is applied. |
dw_project |
| ResourceGroupIdentifier |
string |
No |
The name of the DataWorks workspace. You can log on to the DataWorks console and go to the Workspace Settings page to obtain the workspace name. You must specify either this parameter or ProjectId to determine the DataWorks workspace for this API call. |
dw_project |
| ResourceGroupId |
integer |
No |
The schedule resource used when the file is published as a node and executed. You can call the ListResourceGroups operation and use the identifier field to obtain the list of available resource groups for the workspace. Note
Make sure that the resource group returned by the ListResourceGroups operation is bound to the workspace used to create the file. The resource group can be used in CreateFile only after it is bound. |
group_375827434852437 |
| ConnectionName |
string |
No |
This parameter is deprecated. Do not use it. The schedule resource used when the file is published as a node and executed. This parameter corresponds to the Scheduling Configuration > Resource Properties > Scheduling Resource Group setting on the page. You can specify either this parameter or ResourceGroupIdentifier. You can call the ListResourceGroups operation to obtain the list of available resource groups for the workspace. Set ResourceGroupType to 1 and use the ID field from the response. |
375827434852437 |
| AutoParsing |
boolean |
No |
The data source that the node connects to when the file is published as a node and executed. You can call the UpdateDataSource operation to obtain the list of available data sources for the workspace. |
odps_source |
| SchedulerType |
string |
No |
Specifies whether to enable automatic parsing for the file. Valid values:
This parameter corresponds to the Code Parsing setting when Same Cycle is selected under Scheduling Configuration > Scheduling Dependency of a DataStudio task in the DataWorks console. |
true |
| AdvancedSettings |
string |
No |
The type of scheduling. Valid values:
|
NORMAL |
| StartImmediately |
boolean |
No |
The advanced settings of the node. This parameter corresponds to the Advanced Settings in the right-side navigation pane of the editing page for EMR Spark Streaming and EMR Streaming SQL DataStudio tasks in the DataWorks console. Currently, only EMR Spark Streaming and EMR Streaming SQL tasks support this parameter, and the parameter value must be in JSON format. |
{"queue":"default","SPARK_CONF":"--conf spark.driver.memory=2g"} |
| InputParameters |
string |
No |
Specifies whether to start the node immediately after it is published. This parameter corresponds to the Start Mode setting under Configuration > Time Properties in the right-side navigation pane of the editing page for EMR Spark Streaming and EMR Streaming SQL DataStudio tasks in the DataWorks console. |
true |
| OutputParameters |
string |
No |
The context input parameters of the node. The parameter value is in JSON format. For the fields included, see the InputContextParameterList parameter structure in the response of the GetFile operation. This parameter corresponds to the Input Parameters of This Node setting under Scheduling Configuration > Node Context of a DataStudio task in the DataWorks console. |
[{"ValueSource": "project_001.first_node:bizdate_param","ParameterName": "bizdate_input"}] |
| IgnoreParentSkipRunningProperty |
boolean |
No |
The context output parameters of the node. The parameter value is in JSON format. For the fields included, see the OutputContextParameterList parameter structure in the response of the GetFile operation. This parameter corresponds to the Output Parameters of This Node setting under Scheduling Configuration > Node Context of a DataStudio task in the DataWorks console. |
[{"Type": 1,"Value": "${bizdate}","ParameterName": "bizdate_param"}] |
| CreateFolderIfNotExists |
boolean |
No |
Specifies whether to inherit the dry-run property from the previous cycle. Valid values:
|
false |
| ApplyScheduleImmediately |
boolean |
No |
Specifies whether to automatically create the folder if the specified folder path (FileFolderPath) does not exist in the system. Valid values:
|
false |
| Timeout |
integer |
No |
Specifies whether the scheduling configuration takes effect immediately after the file is published. |
true |
| ImageId |
string |
No |
The timeout period defined in the scheduling configuration. |
1 |
|
No |
The ID of the custom image. |
m-bp1h4b5a8ogkbll2f3tr |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| HttpStatusCode |
integer |
The HTTP status code. |
200 |
| Data |
integer |
The ID of the file after it is created. |
1000001 |
| RequestId |
string |
The unique ID of the request. You can use this ID to troubleshoot issues. |
0000-ABCD-EFG |
| ErrorMessage |
string |
The error message. |
The connection does not exist. |
| Success |
boolean |
Indicates whether the call was successful. Valid values:
|
true |
| ErrorCode |
string |
The error code. |
Invalid.Tenant.ConnectionNotExists |
Examples
Success response
JSON format
{
"HttpStatusCode": 200,
"Data": 1000001,
"RequestId": "0000-ABCD-EFG",
"ErrorMessage": "The connection does not exist.",
"Success": true,
"ErrorCode": "Invalid.Tenant.ConnectionNotExists"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 500 | InternalError.System | An internal system error occurred. Try again later. | |
| 500 | InternalError.UserId.Missing | An internal system error occurred. Try again later. | |
| 403 | Forbidden.Access | Access is forbidden. Please first activate DataWorks Enterprise Edition or Flagship Edition. | No permission, please authorize |
| 429 | Throttling.Api | The request for this resource has exceeded your available limit. | |
| 429 | Throttling.System | The DataWorks system is busy. Try again later. | |
| 429 | Throttling.User | Your request is too frequent. Try again later. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.