CreateUdfFile

Updated at:

Creates a function file in Data Studio.

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 folder path of the function file.

Business_process/First_Business_Process/function/string_processing

ProjectId

integer

No

The ID of the DataWorks workspace. Click the Settings icon in the upper-right corner to go to the Workspace Management page and find the ID. Specify at least one of ProjectId or ProjectIdentifier to identify the workspace for this operation.

10000

FileName

string

Yes

The name of the function.

StringConcat

FunctionType

string

Yes

The categorization of the function. This parameter corresponds to the Function Type field in the Create Function form. Valid values: MATH (mathematical operation function), AGGREGATE (aggregate functions for aggregation), STRING (character string processing function), DATE (date processing function), ANALYTIC (window function), and OTHER (other function).

Valid values:

  • OTHER :

    Other functions.

  • DATE :

    Date processing functions.

  • AGGREGATE :

    Aggregate functions.

  • STRING :

    String processing functions.

  • ANALYTIC :

    Window functions.

  • MATH :

    Mathematical operation functions.

STRING

ClassName

string

Yes

The name of the class where the function is defined. This parameter corresponds to the Class Name field in the Create Function dialog box.

com.alibaba.DataWorks.api.udf.StringConcat

Resources

string

Yes

The list of resources referenced by the function. This parameter corresponds to the Resources field in the Create Function dialog box. Separate multiple resource names with commas (,).

string-concat-1.0.0.jar,commons-lang-2.6.jar

UdfDescription

string

Yes

The description of the function purpose. This parameter corresponds to the Description field in the Create Function dialog box.

Concatenate several strings to generate a new string

CmdDescription

string

No

The command format to invoke the function during function calling. This parameter corresponds to the Command Format field in the Create Function form.

StringConcat(String... substrs)

ParameterDescription

string

No

The description of the function input parameters. This parameter corresponds to the parameter description field in the Create Function form.

List of strings to be connected

ReturnValue

string

No

The description of the return value of the function. This parameter corresponds to the Return Value field in the Create Function dialog box.

New strings generated by concatenating all strings before and after the input order

Example

string

No

The example to invoke the function during function calling. This parameter corresponds to the Example field in the Create Function form.

StringConcat('a', 'b', 'c')

ProjectIdentifier

string

No

The unique identifier of the DataWorks workspace. This identifier is displayed when you switch workspaces at the top of the DataStudio page. You must specify at least one of the ProjectId and ProjectIdentifier parameters to determine the workspace for this operation.

dw_project

CreateFolderIfNotExists

boolean

No

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

  • true: Creates the folder if needed.

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

false

Response elements

Element

Type

Description

Example

object

The response.

HttpStatusCode

integer

The HTTP status code.

200

Data

integer

The ID of the created file.

100000002

RequestId

string

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

0000-ABCD-EFG****

ErrorMessage

string

The error message.

The connection does not exist.

Success

boolean

Indicates whether the request is successful. Valid values:

  • true: The request is successful.

  • false: The request fails.

true

ErrorCode

string

The error code.

Invalid.Tenant.ConnectionNotExists

Examples

Success response

JSON format

{
  "HttpStatusCode": 200,
  "Data": 100000002,
  "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.