Updated on 2024-05-07 GMT+08:00

Publishing a Data API

After creating a data backend, publish it as an API in an environment. The generated API can be called by other users.

Prerequisites

Constraints

If request parameters are added to the request path of a frontend API published by a custom backend, the API cannot be published on the publish page of the custom backend. You need to publish the API on the frontend API page. If just the content of the custom backend is modified, deploy the backend again and no publishing is required.

Procedure

  1. Log in to the ROMA Connect console. On the Instances page, click View Console next to a specific instance.
  2. In the navigation pane on the left, choose API Connect > Custom Backends.
  3. In the backend list, click the name of a custom backend. The Online IDE page will be displayed.
  4. Click Publish in the upper right corner of the page.
  5. On the page displayed, configure API information and click Publish to create a frontend data API for the backend and publish the API in an environment.
    Table 1 Parameters for publishing an API

    Parameter

    Description

    API Group

    Select the API group to which the corresponding API belongs. If none is available, click Create API Group on the right to create one.

    NOTE:

    The API group cannot be changed once set and is bound to the access domain name of the API.

    Environment

    Select the environment in which the API is to be published. You can also click Create Environment to create one.

    Frontend Security Authentication

    Select the authentication mode of the API. The App authentication mode is recommended.

    • App: ROMA Connect authenticates API requests. When calling an API, a user gets authenticated using the key and secret of an integration application.
    • IAM: IAM authenticates API requests. When calling an API, a user gets authenticated using the token or AK/SK.
    • Custom: The custom function API is used for authenticating API requests.
    • None: Authentication is not required for API requests.

    Custom Authorizer

    This parameter is mandatory only if Frontend Security Authentication is set to Custom.

    Select a frontend custom authorizer you have created.

    Frontend Request Protocol

    Select the request protocol used by the frontend API. The value can be HTTP, HTTPS, or HTTP&HTTPS. HTTPS is recommended for transmitting important or sensitive data.

    Timeout (ms)

    Enter the timeout interval of a backend service request. The default value is 60000.

    Retries

    Number of retries after ROMA Connect fails to call the backend service.

    • If the value is -1, the retry function is disabled. However, requests will be retried once by default except for those using POST and PATCH.
    • If the value ranges from 0 to 10, this parameter is enabled, and retries are performed based on the configured value.

    Advanced Settings

    Frontend Request Method

    Select the request method of the frontend API. ANY indicates that the API can be accessed using any request method.

    Frontend Request Path

    Enter the request path of the frontend API, for example, /getUserInfo/userId.

    The value of Request Path is case sensitive.

    CORS

    This parameter specifies whether CORS is supported for the API.

    For security purposes, a browser restricts cross-domain requests initiated from scripts. That is, only resources from the same domain can be requested. However, CORS allows a browser to send XMLHttpRequest requests to a server in a different domain. For details about CORS, see Configuring CORS for APIs.