CreateDataServiceApi

Updated at:

Creates a Data Service API.

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

TenantId

integer

No

The tenant ID.

10001

ProjectId

integer

Yes

The workspace ID.

10000

ApiName

string

Yes

The name of the API. The name can contain Chinese characters, English letters, digits, and underscores (_), and must start with an English letter or a Chinese character. The name must be 4 to 50 characters in length.

Test API name

GroupId

string

Yes

The ID of the business flow.

Business process ID

ApiMode

integer

Yes

The type of the API. Valid values:

  • 0: wizard API

  • 1: script API

  • 2: registered API

0

RequestMethod

integer

Yes

The request method of the API. Valid values:

  • 0: GET

  • 1: POST

  • 2: PUT

  • 3: DELETE Wizard and script APIs support GET and POST. Registered APIs support GET, POST, PUT, and DELETE.

0

ResponseContentType

integer

Yes

The response data type of the API. Valid values:

  • 0: JSON

  • 1: XML Wizard and script APIs support JSON. Registered APIs support JSON and XML.

0

Timeout

integer

Yes

The timeout period in milliseconds. Valid values: (0, 30000].

10000

VisibleRange

integer

Yes

The visibility scope. Valid values:

  • 0: workspace

  • 1: private

0

Protocols

string

Yes

The protocol of the API. Valid values:

  • 0: HTTP

  • 1: HTTPS Multiple values are supported. Separate multiple values with commas (,).

0,1

WizardDetails

string

No

The details of the wizard API. For more information, see the JSON string of the wizardDetails field in the GetDataServiceApi operation.

{"isPagedResponse":true,"wizardConnection":{"connectionId":122786,"tableName":"person"},"wizardRequestParameters":[{"columnName":"id","defaultValue":"","exampleValue":"1","isRequiredParameter":true,"parameterDataType":2,"parameterDescription":"","parameterName":"id","parameterOperator":0,"parameterPosition":0}],"wizardResponseParameters":[{"columnName":"id","exampleValue":"11","parameterDataType":2,"parameterDescription":"","parameterName":"id"}]}

ScriptDetails

string

No

The details of the script API. For more information, see the JSON string of the scriptDetails field in the GetDataServiceApi operation.

{"isPagedResponse":false,"script":"select id as id1, name as name1 from person where id=${inputid}","scriptConnection":{"connectionId":122786,"tableName":"person"},"scriptRequestParameters":[{"defaultValue":"","exampleValue":"","isRequiredParameter":true,"parameterDataType":0,"parameterDescription":"","parameterName":"inputid","parameterOperator":0,"parameterPosition":1}],"scriptResponseParameters":[{"exampleValue":"","parameterDataType":0,"parameterDescription":"","parameterName":"id1"},{"exampleValue":"","parameterDataType":0,"parameterDescription":"","parameterName":"name1"}]}

RegistrationDetails

string

No

The details of the registered API. For more information, see the JSON string of the registrationDetails field in the GetDataServiceApi operation.

{"failedResultSample":"fail","registrationErrorCodes":[{"errorCode":"e1","errorMessage":"msg1","errorSolution":"sol1"},{"errorCode":"e2","errorMessage":"msg2","errorSolution":"sol2"}],"registrationRequestParameters":[{"columnName":"","defaultValue":"","exampleValue":"","isRequiredParameter":true,"parameterDataType":0,"parameterDescription":"","parameterName":"id","parameterOperator":0,"parameterPosition":1},{"columnName":"","defaultValue":"xx","exampleValue":"","isRequiredParameter":true,"parameterDataType":0,"parameterDescription":"","parameterName":"cc","parameterOperator":2,"parameterPosition":2}],"serviceContentType":1,"serviceHost":"http://www.baidu.com","servicePath":"/[uid]","serviceRequestBodyDescription":"body","successfulResultSample":"success"}

ApiPath

string

Yes

The path of the API. The path can contain English letters, digits, underscores (_), and hyphens (-), and must start with a forward slash (/). The path cannot exceed 200 characters in length.

/test/1

ApiDescription

string

Yes

The description of the API.

Test API description

FolderId

integer

No

The ID of the destination folder where the API is created. The ID of the root folder under a business flow is 0. The ID of a user-created folder is greater than 0.

0

SqlMode

integer

No

The SQL mode. Valid values:

  • 0: basic mode

  • 1: MyBatis

0

ResourceGroupId

integer

No

The ID of the exclusive resource group.

3242432423

RequestContentType

integer

No

The request data type. Valid values:

  • 0: XML

  • 1: JSON

  • 2: form

Valid values:

  • 0 :

    xml

  • 1 :

    json

  • 2 :

    form

0

CloudNativeApiGwAuthType

integer

No

Only applicable to cloud-native groups. Valid values:

  • 1: no authentication

  • 2: ApiKey

  • 3: JWT. It is mapped to the gateway JWT upon publishing, and the JWT identity is configured by the caller in the gateway.

  • 4: HMAC Other values are invalid.

1

Response elements

Element

Type

Description

Example

object

The response data structure.

HttpStatusCode

integer

The HTTP status code.

200

Data

integer

The ID of the created API.

100003

ErrorMessage

string

The error message.

The connection does not exist.

RequestId

string

The request ID.

0000-ABCD-EFG****

ErrorCode

string

The error code.

Invalid.Tenant.ConnectionNotExists

Success

boolean

Indicates whether the call was successful.

true

Examples

Success response

JSON format

{
  "HttpStatusCode": 200,
  "Data": 100003,
  "ErrorMessage": "The connection does not exist.",
  "RequestId": "0000-ABCD-EFG****",
  "ErrorCode": "Invalid.Tenant.ConnectionNotExists",
  "Success": true
}

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.