API Registry
Was this helpful?
Was this helpful?
Path: API Management > API Registry
The system can register the APIs saved on the AP server to the system, and have the system manage the APIs.
The system provides two methods to allow users to register APIs, which are through API documents and http / https to register the APIs to the system.
OPENAPI registers APIs to the system using API documents, and OPENAPI allows batch registration.
API documents must conform to OAS2.0 or OAS3.0 format to use this feature.
To upload an OpenAPI document via URL, select Upload OpenAPI document via URL, paste the DOC URL into the field, and click Upload to proceed.
The information of this API will be displayed below.
The example is https://petstore3.swagger.io/api/v3/openapi.json.
Fill in the API related fields.
Target URL*: Only for registered API, if the source URL has been changed, the new URL can be specified here.
After clicking Register, all APIs in this API module will be registered to the system.
Since the registered APIs are all disabled by default, they must be enabled manually from the API List.
In this section, you can find instructions on how to mount external APIs onto the system using URL methods; the default mode is New(dgrc).
Paste the API URL to upload to the URL field first, and click Validate to access the test external URL page.
The example is from Google API Explorer: https://developers.google.com/apis-explorer/.
To check if the Http Method and source URL fields are correct, Click Validate.
Its result will be displayed below. If the result is Status 200 and there were data in Headers and Body, it means that this API can be used.
Click Return and fill in the required fields.
Clone from existing API: Copy from existing API.
Modes: The system has two API modes, which are compatible V3 (tsmpc) and New(dgrc). Compatible V3 (tsmpc) has module names. The New(dgrc) has no module name, and provides the URL Path function.
Target URL*: URL of the API.
API Log Header Mask: Specifies masking for the Header field, applicable only to registered APIs.
For example, if the value is Hello
, with a character count of 1 and masking character #
, the following will be displayed:
Policy 0: No masking, displays Hello
.
Policy 1: Retains the first and last character, displays H###o
.
Policy 2: Retains the first character, displays H####
.
Policy 3: Retains the last character, displays ####o
.
API Log Body Mask Policy: Specifies different masking strategies for keywords in the Body content, applicable only to registered APIs.
For example, if the original text, "name":"test","id":"1"
, with a character count of 2, masking character #
, and keyword name
, the following will be displayed:
Policy 0: No masking, displays "name":"test","id":"1"
.
Policy 1: Masks the first and last 2 characters, displays "#name##"test","id":"1"
.
Policy 2: Masks the first 2 characters, displays "#name":"test","id":"1"
.
Policy 3: Masks the last 2 characters, displays "#name##"test","id":"1"
.
Policy 4 uses regular expressions for definition. For example, with a character count of 1 and a mask of #
, and a regular expression of name\d
, the following will be displayed:
"name1":"test","id":"1"
will display as "name1#:"test","id":"1"
.
"name2":"test","id":"1"
will display as "name2#:"test","id":"1"
.
"name-3":"test","id":"1"
will display as "name-3:"test","id":"1"
.
Fail Discovery Policy*: Specifies the action to take when an API connection fails. The system default is set to When the connection fails or the HTTP status code is 4xx (client error) or 5xx (server error).
Fail Discovery Policy is only available on dgrc.
Fail Handle Policy*: Specifies how the system handles API connection failures. Choose between No retries or When calling the target URL fails, automatically retry the next target URL.
Fail Handle Policy is only available on dgrc.
API Module*: New module name of the API; it is the URL name of this API when it can be called externally. Only alphanumeric characters, underscore “_” and hyphen “-” can be entered in this field. This only needs to be filled when V3 (tsmpc) mode is selected.
API ID*: API name; it is the URL name of this API when it can be called externally. Only alphanumeric characters, underscore “_” and hyphen “-” can be entered in this field. This only needs to be filled when V3 (tsmpc) mode is selected.
API Name*: API name; it is the URL name of this API when it can be called externally. Only alphanumeric characters, underscore “_” and hyphen “-” can be entered in this field. This only needs to be filled when New(dgrc) is selected.
digiRunner URL: If users want to call the URL used for this API, the system will generate it automatically according to the two fields mentioned above. Check to set the authentication method to Path Parameter or No Auth:
Path Parameter: Upon checking, carries over the URL Path parameter data when calling the API.
No Auth: Upon checking, allows calling the API without authentication, commonly used for Public APIs.
digiRunner Proxy Path*: Path of the target URL; this only needs to be filled when New(dgrc) is selected. For example, the target URL is a.b.c/a1/a2, the Proxy Path is /x1/x2; the target URL is a.b.c/a1/{id}, the Proxy Path is /x1/x2/{p}; the target URL is a.b.c/a1/{id1}/a3/{id2}, the Proxy Path is /x1/{p}/x2/{p}.The first character is /; please use {p} if there are parameters.
No Auth: Upon checking, allows calling the API without authentication, commonly used for Public APIs.
If New(dgrc) is checked, the registered digiRunner Proxy Path does not need to include /tsmpc (this is the context path used for compatibility mode in the old version).
Http Methods*: Set the Http Methods of this API.
Data Format: Select the data format for the upload; it is JSON by default.
JWT Settings: Set whether to use JWE or JWS encryption for Request / Response.
Description: API description.
Label: Up to five labels can be used. Labels with capitalized characters will automatically be switched to lower case, and each label can be no more than 20 characters long.
Since the registered APIs are all disabled by default, they must be enabled manually from the API List. Add the API to the group again in order for users to use it.
If you want to test this API at this time, go to the API list to search and test whether this API can be used by users.
The API will be selected by groups, and groups will be selected by users.
Multiple external APIs can also be added. If multiple APIs were added, the system will open APIs randomly when testing in the test area.
9. Go to Clone from existing API, search for and check the desired API, and click Join.
Click copy to copy and change to a new API.
If the API basic information remains unchanged, a warning prompt will pop up, displaying the error message “1353 - [API] already exists”.
For the underlying API, click on the icon to access the test external URL page, then click Validate to test whether this API can be used normally.
Click on the icon of the underlying API to expand the information of this API, and click on the icon to collapse.
You can copy an existing API on the system. Click on the icon.