All Products
Search
Document Center

Dataphin:Test and publish API

Last Updated:Nov 18, 2025

Users can query and request permissions to call an API in the DataService Studio marketplace only after the API has been tested and published to the marketplace. This topic describes how to test an API and publish it to the DataService Studio marketplace.

Prerequisites

You need to create an API before you begin. For more information, see Create an API.

Description of API call/test direct connection mode and proxy mode

DataService Studio supports direct connection mode and proxy mode for calling APIs. If an API is associated with row-level permissions, the authentication method is determined by the calling mode.

  • Direct connection mode: Apply for row-level permissions for the DataService Studio application in row-level permissions, and use the application for authentication.

  • Proxy mode: If an application needs to call an API with a user's row-level permissions, you need to apply for row-level permissions for the DataService Studio application in row-level permissions, and then apply for proxy permissions for the API for the application, which allows it to call the API on behalf of the user.

Note
  • API permission control is divided into field-level permissions and row-level permissions. The authentication modes for row-level permissions include direct connection mode and proxy mode.

  • If an API is associated with row-level permissions and the application has proxy permissions, when the DelegationUid parameter is not set or empty, the direct connection mode is used to call the API. When DelegationUid is not empty, the proxy mode is used to call the API.

Operations in the top area of the API test page

  • View Domain Name: You can view the domain name at the top of the page. This domain name is used only for internal testing. For the domain name used for client calls, see View domain name.

  • Switch API: You can switch to view submitted or published APIs in the upper-left corner of the page. You can search for APIs by name or ID using fuzzy search, and switch to APIs that you have permissions to access in the current service project. The system recommends the nine most recent APIs that you have accessed (including viewing, editing, testing, and adding) in the current project.

  • Switch API Runtime Environment: You can switch the API runtime environment for API testing. When the runtime environment is the development environment, the development data source is used for testing. When the runtime environment is the production environment, the production data source is used for testing. If the API is not published, you cannot switch to the production environment for testing.

    Note

    If the API is in Basic mode and the runtime environment is the development environment, the production data source is used for testing the API.

  • Switch API Version: You can switch versions for testing in the upper-right corner of the test page. When the runtime environment is the development environment, you can select a submitted version. When the runtime environment is the production environment, you can select a published version.

