GetDataServicePublishedApi

Updated at:

Retrieves the published details of a Data Service API.

Operation description

Before you begin, activate DataWorks Enterprise Edition or Ultimate Edition and prepare a published data service API. You can obtain ProjectId by calling ListProjects, and obtain ApiId from Data.Apis[].ApiId in the response of ListDataServicePublishedApis. If the required edition is not activated, a 403 Forbidden.Access error is returned.

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

ProjectId

integer

Yes

The ID of the workspace.

10002

TenantId

integer

No

The tenant ID. To obtain the tenant ID, log on to the DataWorks console, go to the DataStudio page, click the username in the upper-right corner, and then choose Menu > User Info.

10003

ApiId

integer

Yes

The ID of the API.

10001

Response elements

Element

Type

Description

Example

object

HttpStatusCode

integer

The HTTP status code.

200

RequestId

string

The ID of the request.

0000-ABCD-EFG****

ErrorMessage

string

The error message.

The connection does not exist.

Success

boolean

Indicates whether the call was successful.

true

ErrorCode

string

The error code.

Invalid.Tenant.ConnectionNotExists

Data

object

The latest published information of the API.

Timeout

integer

The timeout period, in milliseconds.

10000

Status

integer

The status of the API. Valid values: 0 (Unpublished) and 1 (Published).

1

ApiId

integer

The ID of the data service API.

10000

ApiMode

integer

The type of the API. Valid values: 0 (Wizard API), 1 (Script API), and 2 (Registered API).

0

ProjectId

integer

The ID of the workspace.

10001

ResponseContentType

integer

The response data type of the API. Valid values: 0 (JSON) and 1 (XML). Wizard and script APIs support JSON. Registered APIs support JSON and XML.

0

CreatorId

string

The Alibaba Cloud ID of the creator.

1234567

VisibleRange

integer

The visibility scope. Valid values: 0 (Workspace) and 1 (Private).

0

ModifiedTime

string

The latest modification time.

The format is yyyy-MM-dd'T'HH:mm:ssZ, such as 2020-06-23T00:21:01+0800. The time zone offset in this example is +0800.

2020-06-23T00:21:01+0800

OperatorId

string

The Alibaba Cloud ID of the last editor.

2345678

GroupId

string

The group ID.

ab12**

Description

string

The description.

Test API description

RequestMethod

integer

The request method of the API. Valid values: 0 (GET), 1 (POST), 2 (PUT), and 3 (DELETE). Wizard and script APIs support GET and POST. Registered APIs support GET, POST, PUT, and DELETE.

0

CreatedTime

string

The creation time.

The format is yyyy-MM-dd'T'HH:mm:ssZ, such as 2020-06-23T00:21:01+0800. The time zone offset in this example is +0800.

2020-06-23T00:21:01+0800

ApiName

string

The name of the API.

Test API name

TenantId

integer

The tenant ID.

10001

ApiPath

string

The path of the API.

/test/1

Protocols

array

The API protocols. This is a multi-value list. Valid values: 0 (HTTP) and 1 (HTTPS).

integer

The API protocols. This is a multi-value list. Valid values: 0 (HTTP) and 1 (HTTPS).

0

RegistrationDetails

object

The details of the registered API. This is returned only for registered APIs.

ServiceHost

string

The backend service address.

http://www.abc.com

ServiceContentType

integer

The response data type of the API. Valid values: 0 (JSON) and 1 (XML). Wizard and script APIs support JSON. Registered APIs support JSON and XML.

0

ServicePath

string

The backend service path.

/index

SuccessfulResultSample

string

The sample success response.

{"success": true}

FailedResultSample

string

The sample error response.

{"success": false}

ServiceRequestBodyDescription

string

The description of the backend request body content.

{"abc":1}

RegistrationErrorCodes

array<object>

The list of error codes for the registered API.

object

ErrorMessage

string

The error message.

The connection does not exist.

ErrorCode

string

The error code.

Invalid.Tenant.ConnectionNotExists

ErrorSolution

string

The solution to the error.

retry

RegistrationRequestParameters

array<object>

The list of request parameters for the registered API.

object

ParameterName

string

The name of the parameter.

name1

ParameterPosition

integer

The position of the parameter. Valid values: 0 (Path), 1 (Query), 2 (Head), and 3 (Body). Wizard and script APIs support only Query. For registered APIs, the GET and DELETE methods support Query and Head, while the PUT and POST methods support Query, Head, and Body.

0

ParameterDescription

string

The description.

description1

DefaultValue

string

The default value.

default1

ParameterOperator

integer

The operator. Valid values: 0 (Equal), 1 (Like), 2 (Const), and 3 (In). Wizard APIs support Equal, Like, and In. Script APIs support Equal. Registered APIs support Equal and Const.

0

ExampleValue

string

The example value.

example1

ParameterDataType

integer

