CreateFile

Updated at:

Creates a file in Data Studio. This operation does not support creating data integration node tasks.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

FileFolderPath

string

Yes

The file path.

Business_process/First_Business_Process/MaxCompute/Folder_1/Folder_2

ProjectId

integer

Yes

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 specify either this parameter or the ProjectIdentifier parameter to determine the DataWorks workspace on which the API operation is performed.

10000

FileName

string

Yes

The name of the file.

File name

FileDescription

string

No

The description of the file.

test

FileType

integer

Yes

The code type of the file. The code varies based on the file type. For more information, see DataWorks node types. You can call the ListFileType operation to query the code type of the file.

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. The code format varies based on the code type (fileType). You can find a task of the corresponding type in Operation Center, right-click the task, and select View Code to view the specific code format.

SHOW TABLES;

AutoRerunTimes

integer

No

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

3

AutoRerunIntervalMillis

integer

No

The interval between automatic reruns after a failure, in milliseconds. Maximum value: 1800000 (30 minutes). This parameter corresponds to the Rerun Interval parameter in the Schedule > Time Attributes > Automatic Rerun after Error section of the Data Studio page in the DataWorks console. The unit of the Rerun Interval parameter in the console is minutes. Convert the time unit when you call this operation.

120000

RerunMode

string

No

The rerun mode. Valid values:

  • ALL_ALLOWED: The node can be rerun after it succeeds or fails.

  • FAILURE_ALLOWED: The node cannot be rerun after it succeeds, but can be rerun after it fails.

  • ALL_DENIED: The node cannot be rerun regardless of whether it succeeds or fails.

This parameter corresponds to the Rerun Mode parameter in the Schedule > Time Attributes section of the Data Studio page in the DataWorks console.

Valid values:

  • ALL_ALLOWED :

    The node can be rerun after it succeeds or fails.

  • ALL_DENIED :

    The node cannot be rerun regardless of whether it succeeds or fails.

  • FAILURE_ALLOWED :

    The node cannot be rerun after it succeeds, but can be rerun after it fails.

ALL_ALLOWED

Stop

boolean

No

Specifies whether to pause scheduling. Valid values:

  • true: Pause scheduling.

  • false: Do not pause scheduling.

This parameter corresponds to the Schedule Type parameter set to Pause Scheduling in the Schedule > Time Attributes section of the Data Studio page in the DataWorks console.

false

ParaValue

string

No

The scheduling parameters. Separate multiple parameters with spaces.

This parameter corresponds to the Scheduling Parameters section in the Schedule section of the Data Studio page 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 the Effective Date parameter in the Schedule > Time Attributes section of the Data Studio page in the DataWorks console.

1671608450000

EndEffectDate

integer

No

The timestamp in milliseconds when automatic scheduling stops.

This parameter corresponds to the end time in the Effective Date parameter in the Schedule > Time Attributes section of the Data Studio page in the DataWorks console.

1671694850000

CronExpress

string

No

The cron expression for periodic scheduling. This parameter corresponds to the Cron Expression parameter in the Schedule > Time Attributes section of the Data Studio page in the DataWorks console. After you configure the scheduling cycle and scheduled time, DataWorks automatically generates the corresponding cron expression.

Examples:

  • Schedule a node at 05:30 every day: 00 30 05 * * ?

  • Schedule a node at the 15th minute of every hour: 00 15 00-23/1 * * ?

  • Schedule a node every 10 minutes: 00 00/10 * * * ?

  • Schedule a node every 10 minutes from 08:00 to 17:00 every day: 00 00-59/10 8-17 * * * ?

  • Schedule a node at 00:20 on the first day of every month: 00 20 00 1 * ?

  • Schedule a node every three months starting from 00:10 on January 1: 00 10 00 1 1-12/3 ?

  • Schedule a node at 00:05 every Tuesday and Friday: 00 05 00 * * 2,5

Due to the rules of the DataWorks scheduling system, cron expressions have the following limits:

  • The minimum scheduling interval is 5 minutes.

  • The earliest scheduling time every day is 00:05.

00 05 00 * * ?

CycleType

string

No

The type of the scheduling cycle. Valid values: NOT_DAY (minutes and hours) and DAY (days, weeks, and months).

This parameter corresponds to the Scheduling Cycle parameter in the Schedule > Time Attributes section of the Data Studio page in the DataWorks console.

Valid values:

  • NOT_DAY :

    minutes and hours.

  • DAY :

    days, weeks, and months.

DAY

DependentType

string

No

The dependency on the previous cycle. Valid values:

  • SELF: The node depends on itself.

  • CHILD: The node depends on its level-1 child nodes.

  • USER_DEFINE: The node depends on other nodes.

  • NONE: No dependency is selected, which means the node does not depend on the previous cycle.

  • USER_DEFINE_AND_SELF: The node depends on itself and other nodes across cycles.

  • CHILD_AND_SELF: The node depends on its level-1 child nodes and itself across cycles.

Valid values:

  • CHILD_AND_SELF :

    The node depends on its level-1 child nodes and itself across cycles.

  • USER_DEFINE :

    The node depends on other nodes.

  • SELF :

    The node depends on itself.

  • USER_DEFINE_AND_SELF :

    The node depends on itself and other nodes across cycles.

  • NONE :

    No dependency is selected, which means the node does not depend on the previous cycle.

  • CHILD :

    The node depends on its level-1 child nodes.