Step 1: Test the API

  1. On the Dataphin home page, choose Service > API Development from the top menu bar.

  2. Select a service project in the upper-left corner, and then choose API Service > API in the navigation pane on the left to go to the API page.

    • On the API page, click the Test icon in the Actions column of the target API to go to the API test page.

    • On the API page, click More-Version Management in the Actions column of the target API to open the Version Management panel, and then click Test in the operation column of the target API to go to the API test page.

  3. On the API Test page, you can enter parameter values to verify whether the returned parameters meet your expectations.

    1. Configure the parameters in the Business Request Parameter List section.

      • If the operation type is GET or LIST, set the Test Input Value to the field values from your business data. The parameters listed are the request parameters that you configured when you created the API.

      • If the operation type is Create, Update, or Delete, the fields listed are the request parameters that you configured when you created the API. You can add, copy, or delete parameters as described below.

        • Add Parameter Item: Click Add Parameter Item and enter parameter values as prompted. You can add data entries up to the maximum input limit of the API.

        • Batch Add: Click Batch Add. In the Batch Add Business Request Parameters dialog box, enter parameter instance values. Separate each parameter set with a new line. You can specify separators and text qualifiers for the parameters.

          • Separator: The character used to separate fields. You can use a comma (,), semicolon (;), vertical bar (|), tab character (\t), or a custom separator. Custom separators can contain multiple characters.

          • Text Qualifier: The character used to enclose text fields. The supported options are None, double quotation marks (""), and single quotation marks ('').

        • Full Screen Input: Click Full Screen Input. Then, click Add 1 Parameter Item Row, Add 5 Parameter Item Rows, or Add 10 Parameter Item Rows at the bottom of the page to quickly add rows.

        • Copy: Click the Copy icon in the Actions column. The system clones the parameter values of the current row and adds them as a new row at the bottom of the list.

        • Delete: Click the Delete icon in the Actions column to delete a single row. To delete multiple rows, select the parameters from the list and click Batch Delete at the bottom.

    2. Configure the parameters in the Common Request Parameter List section.

      • If the API is a direct connection data source API (query type) or a service unit API, the system displays parameters, such as PageStart, PageSize, and OrderByList, based on the API request method.

        • If paged query is enabled and the API operation type is LIST, the PageStart, PageSize, and OrderByList parameters are displayed. If the API operation type is GET, the OrderByList parameter is displayed.

        • If paged query is disabled and the API operation type is LIST, the OrderByList parameter is displayed. You can clear the Hide Parameters checkbox to display the PageSize and OrderByList parameters.

      • If the API is a direct connection data source API (query type), a service unit API, or a composite API, and associated row-level permissions are enabled, the AccountType and DelegationUid parameters are displayed.

      • If the API is a direct connection data source API (operation type), only the ApiVersion parameter is displayed.

        Note

        When you test an API, the input parameter cannot exceed 1,000 characters. If you call the API directly, there is no character limit.

        Parameter

        Description

        Test input value

        AccountType

        When using proxy mode authentication, you need to specify the account type of the proxy user.

        • ACCOUNT_NAME: Dataphin username.

        • USER_ID: Dataphin internal unique ID.

        • SOURCE_USER_ID: Source system account ID.

        Note

        This parameter needs to be configured only when DelegationUid is set. If this parameter is not filled in, the default type is USER_ID.

        Select the account type of the proxy user. You can select ACCOUNT_NAME, USER_ID, or SOURCE_USER_ID.

        DelegationUid

        The user being proxied for access. You need to pass in the corresponding account ID based on the selected AccountType. After setting this parameter, the proxy mode authentication method is used.

        Only the current tenant account is supported as DelegationUid.

        ApiVersion

        Specifies the version of the API to call. The latest version is used by default.

        The test input value is obtained by switching versions in the upper-right corner of the page.

        Note

        When the runtime environment is the development environment, the apiVersion parameter is supported, and you can only select submitted APIs for calling.

        PageStart

        Defines which record to start displaying the returned data from.

        Configure a positive integer, such as 2.

        PageSize

        Defines how many records to return per page.

        Configure a positive integer, such as 56.

        OrderByList

        Defines the sorting method for multiple returned parameters. If not specified, ascending order is used by default.

        The test input value needs to be obtained from the Business Request Parameter List.

        ReturnTotalNum

        Specifies whether to return the total number of rows in the result. If you set ReturnTotalNum=true, the total number of rows is returned. This may affect performance.

        This parameter is displayed if the API operation type is List and paged query is enabled.

        Set this parameter to a positive integer, such as 1000.

    3. If the API is a direct connection data source API (query type), a service unit API, or a composite API, and associated row-level permissions are enabled, the Row-Level Permission List section displays information about the enabled row-level permissions associated with the current API version and environment. This information includes the row-level permission name and description.

    4. In the Optional Return Parameter List section, select the return parameters. The list of return parameters corresponds to the API return parameters of the selected API version.

      • If the operation type is GET or LIST, you must select at least one return parameter to test the API.

      • If the operation type is Create, Update, or Delete, all parameters are selected by default and cannot be deselected.

    5. Configure the protocol and return count for the API.

      Parameter

      Description

      Protocol

      If you configured the API to support both HTTP and HTTPS, you can select which protocol to use for the test.

      Return Count

      Specifies the number of records to return when you test the API:

      • If the request method is LIST, you can select Return Count to return up to 10,000 records.

      • You cannot modify Return Count for GET requests.

  4. After the configuration is complete, click Debug/Test after the return count to test the connectivity between the API and the data source data.

    • When you test the API, you can click View Script to view the SQL script. This helps you check whether the query results match the script's expectations.

      Note
      • You cannot view the script if the registered API or model API does not have a script.

      • When you call a composite API, if a referenced API has row-level permission controls, you must pass the AccountType and DelegationUid parameters to the referenced API.

      • To call a combination API using proxy mode, you only need to apply for proxy permissions for the combination API.

    • If the API call mode is asynchronous mode, after the API is tested/debugged, the query results will be displayed in the test results area. You can view your execution results, logs, code, and other information in the test results. For the asynchronous query process, see Asynchronous invocation process description.

      • View request results: Click the Call API tab, then click the Return Result tab to view the request results returned in the API call body.

      • Script code: Click the Call API tab, then click the Script Code tab to view the written SQL statement.

      • View logs: Click the Get Query Status tab to view the execution logs of the API call. To cancel the API test/debug, you can click Cancel Query to cancel the query request.

      • View query results: Click the Get Query Results tab to view the final query results returned in the API call body.

  5. In the Return Result/Test Result section, view the test results.

    If the test fails, you can refer to Appendix: Error codes and solutions.

  6. This operation is supported only when testing the API. Click the API Authorization button at the bottom to authorize the API to applications. For more information, see DataService Studio permission management.

Step 2: Publish the API

