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

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

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.

ProjectId Long Yes 10000

The ID of the DataWorks workspace. You can log on to the DataWorks console and go to the Workspace Management page to obtain the workspace ID.

You must configure this parameter or the ProjectIdentifier parameter to determine the DataWorks workspace to which the operation is applied.

FileName String Yes File name

The name of the file.

FileDescription String No File description

The description of the file.

FileType Integer Yes 10

The type of the code for 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).

You can call the ListFileType operation to query the type of the code for the file.

Owner String No 1000000000001

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

Content String No SHOW TABLES;

The code for 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.

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 determines the value of this parameter based on the endpoint that is used to call the operation.

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 Rerun Interval parameter that is displayed after the Auto Rerun upon Error check box is selected 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 that corresponds to the file can be rerun. Valid values:

  • ALL_ALLOWED: The node can be rerun regardless of whether it is successfully run or fails to run.
  • FAILURE_ALLOWED: The node can be rerun only after it fails to run.
  • ALL_DENIED: The node cannot be rerun regardless of whether it is successfully run or fails to run.

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 Valid values:

  • true: The scheduling for the node is suspended.
  • false: The scheduling for the node is not suspended.

This parameter corresponds to the Recurrence 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 section of the Properties tab in the DataWorks console. For more information about the configurations of the scheduling parameters, see Configure scheduling parameters.

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. After you configure the Scheduling Cycle and Run At parameters in the DataWorks console, DataWorks generates the value of the Cron Expression parameter.

Examples:

  • 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 type of the cross-cycle scheduling dependency of the node. Valid values:

  • SELF: The instance generated for the node in the current cycle depends on the instance generated for the node in the previous cycle.
  • CHILD: The instance generated for the node in the current cycle depends on the instances generated for the descendant nodes at the nearest level of the node in the previous cycle.
  • USER_DEFINE: The instance generated for the node in the current cycle depends on the instances generated for one or more specified nodes in the previous cycle.
  • NONE: No cross-cycle scheduling dependency type is selected for the node.
DependentNodeIdList String No abc

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

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

The output name of the parent file on which the current file depends. If you specify multiple output names, separate them with commas (,).

This parameter corresponds to the Output Name parameter under Parent Nodes in the Dependencies section of the Properties tab in the DataWorks console.

ProjectIdentifier String No dw_project

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.

ResourceGroupIdentifier String No group_375827434852437

The identifier of the resource group that is used to run the node. You can call the ListResourceGroups operation to query the available resource groups in the workspace.

ResourceGroupId Long No 375827434852437

This parameter is deprecated. Do not use this parameter.

ConnectionName String No odps_first

The name of the connected data source that is used to run the node.

You can call the ListDataSources operation to query the available data sources of the workspace.

AutoParsing Boolean No true

Specifies whether the automatic parsing feature is enabled for the file. Valid values:

  • true: The automatic parsing feature is enabled for the file.
  • false: The automatic parsing feature is not enabled for the file.

This parameter corresponds to the Analyze Code parameter that is displayed after Same Cycle is selected in the Dependencies section of the Properties tab in the DataWorks console.

SchedulerType String No NORMAL

The scheduling type of the node. Valid values:

  • NORMAL: The node is an auto triggered node.
  • MANUAL: The node is a manually triggered node. Manually triggered nodes cannot be automatically triggered. They correspond to the nodes in the Manually Triggered Workflows pane.
  • PAUSE: The node is a paused node.
  • SKIP: The node is a dry-run node. Dry-run nodes are started as scheduled but the system sets the status of the nodes to successful when it starts to run them.
AdvancedSettings String No {"queue":"default","SPARK_CONF":"--conf spark.driver.memory=2g"}

The advanced configurations of the node.

This parameter is valid only for an EMR Spark Streaming node or an EMR Streaming SQL node. This parameter corresponds to the Advanced Settings tab of the node in the DataWorks console.

This parameter is configured in the JSON format.

StartImmediately Boolean No true

Specifies whether to immediately run a node after the node is deployed to the production environment.

This parameter is valid only for an EMR Spark Streaming node or an EMR Streaming SQL node. This parameter corresponds to the Start Method parameter in the Schedule section of the Configure tab in the DataWorks console.

InputParameters String No [{"ValueSource": "project_001.first_node:bizdate_param","ParameterName": "bizdate_input"}]

Input parameters of the node. This parameter is configured in the JSON format. For more information about the input parameters, refer to the InputParameters parameter in the Response parameters section of the GetFile operation.

This parameter corresponds to the Input Parameters table in the Input and Output Parameters section of the Properties tab in the DataWorks console.

OutputParameters String No [{"Type": 1,"Value": "${bizdate}","ParameterName": "bizdate_param"}]

Output parameters of the node. This parameter is configured in the JSON format. For more information about the output parameters, refer to the OutputParameters parameter in the Response parameters section of the GetFile operation.

This parameter corresponds to the Output Parameters table in the Input and Output Parameters section of the Properties tab in the DataWorks console.

Response parameters

Parameter Type Example Description
HttpStatusCode Integer 200

The HTTP status code returned.

Data Long 1000001

The ID of the file that was created.

RequestId String 0000-ABCD-EFG

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

ErrorMessage String The connection does not exist.

The error message returned.

Success Boolean true

Indicates whether the request is successful. Valid values:

  • true: The request is successful.
  • false: The request fails.
ErrorCode String Invalid.Tenant.ConnectionNotExists

The error code returned.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateFile
&FileFolderPath=Workflow/1/MaxCompute/Folder 1/Folder 2
&ProjectId=10000
&FileName=File name
&FileDescription=File description
&FileType=10
&Owner=1000000000001
&Content=SHOW TABLES;
&AutoRerunTimes=3
&AutoRerunIntervalMillis=120000
&RerunMode=ALL_ALLOWED
&Stop=false
&ParaValue=a=x b=y
&StartEffectDate=936923400000
&EndEffectDate=4155787800000
&CronExpress=00 05 00 * * ?
&CycleType=DAY
&DependentType=NONE
&DependentNodeIdList=abc
&InputList=project_root,project.file1,project.001_out
&ProjectIdentifier=dw_project
&ResourceGroupIdentifier=group_375827434852437
&ResourceGroupId=375827434852437
&ConnectionName=odps_first
&AutoParsing=true
&SchedulerType=NORMAL
&AdvancedSettings={"queue":"default","SPARK_CONF":"--conf spark.driver.memory=2g"}
&StartImmediately=true
&InputParameters=[{"ValueSource": "project_001.first_node:bizdate_param","ParameterName": "bizdate_input"}]
&OutputParameters=[{"Type": 1,"Value": "${bizdate}","ParameterName": "bizdate_param"}]
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "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
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.
429 Throttling.Api The request for this resource has exceeded your available limit. The error message returned because the number of requests for the resource has exceeded the upper limit.
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.
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.

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