Creates a file in DataStudio. You cannot call this operation to create Data Integration nodes.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateFile

The operation that you want to perform.

FileFolderPath String Yes Workflow/1/MaxCompute/Folder 1/Folder 2

The path of the file.

FileName String Yes File name

The name of the file.

FileType Integer Yes 10

The type of the code in the file. Valid values: 6 (Shell), 10 (ODPS SQL), 11 (ODPS MR), 24 (ODPS script), 99 (zero load), 221 (PyODPS 2), 225 (ODPS Spark), 227 (EMR Hive), 228 (EMR Spark), 229 (EMR Spark SQL), 230 (EMR MR), 239 (OSS object inspection), 257 (EMR Shell), 258 (EMR Spark Shell), 259 (EMR Presto), 260 (EMR Impala), 900 (real-time synchronization), 1089 (cross-tenant collaboration), 1091 (Hologres development), 1093 (Hologres SQL), 1100 (assignment), and 1221 (PyODPS 3).

InputList String Yes project_root,project.file1,project.001_out

The output name of the parent file on which the current file depends. This parameter corresponds to the Parent Node Output Name parameter in the Dependencies section of the Properties tab in the DataWorks console. If you specify multiple output names, separate them with commas (,).

ProjectId Long Yes 10000

The ID of the DataWorks workspace. You can click the Workspace Manage icon in the upper-right corner of the DataStudio page to go to the Workspace Management page and view the workspace ID.

RegionId String Yes cn-zhangjiakou

The region ID. For example, the ID of the China (Shanghai) region is cn-shanghai, and that of the China (Zhangjiakou) region is cn-zhangjiakou. The system automatically determines the value of this parameter based on the endpoint that is used to call the operation.

FileDescription String No File description

The description of the file.

Owner String No 1000000000001

The ID of the Alibaba Cloud account used by the file owner. If this parameter is not specified, the ID of the Alibaba Cloud account of the user who calls the operation is automatically used.

Content String No SHOW TABLES;

The code of the file. The code format varies based on the file type. To view the code format for a specific file type, go to Operation Center, right-click a node of the file type, and then select View Code.

AutoRerunTimes Integer No 3

The number of automatic reruns that are allowed after an error occurs. Maximum value: 10.

AutoRerunIntervalMillis Integer No 120000

The interval between automatic reruns after an error occurs. Unit: milliseconds. Maximum value: 1800000 (30 minutes). This parameter corresponds to the Auto Rerun Interval upon Error parameter in the Schedule section of the Properties tab in the DataWorks console. The interval that you specify in the DataWorks console is measured in minutes. Pay attention to the conversion between the units of time when you call the operation.

RerunMode String No ALL_ALLOWED

Specifies whether the node can be rerun. Valid values: ALL_ALLOWED, FAILURE_ALLOWED, and ALL_DENIED. The value ALL_ALLOWED indicates that the node can be rerun regardless of whether the last running is successful. The value FAILURE_ALLOWED indicates that the node can be rerun only if the last running fails. The value ALL_DENIED indicates that the node cannot be rerun. This parameter corresponds to the Rerun parameter in the Schedule section of the Properties tab in the DataWorks console.

Stop Boolean No false

Specifies whether the scheduling for the node is suspended. This parameter corresponds to the Skip Execution parameter in the Schedule section of the Properties tab in the DataWorks console.

ParaValue String No a=x b=y

The scheduling parameters of the node. This parameter corresponds to the Parameters parameter in the General section of the Properties tab in the DataWorks console.

StartEffectDate Long No 936923400000

The start time of automatic scheduling. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC. This parameter corresponds to the Validity Period parameter in the Schedule section of the Properties tab in the DataWorks console.

EndEffectDate Long No 4155787800000

The end time of automatic scheduling. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC. This parameter corresponds to the Validity Period parameter in the Schedule section of the Properties tab in the DataWorks console.

CronExpress String No 00 05 00 * * ?

The cron expression that represents the automatic scheduling policy of the node. This parameter corresponds to the Cron Expression parameter in the Schedule section of the Properties tab in the DataWorks console.

  • Cron expression for a node that is scheduled to run at 05:30 every day: 00 30 05 * * ?
  • Cron expression for a node that is scheduled to run at the fifteenth minute of each hour: 00 15 * * * ?
  • Cron expression for a node that is scheduled to run every 10 minutes: 00 00/10 * * * ?
  • Cron expression for a node that is scheduled to run every 10 minutes from 08:00 to 17:00 every day: 00 00-59/10 8-23 * * * ?
  • Cron expression for a node that is scheduled to run at 00:20 on the first day of each month: 00 20 00 1 * ?
  • Cron expression for a node that is scheduled to run every three months starting from 00:10 on January 1: 00 10 00 1 1-12/3 ?
  • Cron expression for a node that is scheduled to run at 00:05 every Tuesday and Friday: 00 05 00 * * 2,5

The scheduling system of DataWorks imposes the following limits on cron expressions:

  • A node can be scheduled to run at a minimum interval of 5 minutes.
  • A node can be scheduled to run at 00:05 every day at the earliest.
