Creating a schedule and adding triggers - 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

Create a schedule and add triggers before associating it to tasks.

A schedule supports only time triggers; a webhook trigger, which is merely event related, is not supported.

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.

  • Ensure that the user or the service account to be used to issue API calls has the TMC_OPERATOR role and the EXECUTOR permission for at least one workspace in the environment in which you need to create the schedule.

Procedure

  1. Issue the following request to create a schedule. A schedule must have at least one trigger.

    Example

    method: POST
    endpoint: https://api.<env>.cloud.talend.com/orchestration/schedules
    headers: {
          "Content-Type": "application/json",
          "Authorization": "Bearer <your_personal_access_token_or_service_account_token>"
              }
    payload: {
           "environmentId": "id_of_the_environment", #for example, 6242bc6eac74e9757cda41bb
           "Trigger": {
               "name": "My unique trigger name",
               "startDate": "2022-06-16",
               "timeZone": "Europe/Kiev",
               "type": "ONCE",
               atTimes: {
                   "type": "AT_TIME",
                   "time": "11:00"
                        }
                       }
              }
    • In Talend Cloud Management Console, select the environment from the environment list on the Environment page. The ID of this environment appears in the URL of the current page.
    • API: issue the following API call:
      method: GET
      endpoint: https://api.<env>.cloud.talend.com/orchestration/workspaces
      headers: {
           "Content-Type": "application/json",
           "Authorization": "Bearer <your_personal_or_service_account_access_token>"
                }  

      In the response, the IDs of the environments are returned in the environmentId field in each workspace block.

    In the following steps, you need to use the ID of this new schedule from the Id field in the response.
  2. Issue the following API call to append triggers to this new schedule:

    Example

    method: POST
    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 CRON Trigger",
                  "startDate": "2022-06-16",
                  "timeZone": "Europe/Kiev",
                  "type": "CRON",
                  "cronExpression": "0 * * ? *"
                      }
              }
    Triggers you define must meet the following requirements. When you send the request, an automatic check proceeds.
    • A trigger name must be unique among triggers defined for the same schedule.
    • Only 15 triggers are allowed to be defined for a schedule.
    • Interval between two events of the same task, such as two task runs, must not be less than 5 minutes.
    Note: The schedule ID to be used in the endpoint URL is the one you obtained in the response when creating this schedule. If you did not note down that ID, issue the following API request to get all schedules available to your account:
    method: GET
    endpoint: https://api.<env>.cloud.talend.com/orchestration/schedules
    headers: {
          "Content-Type": "application/json",
          "Authorization": "Bearer <your_personal_access_token_or_service_account_token>"
              }
    payload: {
           "environmentId": "id_of_the_environment", #for example, 6242bc6eac74e9757cda41bb
             }
    Note that the View permission for at least one workspace in the environment is required.

Results

Your schedule with intended triggers has been created. It is still an orphan schedule.

What to do next

Before applying your schedule to a task, you can simulate events your schedule would trigger for a given period, so that you are able to validate or adapt this schedule.