The data type. Valid values:

  • 0: String

  • 1: Int

  • 2: Long

  • 3: Float

  • 4: Double

  • 5: Boolean

  • 6: StringList

  • 7: IntList

  • 8: LongList

  • 9: FloatList

  • 10: DoubleList

  • 11: BooleanList

0

IsRequiredParameter

boolean

Indicates whether the parameter is required.

true

ScriptDetails

object

The details of the script API. This is returned only for script APIs.

IsPagedResponse

boolean

Indicates whether the response is paginated.

true

SuccessfulResultSample

string

The sample success response.

{"success": true}

FailedResultSample

string

The sample error response.

{"success": false}

Script

string

The SQL script.

select a from t

ScriptErrorCodes

array<object>

The list of error codes for the script API.

object

ErrorMessage

string

The error message.

fail to call

ErrorCode

string

The error code.

1001

ErrorSolution

string

The solution to the error.

retry

ScriptRequestParameters

array<object>

The list of request parameters for the script API.

object

ParameterName

string

The name of the parameter.

param1

ParameterPosition

integer

The position of the parameter. Valid values:

  • 0: Path

  • 1: Query

  • 2: Head

  • 3: Body

Wizard and script APIs support only Query. For registered APIs, the GET and DELETE methods support Query and Head, while the PUT and POST methods support Query, Head, and Body.

0

ParameterDescription

string

The description.

description1

DefaultValue

string

The default value.

default1

ParameterOperator

integer

The operator. Valid values:

  • 0: Equal

  • 1: Like

  • 2: Const

  • 3: In

Wizard APIs support Equal, Like, and In. Script APIs support Equal. Registered APIs support Equal and Const.

0

ExampleValue

string

The example value.

example1

ParameterDataType

integer

The data type. Valid values:

  • 0: String

  • 1: Int

  • 2: Long

  • 3: Float

  • 4: Double

  • 5: Boolean

  • 6: StringList

  • 7: IntList

  • 8: LongList

  • 9: FloatList

  • 10: DoubleList

  • 11: BooleanList

0

IsRequiredParameter

boolean

Indicates whether the parameter is required.

true

ScriptResponseParameters

array<object>

The list of response parameters for the script API.

object

ParameterDescription

string

The description.

description2

ParameterName

string

The name of the parameter.

param2

ExampleValue

string

The example value.

example2

ParameterDataType

integer

The data type. Valid values:

  • 0: String

  • 1: Int

  • 2: Long

  • 3: Float

  • 4: Double

  • 5: Boolean

  • 6: StringList

  • 7: IntList

  • 8: LongList

  • 9: FloatList

  • 10: DoubleList

  • 11: BooleanList

0

ScriptConnection

object

The data source information of the script API.

TableName

string

The table name of the data source.

t

ConnectionId

integer

The ID of the data source.

123

WizardDetails

object

The details of the wizard API. This is returned only for wizard APIs.

IsPagedResponse

boolean

Indicates whether the response is paginated.

true

SuccessfulResultSample

string

The sample success response.

{"success": true}

FailedResultSample

string

The sample error response.

{"success": false}

WizardErrorCodes

array<object>

The list of error codes for the wizard API.

object

ErrorMessage

string

The error message.

fail to call

ErrorCode

string

The error code.

1001

ErrorSolution

string

The solution to the error.

retry

WizardRequestParameters

array<object>

The list of request parameters for the wizard API.

object

ParameterName

string

The name of the parameter.

param1

ParameterPosition

integer

The position of the parameter. Valid values: 0 (Path), 1 (Query), 2 (Head), and 3 (Body). Wizard and script APIs support only Query. For registered APIs, the GET and DELETE methods support Query and Head, while the PUT and POST methods support Query, Head, and Body.

0

ParameterDescription

string

The description.

description1

DefaultValue

string

The default value.

default1

ParameterOperator

integer

The operator. Valid values: 0 (Equal), 1 (Like), 2 (Const), and 3 (In). Wizard APIs support Equal, Like, and In. Script APIs support Equal. Registered APIs support Equal and Const.

0

ExampleValue

string

The example value.

example1

ParameterDataType

integer

The data type. Valid values:

  • 0: String

  • 1: Int

  • 2: Long

  • 3: Float

  • 4: Double

  • 5: Boolean

  • 6: StringList

  • 7: IntList

  • 8: LongList

  • 9: FloatList

  • 10: DoubleList

  • 11: BooleanList

0

IsRequiredParameter

boolean

Indicates whether the parameter is required.

true

WizardResponseParameters

array<object>

The list of response parameters for the wizard API.

object

A response parameter for a wizard API.

ParameterDescription

string

The description.

description2

ParameterName

string

The name of the parameter.

param2

ExampleValue

string

The example value.

example2

ParameterDataType

integer

The data type. Valid values:

  • 0: String

  • 1: Int

  • 2: Long

  • 3: Float

  • 4: Double

  • 5: Boolean

  • 6: StringList

  • 7: IntList

  • 8: LongList

  • 9: FloatList

  • 10: DoubleList

  • 11: BooleanList