CycleType String No DAY

The type of the scheduling cycle. Valid values: NOT_DAY and DAY. The value NOT_DAY indicates that the node is scheduled to run by minute or hour. The value DAY indicates that the node is scheduled to run by day, week, or month. This parameter corresponds to the Scheduling Cycle parameter in the Schedule section of the Properties tab in the DataWorks console.

DependentType String No NONE

The way in which the node depends on last-cycle instances. Valid values: NONE, SELF, CHILD, and USER_DEFINE. The value NONE indicates that the node does not depend on last-cycle instances. The value SELF indicates that the node depends on its own last-cycle instance. The value CHILD indicates that the node depends on the last-cycle instances of its descendant nodes. The value USER_DEFINE indicates that the node depends on the last-cycle instances of specific nodes.

DependentNodeIdList String No abc

The IDs of the nodes that generate instances in the last cycle on which the current node depends.

ProjectIdentifier String No dw_project

The globally unique identifier (GUID) of the DataWorks workspace. You can view the GUID at the top of the DataStudio page. You can also click the GUID to switch to another workspace.

You must specify either this parameter or ProjectId to determine the DataWorks workspace to which the operation is applied.

ResourceGroupIdentifier String No group_375827434852437

The identifier of the resource group that is used to run the node. This parameter corresponds to the Resource Group parameter in the Resource Group section of the Properties tab in the DataWorks console.

You can call the ListResourceGroups operation to query the available resource groups in the workspace. If ResourceGroupType is set to 1, the value of this parameter is extracted from the obtained result.

ResourceGroupId Long No 375827434852437

This parameter is deprecated.

The ID of the resource group that is used to run the node. This parameter corresponds to the Resource Group parameter in the Resource Group section of the Properties tab in the DataWorks console. You must specify either this parameter or the ResourceGroupIdentifier parameter to determine the resource group.

You can call the ListResourceGroups operation to query the available resource groups in the workspace. If ResourceGroupType is set to 1, the value of this parameter is extracted from the obtained result.

ConnectionName String No odps_first

The name of the connected data source that is used to run the node. This parameter corresponds to the Connection parameter in the Source column of the Connections section on the configuration tab of the node.

You can call the ListConnections operation to obtain the available data sources of the workspace and extract the value of this parameter from the obtained result.

You can call the UpdateDataSource operation to query the available data sources of the workspace and extract the value of this parameter from the obtained result.

AutoParsing Boolean No true

Specifies whether the automatic parsing feature is enabled for the file. This parameter corresponds to the Auto Parse parameter in the Dependencies section of the Properties tab in the DataWorks console.

Response parameters

Parameter Type Example Description
Data Long 1000001

The ID of the file that was created.

ErrorCode String Invalid.Tenant.ConnectionNotExists

The error code returned.

ErrorMessage String The connection does not exist.

The error message returned.

HttpStatusCode Integer 200

The HTTP status code returned.

RequestId String 0000-ABCD-EFG

The ID of the request. You can use the ID to troubleshoot issues.

Success Boolean true

Indicates whether the request is successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateFile
&FileFolderPath=Workflow/1/MaxCompute/Folder 1/Folder 2
&FileName=File name
&FileType=10
&InputList=project_root,project.file1,project.001_out
&ProjectId=10000
&RegionId=cn-zhangjiakou
&<Common request parameters>

Sample success responses

XML format

<RequestId>0000-ABCD-EFG</RequestId>
<HttpStatusCode>200</HttpStatusCode>
<Data>1000001</Data>
<ErrorCode>Invalid.Tenant.ConnectionNotExists</ErrorCode>
<ErrorMessage>The connection does not exist.</ErrorMessage>
<Success>true</Success>

JSON format

{
    "RequestId": "0000-ABCD-EFG",
    "HttpStatusCode": 200,
    "Data": 1000001,
    "ErrorCode": "Invalid.Tenant.ConnectionNotExists",
    "ErrorMessage": "The connection does not exist.",
    "Success": true
}

Error codes

HttpCode Error code Error message Description
500 InternalError.System An internal system error occurred. Try again later. The error message returned because an internal error has occurred. Try again later.
500 InternalError.UserId.Missing An internal system error occurred. Try again later. The error message returned because an internal error has occurred. Try again later.
429 Throttling.Api The request for this resource has exceeded your available limit. The error message returned because the maximum number of requests for the resource has been reached.
429 Throttling.System The DataWorks system is busy. Try again later. The error message returned because the DataWorks system is busy. Try again later.
429 Throttling.User Your request is too frequent. Try again later. The error message returned because excessive requests have been submitted within a short period of time. Try again later.
403 Forbidden.Access Access is forbidden. Please first activate DataWorks Enterprise Edition or Flagship Edition. The error message returned because you are not allowed to perform this operation. Activate DataWorks Enterprise Edition or DataWorks Ultimate Edition.

For a list of error codes, visit the API Error Center.