NONE

DependentNodeIdList

string

No

If DependentType is set to USER_DEFINE, specify the IDs of the nodes on which this file depends. Separate multiple node IDs with commas (,).

This parameter corresponds to the configured content when you set the Dependency parameter to Cross-Cycle Dependency (formerly Previous Cycle) and select Other Nodes in the Schedule > Scheduling Dependencies Settings of the data development node in the DataWorks console.

abc

InputList

string

Yes

The output names of the upstream files on which the current file depends. Separate multiple output names with commas (,).

This parameter corresponds to the Output Name of Upstream Node parameter in the Schedule > Scheduling Dependencies section of the Data Studio page in the DataWorks console.

project_root,project.file1,project.001_out

OutputList

string

No

The output of the file.

This parameter corresponds to the Output Name of Current Node parameter in the Schedule > Scheduling Dependencies section of the Data Studio page in the DataWorks console.

dw_project.ods_user_info_d

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 specify either this parameter or the ProjectId parameter to determine the DataWorks workspace on which the API operation is performed.

dw_project

ResourceGroupIdentifier

string

No

The resource group used when the task is executed after the file is published as a task. You can log on to the DataWorks console, go to the Workspace Management page, and click Resource Groups in the left-side navigation pane to obtain the ID of the resource group bound to the current workspace.

S_res_group_559_1613715566828

ResourceGroupId deprecated

integer

No

[Deprecated] Do not use this field.

375827434852437

ConnectionName

string

No

The data source connected when the task is executed after the file is published as a task.

You can call the UpdateDataSource operation to obtain the list of available data sources in the workspace.

odps_source

AutoParsing

boolean

No

Specifies whether to enable the automatic parsing feature for the file. Valid values:

  • true: The file automatically parses the code.

  • false: The file does not automatically parse the code.

This parameter corresponds to the Code Parsing parameter in the Schedule > Scheduling Dependencies section of the Data Studio page in the DataWorks console.

true

SchedulerType

string

No

The scheduling type. Valid values:

  • NORMAL: The task is scheduled normally.

  • MANUAL: The task is a manual task and is not scheduled on a daily basis. This corresponds to a node in a manual workflow.

  • PAUSE: The task is paused.

  • SKIP: The task is a dry-run task. It is scheduled on a daily basis, but its status is directly set to successful when the scheduling is triggered.

Valid values:

  • PAUSE :

    The task is paused.

  • SKIP :

    The task is a dry-run task. It is scheduled on a daily basis, but its status is directly set to successful when the scheduling is triggered.

  • MANUAL :

    The task is a manual task and is not scheduled on a daily basis. This corresponds to a node in a manual workflow.

  • NORMAL :

    The task is scheduled normally.

NORMAL

AdvancedSettings

string

No

The advanced settings of the task.

This parameter corresponds to the Advanced Settings section in the right-side navigation pane of the edit page for EMR Spark Streaming and EMR Streaming SQL data development 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"}

StartImmediately

boolean

No

Specifies whether to start the task immediately after it is published.

This parameter corresponds to the Startup Method parameter in the Configuration > Time Attributes section in the right-side navigation pane of the edit page for EMR Spark Streaming and EMR Streaming SQL data development tasks in the DataWorks console.

true

InputParameters

string

No

The context input parameters of the node. The parameter value must be in JSON format. For the included fields, refer to the InputContextParameterList parameter structure in the response of the GetFile operation.

This parameter corresponds to the Input Parameters of Current Node parameter in the Schedule > Node Context Parameters section of the Data Studio page in the DataWorks console.

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

OutputParameters

string

No

The context output parameters of the node. The parameter value must be in JSON format. For the included fields, refer to the OutputContextParameterList parameter structure in the response of the GetFile operation.

This parameter corresponds to the Output Parameters of Current Node parameter in the Schedule > Node Context Parameters section of the Data Studio page in the DataWorks console.

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

IgnoreParentSkipRunningProperty

boolean

No

Specifies whether to inherit the dry-run property from the previous cycle. Valid values:

  • true: Inherit the dry-run property from the previous cycle.

  • false: Do not inherit the dry-run property from the previous cycle.

false

CreateFolderIfNotExists

boolean

No

Specifies whether to create the directory specified by FileFolderPath if it does not exist. Valid values:

  • true: Creates the directory if needed.

  • false: The request fails if the directory does not exist.

false

ApplyScheduleImmediately

boolean

No

Specifies whether the scheduling configuration takes effect immediately after the file is published.

true

Timeout

integer

No

The timeout definition in the scheduling configuration.

1

ImageId

string

No

The ID of the custom image.

m-bp1h4b5a8ogkbll2f3tr

Response elements

Element

Type

Description

Example

object

The response.

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 the ID to troubleshoot issues when an error occurs.

0000-ABCD-EFG

ErrorMessage

string

The error message.

The connection does not exist.

Success

boolean

Indicates whether the call was successful. Valid values:

  • true: The call was successful.

  • false: The call failed.

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.
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.