Creating a schedule and adding triggers

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 an access token:
    • For users, generate a personal access token. For further information, see Generating a Personal Access Token.
    • For service accounts, generate a service account token. For further information about how to generate a service account token, see Generating a service account token. 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.

Procedure

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

    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.

      Find environment ID

    • 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:

    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 is 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.

tip

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.

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.