Publish a single API

  1. On the API list page, click the Publish icon in the operation column of the target API.

  2. In the API Publish dialog box, select the version to be published.

    If the API has an online version, the system will check for parameter changes and dependencies to determine whether the publication control mechanism set in the project is triggered. You can perform Go To Revoke and Go To View operations on the target API.

    • Go To Revoke: Click Go To Revoke to navigate to Management Hub > Permission Management > DataService Studio Permissions (under Permission Management) > API Permissions tab. In the current API permission revocation dialog box, you can revoke the permissions for this API.

    • Go To View: Click Go To View to navigate to Service > Development > API page. The system will filter out the current API for you, and you can edit the combination API to remove references to this combination API or delete the combination API.

      If you do not have permission for the combination API, you can contact the owner of the combination API to edit it to remove references to this API or delete the combination API.

      Note
      • Only super administrators and project administrators of DataService Studio can revoke API permissions.

      • If there is already a published version online, the system will check the parameters during the process of publishing a new version online, including adding required request parameters, removing request parameters, removing return parameters, and changing the data type of request parameters. If any of these changes exist, the API publication will be blocked or allowed according to the publication control mechanism set in the project.

        • If the API is authorized to applications setting in the API publication control is set to Block Publication, you need to revoke the API permissions to continue publishing.

        • If the API is referenced by combination APIs setting in the publication control is set to Block Publication, you need to edit the combination API to remove references to this API or delete the combination API to continue publishing.

        • If both configuration items in the publication control are set to block publication, you need to both revoke the API permissions and edit the combination API to remove references to this API or delete the combination API to continue publishing.

  3. Click Confirm to publish the API to the production environment.

Batch publish APIs

  1. On the API list page, select the APIs to be published from the API list, and click Batch Publish at the bottom.

  2. In the API Batch Publish dialog box, select the version to be published. If the latest version of the API is a submitted version, the system will fill in this version for you by default.

  3. Click Confirm. In the API Batch Publish Details dialog box, check whether the API has been published successfully. If the publication fails, you can click View after the error details reason to see the specific failure reason.

    Note
    • APIs created based on logical tables do not support batch publishing.

    • During batch publishing, if no version is selected, the API will not be published.

After this, business application users can query and request permissions to call the API in the DataService Studio overview page.

Note
  • Only submitted APIs can be published online.

  • Publishing a new version online will affect API calls. You can set different publication control mechanisms in the project. During API publication, the system will block or allow publication according to the configuration of the project to which the API belongs. For more information, see Create service projects.

  • For APIs created based on service units, the system checks whether the referenced fields exist in the service unit during publication. For APIs created based on data sources, the system checks whether the referenced fields exist in the data source during publication.

  • When the DataService Studio high availability module is enabled, for APIs created based on data sources, the system does not check whether the backup link's data source and the tables or fields referenced in that data source exist during publication.

Appendix: Error codes and solutions

Error code

Description

Solution

DPN-OLTP-COMMON-000

Success.

None.

DPN.Oltp.Common.Running

Running

None.

DPN-OLTP-COMMON-001

An unknown error occurred in the system.

Submit a ticket, or contact Dataphin support personnel for assistance.

DPN-OLTP-COMMON-002

A parameter exception occurred.

Check the correctness of the parameters.

DPN-OLTP-COMMON-003

Not supported.

None.

DPN-OLTP-COMMON-004

SQL parsing exception.

Field aliases are not defined in the SQL statement. Check and modify the SQL statement.

DPN-OLTP-COMMON-005

SQL injection check failed.

/

DPN-OLTP-ENGINE-000

Query timeout.

/

DPN-OLTP-ENGINE-001

Parameter error.

Check the configured parameters.

DPN-OLTP-ENGINE-002

Object not found.

Submit a ticket, or contact Dataphin support personnel for assistance.

DPN-OLTP-ENGINE-003

Not supported.

None.

DPN-OLTP-ENGINE-004

Communication table error.

None.

DPN-OLTP-ENGINE-005

SQL parsing failed.

Submit a ticket, or contact Dataphin support personnel for assistance.

DPN-OLTP-ENGINE-006

Metadata error.

DPN-OLTP-ENGINE-007

Parameter processing error.

DPN-OLTP-ENGINE-008

Error building execution model.

DPN-OLTP-ENGINE-009

Execution failed.

DPN-OLTP-ENGINE-010

Data source error.

DPN-OLTP-ENGINE-011

HBase engine not supported.

None.

DPN-OLTP-ENGINE-012

Object serialization failed.

Submit a ticket, or contact Dataphin support personnel for assistance.

DPN-OLTP-ENGINE-013

