Simulating upcoming events and tuning your schedule - Cloud

Talend Cloud APIs User Guide

Version
Cloud
Language
English (United States)
Product
Talend Cloud
Module
Talend API Designer
Talend API Tester
Talend Data Preparation
Talend Data Stewardship
Talend Management Console
Content
Design and Development > Designing APIs
Design and Development > Testing APIs
Before associating, that is to say, applying your schedule to a task, simulate events that this schedule could trigger in the future and then tune the schedule accordingly.

Before you begin

  • Generate access tokens:

    Once generated, a service account token expires after 30 minutes. If it expires, generate a new token using the POST method at the endpoint https://api.<env>.cloud.talend.com/security/oauth/token. For more information about generating a token, see Generating a service account token.

  • You must know the ID of the schedule for which you need to simulate events.
  • To simulate upcoming events, ensure that the user or the service account to be used to issue API calls has the VIEW permission for at least one workspace in the environment in which you need to simulate and tune schedules.

    If the schedule to be tuned has been associated to a task or a plan, the VIEW permission for the workspace to which this task or plan belongs is required.

  • To tune your schedule, that is to say, update triggers defined for that schedule, the user or the service account to be used must have the TMC_OPERATOR role and the EXECUTOR permission for at least one workspace in the environment in which you need to create the schedule.

    If the schedule to be tuned has been associated to a task or a plan, the EXECUTOR permission for the workspace to which this task or plan belongs is required.

Procedure

  1. Issue the following request to simulate the upcoming events to be triggered by your schedule.

    Example

    method: GET
    endpoint: https://api.<env>.cloud.talend.com/orchestration/schedules/<scheduleId>/events
    headers: {
          "Content-Type": "application/json",
          "Authorization": "Bearer <your_personal_access_token_or_service_account_token>"
              }
    payload: {
           "to": "1742567692000"
              }
    The to field is used to specify the end date time in milliseconds of the period for which you simulate upcoming events.
    In the response, each upcoming event is returned with the trigger that sets it off so that you can easily identify the trigger you need to update for this schedule.
    [
      {
        “date”: “2022-06-22T10:04:00.000Z”,
        “sourceTriggerName”: “my_trigger_1"
      },
      {
        “date”: “2022-06-22T10:09:00.000Z”,
        “sourceTriggerName”: “my_trigger_1"
      },
      {
        “date”: “2022-06-23T10:04:00.000Z”,
        “sourceTriggerName”: “my_trigger_1"
      },
      {
        “date”: “2022-06-23T10:09:00.000Z”,
        “sourceTriggerName”: “my_trigger_1"
      },
      {
        “date”: “2022-06-24T10:04:00.000Z”,
        “sourceTriggerName”: “my_trigger_1"
      },
      {
        “date”: “2022-06-24T10:09:00.000Z”,
        “sourceTriggerName”: “my_trigger_1"
      },
      {
        “date”: “2022-06-25T10:04:00.000Z”,
        “sourceTriggerName”: “my_trigger_1"
      },
      {
        “date”: “2022-06-25T10:09:00.000Z”,
        “sourceTriggerName”: “my_trigger_1"
      },
    ...
    ]

    For example, if you discover that an event will be triggered during the maintenance time of your system, you may need to update the trigger to start that event earlier or later.

  2. Issue the following API call to update triggers of a schedule:

    Example

    method: PUT
    endpoint: https://api.<env>.cloud.talend.com/orchestration/schedules/<scheduleId>/triggers
    headers: {
          "Content-Type": "application/json",
          "Authorization": "Bearer <your_personal_access_token_or_service_account_token>"
              }
    payload: {
           "Trigger": {
               "name": "My unique trigger name",
               "startDate": "2022-06-17",
               "timeZone": "Europe/Kiev",
               "type": "ONCE",
               atTimes: {
                   "type": "AT_TIME",
                   "time": "11:00"
                        }
                       }
              }

    This request updates the trigger with the name My unique trigger name by changing the event start date to 2022-06-17 (June 17, 2022). The other triggers defined for this schedule stay unchanged.

    The same requirements about defining a new trigger apply on the trigger updates. When you send the request, an automatic check proceeds.

Results

You schedule is now fine-tuned to start events at the most appropriate times.

What to do next

It is ready to be associated to a task so as to trigger events for this task as scheduled.