Creates a file for a function in DataStudio.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
Action | String | Yes | CreateUdfFile | The operation that you want to perform. Set the value to CreateUdfFile. |
FileFolderPath | String | Yes | Workflow/1/Function/String function | The path of the folder in which the file for the function is stored. |
ProjectId | Long | No | 10000 | The DataWorks workspace ID. You can click the Workspace Manage icon in the upper-right corner of the DataStudio page to go to the Work space page and view the workspace ID. |
FileName | String | Yes | StringConcat | The name of the function. |
FunctionType | String | Yes | STRING | The type of the function. Valid values: MATH, AGGREGATE, STRING, DATE, ANALYTIC, and OTHER. This parameter corresponds to the Function Type parameter in the Register Function section of the configuration tab of the function on the DataStudio page. |
ClassName | String | Yes | com.alibaba.DataWorks.api.udf.StringConcat | The name of the class in which the function is defined. This parameter corresponds to the Class Name parameter in the Register Function section of the configuration tab of the function on the DataStudio page. |
Resources | String | Yes | string-concat-1.0.0.jar,commons-lang-2.6.jar | The names of the resources to be referenced by the function. This parameter corresponds to the Resources parameter in the Register Function section of the configuration tab of the function on the DataStudio page. Separate multiple resource names with commas (,). |
UdfDescription | String | Yes | New string that is generated after multiple strings are concatenated | The description of the function. This parameter corresponds to the Description parameter in the Register Function section of the configuration tab of the function on the DataStudio page. |
CmdDescription | String | No | StringConcat(String... substrs) | The syntax used for calling the function. This parameter corresponds to the Expression Syntax parameter in the Register Function section of the configuration tab of the function on the DataStudio page. |
ParameterDescription | String | No | Strings to be concatenated | The description of the input parameters of the function. This parameter corresponds to the Parameter Description parameter in the Register Function section of the configuration tab of the function on the DataStudio page. |
ReturnValue | String | No | New string that is generated after all strings are concatenated in sequence | The description of the return value of the function. This parameter corresponds to the Return Value parameter in the Register Function section of the configuration tab of the function on the DataStudio page. |
Example | String | No | StringConcat('a', 'b', 'c') | The example for calling the function. This parameter corresponds to the Example parameter in the Register Function section of the configuration tab of the function on the DataStudio page. |
ProjectIdentifier | String | No | dw_project | The unique identifier of the DataWorks workspace. You can click the identifier in the upper-left corner of the DataStudio page to switch to another workspace. |
CreateFolderIfNotExists | Boolean | No | false | Specifies whether to automatically create the directory that is specified by the FileFolderPath parameter if the directory does not exist. Valid values: true: The system automatically creates the directory if the directory does not exist. false: The system does not automatically create the directory if the directory does not exist. In this case, the call fails. |
Response parameters
Parameter | Type | Example | Description |
HttpStatusCode | Integer | 200 | The HTTP status code. |
Data | Long | 100000002 | The ID of the file that was created. |
RequestId | String | 0000-ABCD-EFG**** | The request ID. |
ErrorMessage | String | The connection does not exist. | The error message. |
Success | Boolean | true | Indicates whether the request was successful. |
ErrorCode | String | Invalid.Tenant.ConnectionNotExists | The error code. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=CreateUdfFile
&FileFolderPath=Workflow/1/Function/String function
&ProjectId=10000
&FileName=StringConcat
&FunctionType=STRING
&ClassName=com.alibaba.DataWorks.api.udf.StringConcat
&Resources=string-concat-1.0.0.jar,commons-lang-2.6.jar
&UdfDescription=New string that is generated after multiple strings are concatenated
&CmdDescription=StringConcat(String... substrs)
&ParameterDescription=Strings to be concatenated
&ReturnValue=New string that is generated after all strings are concatenated in sequence
&Example=StringConcat('a', 'b', 'c')
&ProjectIdentifier=dw_project
&CreateFolderIfNotExists=false
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateUdfFileResponse>
<RequestId>0000-ABCD-EFG****</RequestId>
<HttpStatusCode>200</HttpStatusCode>
<Data>100000002</Data>
<Success>true</Success>
</CreateUdfFileResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "0000-ABCD-EFG****",
"HttpStatusCode" : 200,
"Data" : 100000002,
"Success" : true
}
Error codes
HTTP status code | Error code | Error message | Description |
429 | Throttling.Api | The request for this resource has exceeded your available limit. | The number of requests for the resource has exceeded the upper limit. |
429 | Throttling.System | The DataWorks system is busy. Try again later. | The DataWorks system is busy. Try again later. |
429 | Throttling.User | Your request is too frequent. Try again later. | 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. | An internal error occurred. Try again later. |
500 | InternalError.UserId.Missing | An internal system error occurred. Try again later. | An internal error occurred. Try again later. |
For a list of error codes, see Service error codes.