Updated on 2024-06-25 GMT+08:00

Scheduling API Calling

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

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 to support IP address access and app_secret authentication.

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

    Parameter

    Description

    Task Name

    Enter a task name. Using naming rules facilitates future search.

    Integration Application

    Select an integration application for the task. ROMA Connect will use the authentication information of the integration application to call APIs.

    Description

    Enter a description of the task.

    Effective Time

    Time when a scheduled task starts to be triggered 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.

    Options: minute, hour, day, week, month

    Max Retry Attempts

    Number of retry attempts after a task fails to be executed.

    Range: 0 to 3

    APIs

    Click Select API on the right and select an 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 grant API permissions for the integration application of the scheduled task.

    Request Parameters

    Add the request parameters for calling the API.
    • 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 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 request 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 Initialized.

    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.