Creates a file for a function in Data Analytics.


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 CreateUdfFile

The operation that you want to perform.

ClassName String Yes

The name of the class where a function is defined.

FileFolderPath String Yes Workflow /first workflow /function /string processing function

The path to the folder where function files are located.

FileName String Yes StringConcat

The name of the function.

FunctionType String Yes STRING

Function of classification corresponding to the created function form functions in the type A, including MATH (mathematical operation function), AGGREGATE (AGGREGATE functions), STRING (STRING-handling functions, DATE, processing function), ANALYTIC (window function) and the OTHER (function)

ProjectId Long Yes 10000

Dataworks workspace ID and click the workspace manage icon in the upper-right corner to view the workspace information.

RegionId String Yes cn-zhangjiakou

The list of regions where the services are located.

Resources String Yes string-concat-1.0.0.jar,commons-lang-2.6.jar

The list of resource name referenced by the function, which corresponds to the resource list in the created table. Separate multiple resource names with commas (,).

UdfDescription String Yes Concatenates several strings to generate a new string.

The description of the function.

CmdDescription String No StringConcat(String... substrs)

The command format of the function call, which is corresponding to the command format in the CREATE FUNCTION form.

ParameterDescription String No The list of strings to connect.

The description of the input parameters of the function, which is the same as the parameter description in the CREATE FUNCTION form.

ReturnValue String No A new string generated by concatenating all strings before and after each input string.

The return values of the function, which correspond to the return values in the form when the function is created.

Example String No StringConcat('a', 'b', 'c')

For more information about the function call example, see the "create a function" section in create a function.

ProjectIdentifier String No dw_project

Dataworks unique identifier of the workspace, that is, the name of the workspace at the top of the data Development page.

You must specify either this parameter or the projectId parameter to determine the Dataworks workspace for the current API call.

Response parameters

Parameter Type Example Description
Data Long 100000002

The ID of the file after it is created.

ErrorCode String Invalid.Tenant.ConnectionNotExists

The error code.

ErrorMessage String The connection does not exist.

The error message.

HttpStatusCode Integer 200

The HTTP status code.

RequestId String 0000-ABCD-EFG****

The unique ID of the call. You can use the error ID to troubleshoot the error.

Success Boolean true

Indicates whether the request was successful.


Sample requests

     http(s)://[Endpoint]/? Action=CreateUdfFile & dataworks .api.udf.StringConcat &FileFolderPath= workflow /first workflow /function /STRING handler function&FileName=StringConcat &FunctionType=STRING &ProjectId=10000 &RegionId=cn-zhangjiakou &Resources=string-concat-1.0.0.jar,commons-lang-2.6.jar &UdfDescription=concatenate several strings to generate a new STRING&<common request parameters> 

Sample success responses

XML format

     <RequestId>0000-ABCD-EFG****</RequestId> <HttpStatusCode>200</HttpStatusCode> <Data>100000002</Data> <Success>true</Success> 

JSON Format

     { "RequestId": "0000-ABCD-EFG****", "HttpStatusCode": 200, "Data": 100000002, "Success": true } 

Error codes

HttpCode Error codes Error message Description
403 Forbidden.Access Access is forbidden. Activate DataWorks first. You have restricted access. Please activate DataWorks Enterprise Edition or above.
500 InternalError.System An internal system error occurred. Try again later. An internal system error occurred. Please try again later.
500 InternalError.UserId.Missing An internal system error occurred. Try again later. An internal system error occurred. Please try again later.
403 ResourceNotAuthorized.Api You are not authorized to access the resources. You cannot access resources without authorization.
429 Throttling.Api The request for this resource has exceeded your available limit. The request for the resource exceeds your available upper limit.
429 Throttling.System The DataWorks system is busy. Try again later. DataWorks the system is busy, please try again later.
429 Throttling.User Your request is too frequent. Try again later. Your request is too frequent, please try to slow down the request speed.

Go to the Error Center For more information, see error codes.