Registering APIs
This topic describes how to register APIs, manage APIs generated based on data tables, and publish APIs to API Gateway.
DataArts DataService Shared supports the registration of RESTful APIs using GET and POST methods.
Configuring Basic API Information
- On the DataArts Studio console, locate an instance and click Access. On the displayed page, locate a workspace and click DataArts DataService.
- In the left navigation pane, choose DataArts DataService Shared. The Overview page is displayed.
- Choose
Table 1 API basic configuration Parameter
Description
API
An API name consists of 3 to 64 characters and starts with a letter. Only letters, numbers, and underscores (_) are allowed.
API Catalog
An API catalog is a set of APIs with a specific function or scenario. It is the minimum organization unit of APIs in DataArts DataService and the minimum management unit of API Gateway.
Click Select Catalog to create an API catalog or select an existing one created in Creating an API Directory.
Request Path
The path for accessing an API.
Example: /v2/{project_id}/streams.
Protocol
A protocol used to transmit requests. HTTP and HTTPS are supported.
Request Mode
HTTP defines the following request modes that can be used to send a request to the server.
GET requests the server to return specified resources.
POST requests the server to add resources or perform special operations. This method is recommended for API registration. The POST request does not have a body. Instead, it involves transparent transmission.
Description
A brief description of the API to be registered.
Tag
The name of the tag. Only letters, numbers, and underscores (_) are allowed. Tag names cannot start with underscores (_).
Reviewer
An owner who has permissions to review APIs.
Click Add to enter the page. On the page displayed, click Add on the Reviewer Management tab page to add a reviewer.
Security Authentication
Security authentication mode, which can be:
- App Authentication: API Gateway authenticates API requests.
- IAM Authentication: IAM authenticates API requests.
- Non-authentication: No authentication is required.
Display Scope
After the API is published, all users in the selected scope can view the API in the service catalog.
- Current workspace APIs
- Current project APIs
- Current tenant's APIs
Access Log
If you select this option, the API query result will be recorded and retained for seven days. You can choose Operations Management > Access Logs and select the request date to view the logs.
Min. Retention Period
Minimum duration reserved before API unbinding. Before an API developer suspends, unpublishes, or cancels the authorization of an API, the system notifies the authorized API callers and reserves at least X hours for them to unbind the API. During the retention period, the API can be used if it is not unbound. The value 0 indicates that there is no minimum retention period.
Input Parameter
Input parameter is a set of parameters in the API request, including dynamic parameters in the resource path, query parameters in the request URI, and header parameters.
The following is an example that describes the dynamic parameters in the resource path (request path):
/v2/{project_id}/streams, where {project_id} is a dynamic parameter that needs to be configured.
- Click Add and enter project_id for Name.
- Set Parameter Location to PATH.
- Set Type to STRING.
- Set Example Value and Description as required.
in the left navigation bar, and click Register. Configure the basic information.
- After the basic API information is complete, click Next to go to the Data Extract Logic page.
Configuring API Parameters
After configuring basic API information, you can set API parameters. The following describes how to configure the API backend services and request parameters.
Parameter |
Description |
---|---|
Protocol |
A protocol used to transmit requests. HTTP and HTTPS are supported. This parameter is used by DataArts DataService to transmit requests to the APIs to be registered. |
Request Mode |
HTTP defines the following request modes that can be used to send a request to the server. This parameter is used by DataArts DataService to transmit requests to the APIs to be registered. GET requests the server to return specified resources. POST requests the server to add resources or perform special operations. |
Backend Service Host |
Backend service host is the host of the API to be registered. The value cannot start with http:// or https:// and cannot contain Path. |
Backend Service Path |
Backend service path is the path of the API to be registered. The path can contain parameters placed in {}, for example, /user/{userid}. |
Backend Timeout (ms) |
Backend timeout interval. |
Backend Service Parameter |
The optional parameters can be placed in PATH, Header, and Query. The positions of optional parameters vary depending on the request mode. Select a parameter position as required. |
Constant Parameter |
Constant parameter is the fixed parameter invisible to the caller. Constant parameter does not need to be transferred during API calling. However, the background service always receives the constant parameter and parameter value defined here. This parameter applies to scenarios in which you want to set a parameter of an API to a fixed value and hide the parameter from the caller. |
Testing an API
After all parameters are set, click Debug. Specify Value and click Debug. You can view the Request and Response details on the right part of the page displayed. If the test fails, follow the instructions as prompted and restart the test. During the configuration, pay attention to the settings of the normal response example.
After the test is complete, click OK.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.