0

WizardConnection

object

The data source information for the wizard API.

TableName

string

The table name of the data source.

t

ConnectionId

integer

The ID of the data source.

123

SqlMode

integer

The SQL mode. Valid values: 0: Basic SQL. 1: Advanced SQL.

0

ApigwVersion

integer

The gateway version. Valid values: 1: API Gateway. 2: Cloud-native API gateway.

1

CloudNativeApiGwAuthType

integer

The security authentication method for the cloud-native API gateway. Valid values: 1: No authentication. 2: ApiKey. 3: JWT. 4: HMAC.

1

The details for each API type are returned in a separate field. WizardDetails contains details for wizard APIs, ScriptDetails for script APIs, and RegistrationDetails for registered APIs.

Examples

Success response

JSON format

{
  "HttpStatusCode": 200,
  "RequestId": "0000-ABCD-EFG****",
  "ErrorMessage": "The connection does not exist.",
  "Success": true,
  "ErrorCode": "Invalid.Tenant.ConnectionNotExists",
  "Data": {
    "Timeout": 10000,
    "Status": 1,
    "ApiId": 10000,
    "ApiMode": 0,
    "ProjectId": 10001,
    "ResponseContentType": 0,
    "CreatorId": "1234567",
    "VisibleRange": 0,
    "ModifiedTime": "2020-06-23T00:21:01+0800",
    "OperatorId": "2345678",
    "GroupId": "ab12**",
    "Description": "Test API description",
    "RequestMethod": 0,
    "CreatedTime": "2020-06-23T00:21:01+0800",
    "ApiName": "Test API name",
    "TenantId": 10001,
    "ApiPath": "/test/1",
    "Protocols": [
      0
    ],
    "RegistrationDetails": {
      "ServiceHost": "http://www.abc.com",
      "ServiceContentType": 0,
      "ServicePath": "/index",
      "SuccessfulResultSample": "{\"success\": true}",
      "FailedResultSample": "{\"success\": false}",
      "ServiceRequestBodyDescription": "{\"abc\":1}",
      "RegistrationErrorCodes": [
        {
          "ErrorMessage": "The connection does not exist.",
          "ErrorCode": "Invalid.Tenant.ConnectionNotExists",
          "ErrorSolution": "retry"
        }
      ],
      "RegistrationRequestParameters": [
        {
          "ParameterName": "name1",
          "ParameterPosition": 0,
          "ParameterDescription": "description1",
          "DefaultValue": "default1",
          "ParameterOperator": 0,
          "ExampleValue": "example1",
          "ParameterDataType": 0,
          "IsRequiredParameter": true
        }
      ]
    },
    "ScriptDetails": {
      "IsPagedResponse": true,
      "SuccessfulResultSample": "{\"success\": true}",
      "FailedResultSample": "{\"success\": false}",
      "Script": "select a from t",
      "ScriptErrorCodes": [
        {
          "ErrorMessage": "fail to call",
          "ErrorCode": "1001",
          "ErrorSolution": "retry"
        }
      ],
      "ScriptRequestParameters": [
        {
          "ParameterName": "param1",
          "ParameterPosition": 0,
          "ParameterDescription": "description1",
          "DefaultValue": "default1",
          "ParameterOperator": 0,
          "ExampleValue": "example1",
          "ParameterDataType": 0,
          "IsRequiredParameter": true
        }
      ],
      "ScriptResponseParameters": [
        {
          "ParameterDescription": "description2",
          "ParameterName": "param2",
          "ExampleValue": "example2",
          "ParameterDataType": 0
        }
      ],
      "ScriptConnection": {
        "TableName": "t",
        "ConnectionId": 123
      }
    },
    "WizardDetails": {
      "IsPagedResponse": true,
      "SuccessfulResultSample": "{\"success\": true}",
      "FailedResultSample": "{\"success\": false}",
      "WizardErrorCodes": [
        {
          "ErrorMessage": "fail to call",
          "ErrorCode": "1001",
          "ErrorSolution": "retry"
        }
      ],
      "WizardRequestParameters": [
        {
          "ParameterName": "param1",
          "ParameterPosition": 0,
          "ParameterDescription": "description1",
          "DefaultValue": "default1",
          "ParameterOperator": 0,
          "ExampleValue": "example1",
          "ParameterDataType": 0,
          "IsRequiredParameter": true
        }
      ],
      "WizardResponseParameters": [
        {
          "ParameterDescription": "description2",
          "ParameterName": "param2",
          "ExampleValue": "example2",
          "ParameterDataType": 0
        }
      ],
      "WizardConnection": {
        "TableName": "t",
        "ConnectionId": 123
      }
    },
    "SqlMode": 0,
    "ApigwVersion": 1,
    "CloudNativeApiGwAuthType": 1
  }
}

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.