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

Configuring an API Scheduled Task

Overview

Create an API scheduled task on ROMA Connect so that APIs can be automatically called as scheduled.

Prerequisites

  • The API to be added to a scheduled task has been published. Otherwise, publish the API first.
  • The API to be added to a scheduled task must use App or None authentication.
  • Instance parameters app_route and app_secret of ROMA Connect have been set to on. That is, IP address access and app_secret authentication are supported.

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 > API Management > Scheduled Tasks. On the page displayed, click Create Scheduled Task.
  3. In the Create Scheduled Task dialog box, configure task information.
    Table 1 Task configuration

    Parameter

    Description

    Task Name

    Enter a task name. It is recommended that you enter a name based on naming rules to facilitate search.

    Integration Application

    Select the integration application to which the task belongs. ROMA Connect will use the authentication information of the integration application to call APIs. If none is available, click Create Integration Application on the right to create one.

    Description

    Enter the description of the task.

    Effective Time

    Time when a scheduled task starts to be executed. The scheduled task will be executed based on the triggering condition after the execution time starts.

    Trigger Type

    The way to trigger the scheduled task.

    • CRON: The task is triggered using a cron expression.
    • CALENDAR: The task is triggered at regular intervals.

    Cron Expression

    Mandatory for Trigger Type set to CRON.

    Enter a cron expression to automatically trigger the task.

    Interval

    Mandatory for Trigger Type set to CALENDAR.

    Enter the triggering period of the task. You can set the triggering period by minute, hour, day, week, or month.

    Max Retry Attempts

    Number of retry attempts after a task fails to be executed. The value ranges from 0 to 3.

    API

    Click Select API on the right and select the API to be called by the task.

    If integration applications of an API and a scheduled task are different, only an API of App authentication can be selected. You also need to authorize the API to access the integration application of the scheduled task.

    Request Parameters

    Add the request parameters for calling the API.
    • Path: This parameter needs to be set only if the API request path contains the Path parameter. The system lists the required parameter by default.
    • Headers: Configure the Headers parameter of the API request. Click Add Request Parameter and enter a parameter name and value.
    • Parameters: Configure the query parameters of the API request. Click Add Request Parameter to add a parameter and enter a parameter name and value.
    • Body: This parameter can be set only if the API request method is POST, PUT, or PATCH. Select a content type and enter the body content of the corresponding format as required.
      • application/json: data in JSON format
      • application/xml: data in XML format
      • application/text: data in text format
  4. Click OK.
  5. Start the API scheduled task.

    A newly created task is in the Initialized state.

    To start the task, click Start in the Operation column of the task. In the confirm dialog box displayed, click Yes. Then, the status of the task changes to Started, and the scheduled task will be executed based on the configured triggering mode.