All Products
Search
Document Center

Dataphin:Test and publish API

Last Updated:Jan 23, 2025

To query and request call permissions for a developed API in DataService Studio, it must first be tested and published. This topic outlines the steps for testing and publishing your API to DataService Studio.

Prerequisites

Ensure that you have created the API before starting the operation. For more information, see Create API.

Operations at the top area of the API test page

  • View Domain Name: The domain name displayed at the top of the page is for internal testing purposes only. To view the domain name intended for client calls, refer to View domain name.

  • Switch API: In the upper left corner of the page, you can switch between submitted and published APIs. Utilize the fuzzy search feature based on the API name or ID to access APIs within the current service project. The system will suggest the last nine APIs you've interacted with in the project.

  • Switch API Runtime Environment: Change the API runtime environment for testing purposes. Use the development data source when in the development environment and the production data source when in the production environment. If the API is not published, it cannot be tested in the production environment.

    Note

    Note: If the API is in Basic mode and the runtime environment is set to development, the production data source will be used for testing.

  • Switch API Version: In the upper right corner of the test page, you can switch between API versions for testing. Select the submitted version in the development environment and the published version in the production environment.

Step 1: Test the API

  1. Navigate to Service > Development from the top menu bar of the Dataphin home page.

  2. Select the service project in the upper left corner and choose API Service > API from the left-side navigation pane to access the API page.

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

    • Click More-Version Management in the Actions column of the target API to access the Version Management panel. Then click Test in the operation column of the target API to enter the API test page.

  3. On the API Test page, input parameter values to verify if the returned parameters meet expectations.

    1. Configure the Test Input Value in the Business Request Parameter List as the field value in the business data.

      The parameters in the Business Request Parameter List are those you configured when creating the API.

    2. Set the parameters in the Public Request Parameter List.

      Parameters found in the Public Request Parameter List include PageStart, PageSize, and OrderByList, which may differ based on the API request method.

      • Enable paged query. For LIST request methods, PageStart, PageSize, and OrderByList parameters are displayed. For GET requests, only the OrderByList parameter appears.

      • Disable paged query. For LIST request methods, only the OrderByList parameter is shown. You can unhide Hidden Parameters to display PageSize and OrderByList. For GET requests, OrderByList is displayed.

        Parameter

        Description

        Debug Input Value

        apiVersion

        Specifies the version of the API to be called. By default, the latest version is used.

        The debug input value is obtained by switching versions at the top right of the page.

        Note

        In the development environment, the apiVersion parameter is supported. Only submitted APIs can be selected for calling.

        PageStart

        Defines the starting point of the returned data.

        Set as a positive integer, such as 2.

        PageSize

        Defines the number of data entries returned per page.

        Set as a positive integer, such as 56.

        OrderByList

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

        The debug input value must be obtained from the Business Request Parameter List.

    3. Choose at least one return parameter from the Optional Return Parameter List section. This list matches the API's return parameters for the chosen version. Selecting a return parameter is necessary to test the API.

    4. Set the API protocol and return count.

      Parameter

      Description

      Protocol

      If you selected the HTTP and HTTPS protocols when creating the API, you can select the protocol when debugging the API.

      Return Count

      Used to define the number of data returned when testing the API:

      • If the request method is LIST, you can select Return Count. A maximum of 10,000 data entries can be returned.

      • If the request method is GET, modifying Return Count is not supported.

  4. After configuration, click Debug/Test to test the API's connectivity with the data source.

    During the test, you can view the SQL script by clicking View Script to ensure the query results align with the script's expectations. If the registered API does not have an SQL script, this option is not available.

  5. Examine the test results in the Return Result/Test Details area.

    If the test fails, you can view Appendix: Error Codes and Solutions.

  6. To authorize the API for the application, click the API Authorization button located at the bottom. For more information, see Data Service 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.

    Should an online version of the API exist, the system will check for parameter changes and dependencies to decide if the project's release control mechanism should be activated. You may execute Revoke or View actions on the selected API.

    • Revoke: Click Revoke to navigate to the Management Center > Permission Management > Data Service Permission (under Permission Management) > API Permission tab. Here, you can revoke the API permission.

    • View: Click View to be directed to the Service > Development > API page. The system will filter out the current API for you. You can edit the composite API to remove the reference to the composite API or delete the composite API.

      If you lack permission for the composite API, please reach out to the API's owner to either edit and remove the API reference or delete the composite API entirely.

      Note
      • Only super administrators and project administrators of data services can revoke API permissions.

      • Should an API version already be published online, the release process will validate parameters, which involves adding necessary request parameters, removing request or return parameters, and modifying the data types of request parameters. Should any changes occur, the API release may be either blocked or allowed based on the project's established release control mechanism.

        • If the API release control is set to Block Release and the API has been authorized to the application, you must revoke the API permission to proceed with the release.

        • If the release control API is referenced by a composite API and set to Block Release, you must either edit the composite API to remove the API reference or delete the composite API before proceeding with the release.

        • If the release control settings block the release for both configurations, you must revoke the API permission and either edit the composite API to eliminate the API reference or delete the composite API to proceed with the release.

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

Batch publish API

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

  2. In the API Batch Publish dialog box, select the version to be published. By default, the system will fill in the latest submitted version.

  3. Click Confirm to check if the API is successfully published in the API Batch Publish Details dialog box. If the publication fails, click View after the error details to understand the specific reason for the failure.

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

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

Business application users can subsequently query and request call permissions for the API on the DataService Studio overview page.

