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

Publishing a Function API

After creating a function backend, publish it as an API in an environment so it 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.
  5. On the page displayed, configure API information and click Publish to create a frontend function API for the backend and publish the API in an environment.
    Table 1 Parameters for publishing an API

    Parameter

    Description

    API Group

    Select an API group for the frontend API. 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 an environment to publish the API in. Or 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

    Mandatory for Frontend Security Authentication set to Custom.

    Select a frontend custom authorizer you have created.

    Frontend Request Protocol

    Select the request protocol used by the frontend API. HTTPS is recommended for transmitting important or sensitive data.

    Options: HTTP, HTTPS, HTTP&HTTPS

    Timeout (ms)

    Enter the timeout interval of a backend service request.

    Default: 60000

    Retries

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

    • -1: The retry function is disabled. However, requests will be retried once by default except for those using POST and PATCH.
    • 0 to 10: This parameter is enabled and will make the configured number of retries.

    Advanced Settings

    Frontend Request Method

    Select the request method of the frontend API.

    ANY: The API is accessible by any request method.

    Frontend Request Path

    The path is case sensitive.

    Example: /getUserInfo/userId

    CORS

    Specifies whether CORS is supported for the API.

    For security, 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.