Permission verification failed.

Apply for permissions to the data table. For specific operations, see Apply for, renew, and return table permissions.

If the issue persists after obtaining the corresponding data table permissions, submit a ticket, or contact Dataphin support personnel for assistance.

DPN-OLTP-ENGINE-014

Elasticsearch engine not supported.

None.

DPN-OLTP-ENGINE-015

MongoDB engine not supported.

None.

DPN-OLTP-ENGINE-016

Field type error.

Check if the configured field type is inconsistent with the field type in the data source.

DPN-OLTP-ENGINE-017

Redis cache exception.

Submit a ticket, or contact Dataphin support personnel for assistance.

DPN-OLTP-ENGINE-018

Cross-data source not supported.

None.

DPN-OLTP-ENGINE-019

Data type encoding or parameter type conversion failed.

Submit a ticket, or contact Dataphin support personnel for assistance.

DPN-OLTP-ENGINE-20

Circuit breaker.

DPN-OLTP-ENGINE-020

Permissions for the row-level permission proxy of an API-less application.

Apply for API proxy permissions. For more information, see Manage API permissions.

DPN-OLTP-ENGINE-21

Rate limiting.

You can configure API rate limiting to reduce request concurrency.

DPN-OLTP-ENGINE-22

Query timeout.

/

DPN-OLTP-ENGINE-23

Sub-API exception in combination API.

/

DPN-OLTP-ENGINE-24

No proxy permission.

/

DPN-OLTP-ENGINE-018-01

Cross-data source does not support Group By.

Check the SQL.

DPN-OLTP-ENGINE-018-02

Cross-data source does not support Order By.

DPN-OLTP-ENGINE-018-03

Cross-data source does not support queries without Where conditions.

DPN-OLTP-ENGINE-018-04

Cross-data source does not support PageStart not equal to 0.

DPN-OLTP-ENGINE-018-05

Cross-data source does not support OR operations in Where conditions.

DPN-OLTP-ENGINE-018-06

Cross-data source does not support fields from multiple physical tables in a single Select item.

DPN-OLTP-ENGINE-018-07

Cross-data source queries must include all primary keys.

DPN-OLTP-ENGINE-018-08

HBase namespace does not exist.

/

DPN.Oltp.Auth

Permission verification failed.

/

DPN.Oltp.Async.JobNotExists

Asynchronous API task does not exist.

/

DPN.Oltp.Async.JobStatusNotSupport

Asynchronous API task status does not support this operation.

/

DPN.Oltp.Async.GetResultError

Failed to get results from asynchronous API.

/

DPN.Oltp.Oltp.JsonContentParseError

JSON content parsing failed.

/

DPN.Oltp.Oltp.HttpRequestError

HTTP request failed.

/

DPN-OLTP-JDBC-001

Session missing from request header.

Check if the configured parameters are correct.

DPN-OLTP-JDBC-002

Session error.

Check if the Session ID and Account ID match. If they match, submit a ticket, or contact Dataphin support personnel for assistance.

DPN-OLTP-JDBC-003

User has no permission to access the database.

Apply for data source permissions. For specific operations, see Apply for data source permissions.

If the issue persists after obtaining the corresponding data table permissions, submit a ticket, or contact Dataphin support personnel for assistance.

DPN-OLTP-JDBC-004

User has no permission to access the data table.

Apply for data table permissions. For specific operations, see Apply for, renew, and return table permissions.

If the issue persists after obtaining the corresponding data table permissions, submit a ticket, or contact Dataphin support personnel for assistance.

DPN-OLTP-JDBC-005

Account Id error

Check the correctness of the Account ID.

DPN-OLTP-JDBC-006

Query terminated.

None.

DPN.Oltp.Jdbc.ProjectForbidden

No permission to modify tables in this project.

Apply for data table permissions. For specific operations, see Apply for, renew, and return table permissions.

If the issue persists after obtaining the corresponding data table permissions, submit a ticket, or contact Dataphin support personnel for assistance.

DPN-OLTP-OLAP-001

OLAP client failed to query data source.

Check the data source and try reconnecting the client. If it still fails, submit a ticket, or contact Dataphin support personnel for assistance.

DPN-OLTP-OLAP-002

OLAP client execution failed.

Submit a ticket, or contact Dataphin support personnel for assistance.

DPN.Oltp.Olap.SessionError

OLAP Session error.

Check the correctness of the Session.

DPN.Oltp.Olap.SessionNotFound

OLAP Session does not exist.

/

What to do next

After testing and publishing the API, you can query and request permissions to call it in the DataService Studio marketplace. For specific operations, see Call an API.