Note
  • Only submitted APIs are eligible for online publishing.

  • Deploying a new version online may impact API calls. Within the project, you can configure various release control mechanisms. The behavior of the API upon release-whether it is blocked or allowed-will adhere to the project's settings. For more information, see Create service projects.

  • APIs based on service units will verify the existence of referenced fields in the service unit during publishing. APIs based on data sources will verify the existence of referenced fields in the data source.

  • Enabling the high availability module for the data service means that, upon publishing, APIs built on data sources will not check for the existence of backup link data sources, nor the tables or fields they reference.

Appendix: Error codes and solutions

Error Code

Code Description

Solution

DPN-OLTP-COMMON-000

Indicates success.

No action required.

DPN-OLTP-COMMON-001

An unknown error occurred in the IoT Platform.

Please submit a ticket or contact the Dataphin helpdesk for support.

DPN-OLTP-COMMON-002

A parameter exception has occurred.

Verify the accuracy of the parameters.

DPN-OLTP-COMMON-003

An unknown error occurred in the IoT Platform.

Please submit a ticket or contact the Dataphin helpdesk for support.

DPN-OLTP-COMMON-004

SQL parsing exception.

Ensure the field alias is defined in the SQL statement and revise as necessary.

DPN-OLTP-ENGINE-001

The specified parameter is invalid.

Please verify the parameters you have entered.

DPN-OLTP-ENGINE-002

Object not found.

If the object is missing, please submit a ticket or reach out to the Dataphin helpdesk for support.

DPN-OLTP-ENGINE-003

No, compute plans cannot be renewed.

N/A.

DPN-OLTP-ENGINE-004

Fault in the communication table.

None.

DPN-OLTP-ENGINE-005

SQL parsing failed.

If you encounter this issue, please submit a ticket or contact the Dataphin helpdesk for support.

DPN-OLTP-ENGINE-006

Metadata error.

DPN-OLTP-ENGINE-007

Error in parameter processing.

DPN-OLTP-ENGINE-008

Model execution error.

DPN-OLTP-ENGINE-009

The test execution has failed.

DPN-OLTP-ENGINE-010

Data source error.

DPN-OLTP-ENGINE-011

No, the HBase engine is not supported.

None.

DPN-OLTP-ENGINE-012

Object serialization failed.

Please submit a ticket or contact the Dataphin helpdesk for support.

DPN-OLTP-ENGINE-013

Permission verification failed.

Please request access to the data table. For additional details, see how to request, renew, and relinquish table permissions .

If the problem continues despite having the appropriate permissions for the data table, please submit a ticket or contact the Dataphin helpdesk for support.

DPN-OLTP-ENGINE-014

No, the Elasticsearch engine is not supported.

None.

DPN-OLTP-ENGINE-015

No, the MongoDB engine is not supported.

N/A.

DPN-OLTP-ENGINE-016

Field type error.

Verify that the configured field type matches the data source's field type.

DPN-OLTP-ENGINE-017

Redis cache exception detected.

Please submit a ticket or contact the Dataphin helpdesk for support.

DPN-OLTP-ENGINE-018

No, cross-data-source operations are not supported.

None.

DPN-OLTP-ENGINE-019

Failure in data type encoding or transformation.

Please submit a ticket or contact the Dataphin helpdesk for support.

DPN-OLTP-ENGINE-20

Circuit Breaker

DPN-OLTP-ENGINE-21

Rate Limiting

To mitigate excessive request concurrency, you can configure API rate limiting.

DPN-OLTP-ENGINE-018-01

No, cross-data-source Group By operations are not possible.

Please review the SQL.

DPN-OLTP-ENGINE-018-02

No, cross-data-source Order By operations are not supported.

DPN-OLTP-ENGINE-018-03

No, operations across different data sources cannot be performed without Where conditions.

DPN-OLTP-ENGINE-018-04

No, cross-data-source operations are not permitted when PageStart is not set to 0.

DPN-OLTP-ENGINE-018-05

No, cross-data-source operations and Where condition operations are not supported.

DPN-OLTP-ENGINE-018-06

No, cross-data-source operations involving fields from multiple physical tables within a single Select item are not possible.

DPN-OLTP-ENGINE-018-07

Primary keys must be included in queries that span multiple data sources.

DPN-OLTP-JDBC-001

This error message indicates that the specified parameter is invalid.

Verify the accuracy of the parameters you have entered.

DPN-OLTP-JDBC-002

There is a mismatch between the request and account ID.

Verify that the Session ID corresponds with the Account ID. If they are correct and the issue persists, please submit a ticket or contact the Dataphin helpdesk for further assistance.

DPN-OLTP-JDBC-003

The user lacks the necessary permissions to access the database.

Please request permission for the data source. For more information, see Requesting Data Source Permissions.

If the problem remains after you have secured the appropriate data table permissions, please submit a ticket or reach out to the Dataphin helpdesk for further assistance.

DPN-OLTP-JDBC-004

The user lacks the necessary permissions to access the data table.

Please request access permissions for the data table. For more information, see Request, renew, and return table permissions.

If you continue to experience issues after obtaining the necessary permissions, please submit a ticket or contact the Dataphin helpdesk for further assistance.

DPN-OLTP-JDBC-005

Account ID Error

Verify the accuracy of the Account ID.

DPN-OLTP-OLAP-001

OLAP Client Connection Failure

Attempt to reconnect the client. If the problem continues, please submit a ticket or reach out to the Dataphin helpdesk for support.

DPN-OLTP-JDBC-002

OLAP Client Execution Failure

Please submit a ticket or contact the Dataphin helpdesk for support.

What to do next

Once you have tested and published the API, you can manage query requests and access permissions through DataService Studio. For further details, see Call API.