An API goes through a continuous lifecycle from development to production: test in the development environment, publish to API Gateway, and track changes through version management. This guide covers the key operations in order: Test → Publish → Version management → Unpublish.
Test an API
API testing calls the actual data source or backend service to verify that request parameters and response content work as expected. Data Service supports two testing scenarios: testing an API in development on the Service Development page, and testing a published API on the Service Management page.
API testing consumes resources from your Data Service resource group and incurs fees. Before performing large-scale or frequent testing, review the billing details. For more information about billing, see Billing of DataService Studio.
Test an API in development
Testing an API in development means testing on the Service Development page (the development environment). Before you test the API, you must first generate it in wizard mode or script mode, or register an existing service as an API. For more information, see Generate API overview or Register an external API service.
Procedure:
-
Log on to the DataWorks console. In the target region, click in the left-side navigation pane. Select a workspace from the drop-down list and click Go to DataService Studio.
-
From the API list on the left, double-click the name of the API that you want to test to open its editing page.
-
On the API editing page, find and click the Test button to open the Test APIs dialog box.
-
In the left pane of the dialog box, enter a test value for each request parameter.
-
Click Start Test to trigger the API call.
View test results:
After the test is complete, you can view the following information in the right pane of the dialog box:
-
Request Details: The complete request information for the API call, including the request path, headers, and body. Use this to verify that the request is structured correctly.
-
Response Details: The response data from the API (the actual query result). Compare this with the expected result to verify that the API logic is correct.
-
Response Duration: The end-to-end response latency of the API request. If the latency is high, consider optimizing the query logic or data source configuration.
If the test fails, carefully review the error message returned, make the necessary modifications, and retest.
Test a published API
Testing a published API means testing on the Service Management page (the production environment). This verifies the actual runtime behavior of the API after publishing. Before you perform this test, you must first publish the API.
Procedure:
-
On the Data Services page, click Service Management in the top navigation bar.
-
In the left-side navigation pane, click Test APIs.
-
From the drop-down list, select the API that you want to test, and make sure the request parameter values are fully configured.
-
Click Start Test, and view the Request Details and Response Details in the right pane.
Notes:
-
The Test APIs page only provides online API testing functionality. It does not support updating the normal response example of an API.
-
If Pagination for Return Results is configured for an API, whether the returned data is ordered depends on the behavior of the underlying data source. If you need sorting, you can configure a Sort field for the API in wizard mode, or add an
ORDER BYclause to the SQL code in script mode.
Interpreting test results and optimization suggestions
A complete API test result consists of three parts. Understanding each part helps you quickly identify issues:
|
Result item |
Description |
Key focus |
|
Request Details |
The complete HTTP request constructed for this call. |
Verify that the URL path and parameter passing method are correct. |
|
Response Details |
The JSON response body returned by the API. |
Check whether the data columns, data volume, and error codes match expectations. |
|
Response Duration |
The total time from sending the request to receiving the response. |
If latency is high, consider optimizing SQL, adding indexes, or using acceleration services. |
After the test results meet expectations, you can proceed to publish the API to API Gateway.
Publish an API
After API testing is complete, you can publish the API to API Gateway for hosting. API Gateway provides full-lifecycle management capabilities including publishing, management, operations, and monetization. It also offers permission management, throttling, and access control. Publishing deploys the API to API Gateway and automatically generates an online endpoint.
Prerequisites
Before you publish an API, ensure the following conditions are met:
-
API Gateway is activated: Activate the service in the API Gateway console.
ImportantDue to network architecture limitations between DataWorks and API Gateway, when you purchase an API Gateway instance, only traditional dedicated instances are supported for Instance Type. VPC-integrated instances are not supported.
-
An API group is created: When published, the API is deployed to the corresponding group in API Gateway based on the workflow association. Ensure the workflow is correctly associated with an API Gateway group. You can check the group name by right-clicking Workflow > Change.
Publishing process
API publishing follows a three-step process: Submit → Approval → Publish:
Step 1: Submit the API
-
Go to the Data Services page. On the Service Development page, double-click the name of the API you want to publish from the API list to open its editing page.
-
Click the Submission button in the upper-right corner.
-
After the submission succeeds, the system automatically generates an API version (such as V1 or V2). You can view the version status in the Version panel that appears on the right.
Step 2: Request publishing and wait for approval
-
In the Version panel on the right, find the API version to be published, and click the Publish button.
-
Follow the on-screen instructions to enter the reason for the request, and click Requested Permissions to submit the publishing request.
-
If the workspace has an approval process configured, the publishing request must be approved in the approval center. The approver can view the request details and process the approval on the Approval Center > To Be Processed page.
-
After the approval is granted, the API status in the Version panel changes from To Be Requested to Can Be Published.
If the workspace does not have an approval process configured, you can proceed directly to the publish step after submission without waiting for approval. For more information, see Configure an approval process.
Step 3: Execute publishing
-
After the approval is granted, in the right-side navigation bar of the API editing page, click Version, and find the API version with the Can Be Published status.
-
Click the Publish button and wait until the system indicates that the publishing is successful.
-
After the API is published, DataWorks deploys it to the corresponding group in API Gateway based on the associated group of the workflow to which the API belongs.
Post-publishing verification
After publishing, you can verify and manage the API in the following ways:
-
View in API Gateway: Log on to the API Gateway console. View the published API information in , and configure policies such as throttling and access control.
-
Application calls: If the API is called by your own application, create an application in API Gateway, authorize the API to the application, and then use AppKey and AppSecret for encrypted signature-based calls. API Gateway also provides SDKs for mainstream programming languages. For more information, see Authorize and call an API. For SDK integration, see SDK integration.
-
Protocol change: For a published API, on the Service Management > Published APIs tab, click More > Change Protocol for the corresponding API to modify the access protocol (for example, from HTTP to HTTPS). The protocol change takes effect immediately. However, if the original protocol is removed, API calls using that protocol will fail. Proceed with caution.
List on Alibaba Cloud API Marketplace (optional)
Alibaba Cloud API Marketplace covers categories such as finance, artificial intelligence, e-commerce, transportation and geography, life services, enterprise management, and public affairs. Thousands of API products are available for sale, making it a platform that helps you quickly monetize your data. Alibaba Cloud API Marketplace
After APIs generated or registered in Data Service are published to API Gateway, you can list them on Alibaba Cloud API Marketplace for sale with one click, helping enterprises monetize data value.
Prerequisites:
-
Only enterprise identities are supported for registering on Alibaba Cloud API Marketplace.
-
Before listing, you need to register on the Alibaba Cloud Marketplace as a service provider. For the process, see Register as a service provider.
Procedure:
-
Go to the Alibaba Cloud Service Provider Platform.
-
In the left-side navigation pane, click .
-
Click Publish Product.
-
On the Access Information page, configure the parameters as instructed (including the product name, pricing strategy, and API binding) to complete the API listing process. For more information, see Instructions for listing API products.
Version management
Data Service provides comprehensive version management for APIs. Each time an API is submitted and published, the system automatically generates a version record. You can view historical versions, compare differences between versions, or roll back to a previous version at any time.
When using a cloud-native API gateway, a single API can be published to multiple gateway instances. The version panel may display multiple records with the Publish status, each corresponding to a different gateway instance. Within the same gateway instance, publishing a new version automatically unpublishes the old version.
View version history
-
Log on to the DataWorks console. In the target region, click in the left-side navigation pane. Select a workspace from the drop-down list and click Go to DataService Studio.
-
On the Service Development page, double-click the name of the API you want to view from the API list to open its editing page.
-
Click the Version button on the right side of the page to open the version panel and view version information and details. The version panel displays all historical version information for the current API, including:
NoteEach version provides an API Details link in the Actions column. Click it to view the complete configuration information of that version, including request parameters, response parameters, and data source configuration.
Column
Description
API ID
The unique identifier of the current API.
Version
The version number, which increments in submission order (V1, V2, V3, and so on).
Submitted By
The user who submitted this version.
Submitted At
The publish time of this version, accurate to the second.
Status
-
Publish (the latest version currently in effect online)
-
Can Be Published (a version that has passed testing and been submitted)
-
Batch Synchronization (a historical old version)
-
Version comparison
After multiple iterations of an API, you may need to compare versions to understand the specific changes.
Procedure:
-
In the Version panel, select any two versions that you want to compare.
-
Click the Compare button at the bottom of the panel.
-
In the History Version Contrast dialog box that appears, view the differences between the two versions.
Comparison content:
-
Wizard mode API: Displays differences in request parameters and response parameters, including changes to attributes such as parameter name, type, and whether a parameter is required.
-
Script mode API: Displays text differences in SQL scripts, with added, deleted, and modified lines highlighted.
Version comparison is especially useful in team collaboration scenarios, helping reviewers quickly understand the content of each change.
Version rollback
When a new version is abnormal or does not meet expectations, you can roll back the API to a previous stable version.
Procedure:
-
In the Version panel, find the target historical version.
-
Click the Roll Back button in the Actions column of that version.
-
In the Confirm Rollback dialog box that appears, click Confirm.
After the rollback is complete, the API configuration is restored to the content of the selected historical version, and the current online version is updated immediately. We recommend that you use the version comparison feature to confirm the target version configuration before performing a rollback to avoid unintended changes.
Unpublish an API
When an API no longer needs to provide external services, you can unpublish it from API Gateway. Unpublishing invalidates the online endpoint, and all callers will no longer be able to access it.
Procedure
-
On the Data Services page, click Service Management in the top navigation bar. By default, you are directed to the Manage APIs page.
-
On the Published APIs tab, find the API that you want to unpublish.
-
Click the Unpublish button in the Actions column of the corresponding API.
-
In the Unpublish API dialog box that appears, click Confirm.
-
After the API is unpublished, it is removed from API Gateway and no longer accepts external calls.
Impact of unpublishing
Unpublishing an API has significant impact. Evaluate the following before proceeding:
-
Authorization invalidation: If an authorized API is unpublished, all workspaces that have been granted access will no longer be able to call the API. The authorization relationships are automatically invalidated after unpublishing.
-
Re-authorization: If an unpublished API is modified and republished, the API owner must re-grant access for the new version. Previous authorizations are not automatically restored.
-
Deletion restriction: Data Service only supports deleting APIs that are not in the published state. To permanently delete a published API, you must unpublish it first.
Before unpublishing an API, we recommend that you notify all known API callers and allow a reasonable migration time window to ensure a smooth business transition. For APIs that are listed on Alibaba Cloud API Marketplace, you must delist them from the marketplace first.
Best practices and recommendations
Version management strategy
Good version management practices can significantly reduce the risk of production incidents.
-
Change records: Each time you submit, clearly describe the changes and reasons in the submission notes so that team members can understand the context through version comparison.
-
Gray release verification: For major changes, we recommend that you fully verify in the test environment before publishing to the production environment.
-
Quick rollback: When an issue is detected online, use version rollback to restore the service first, then investigate the root cause. Rollback is faster than modifying and republishing, minimizing business impact.
-
Regular cleanup: For APIs that have not been used for a long time, unpublish and clean them up promptly to reduce management complexity and potential security risks.
Collaboration workflow for testing and publishing
In team collaboration scenarios, the following workflow is recommended:
-
Developers create and configure the API on the Service Development page.
-
Developers test the API in the development environment to verify functionality.
-
Developers submit the API to generate a new version and initiate a publishing request.
-
Approvers review the publishing request in the approval center and can use the version comparison feature to view the changes.
-
After approval, developers execute the final publish operation.
-
Operators perform online testing and monitoring of the published API on the Service Management page.
-
If issues are found, quickly restore the API through version rollback, or unpublish it for repair.
This workflow helps teams achieve efficient full-lifecycle API management while ensuring publishing quality.
Limitations of response examples
The API editing page supports setting a normal response example to display the expected response data structure in the API documentation. Note the following:
-
No automatic synchronization: Test results from the API testing page are not automatically updated as the normal response example. You need to manually edit or paste the response example on the API editing page.
-
Size limit: The normal response example has a maximum character count limit. If the example data is too large (for example, containing hundreds of records), saving may fail. Keep only 2 to 3 typical records as the example.
-
Takes effect after publishing: After modifying the normal response example, you must resubmit and publish the API for the changes to take effect in the API Gateway documentation.
Handling data source table structure changes
When the table structure of the data source associated with an API changes (such as adding columns, deleting columns, or modifying column types), published APIs do not automatically detect these changes. If not addressed, the following issues may occur:
|
Change type |
Impact |
Resolution |
|
Add a column |
The API response does not include the new column |
Add the new response parameter on the API editing page and republish |
|
Delete a column |
API call error (column does not exist) |
Remove the deleted response parameter on the API editing page and republish |
|
Modify column type |
May cause type conversion errors or data format exceptions |
Update the parameter type on the API editing page and republish |
|
Table name change |
API call error (table does not exist) |
Modify the SQL or table configuration in wizard mode and republish |
Procedure:
-
Go to the API editing page and modify the API configuration based on the table structure changes.
-
Wizard mode: Reselect the table, and the system automatically refreshes the column list.
-
Script mode: Manually modify the column names or table name in the SQL statement.
-
-
After saving the configuration, retest to verify the changes.
-
Submit and republish the API.
For wizard mode APIs, after cloning, if the table structure associated with the original API has changed, the cloned API may still use the old table structure information. We recommend that you re-enter wizard mode to refresh the column configuration after cloning.