Applying a schedule to a task - 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

Associate, or in other words, assign your fine-tuned schedule to a task, revoke this association if needs be and eventually delete the schedule.

A schedule can be associated to only one task or plan. You need to unassign it first before assigning it to another task or plan. If another task or plan needs to use this schedule at the same time, duplicate it as explained in the next section.

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.
  • You must know the ID of the task you need to associate the schedule.
    In Talend Cloud Management Console, this ID is displayed on the dedicated page of this task. For example:
    Or you can obtain task IDs via the following API request:
    method: GET
    endpoint: https://api.<env>.cloud.talend.com/processing/executables/tasks
    headers: {
              "Content-Type": "application/json",
              "Authorization": "Bearer <your_personal_or_service_account_access_token>"
              }
    query parameters: {
              "workspaceId": "id_of_the_workspace_of_the_task_to_be_updated"
                      }
  • Ensure that the user or the service account to be used have the TMC_OPERATOR role and the EXECUTOR permission for the workspace to which the task to be updated belongs.

Procedure

  1. Issue the following request to associate your schedule to a task. This way, the task will be triggered to run according to this schedule.

    Example

    Triggers of this schedule replace any existing triggers of the task. If you need the task to keep the existing triggers, define the same triggers in the schedule to be associated, as explained in the previous sections, before starting this association.

    This way, new triggers and existing triggers are both added to the task along with the schedule.

    method: PUT
    endpoint: https://api.<env>.cloud.talend.com/orchestration/executables/tasks/<taskId>/schedule
    headers: {
          "Content-Type": "application/json",
          "Authorization": "Bearer <your_personal_access_token_or_service_account_token>"
              }
    payload: {
           "scheduleId": "schedule_id"
              }
  2. Issue the following API call to revoke the association between this schedule and the task. This step is mandatory if you need to delete this schedule, because a schedule can be deleted only when it becomes orphan.

    Example

    method: DELETE
    endpoint: https://api.<env>.cloud.talend.com/orchestration/executables/tasks/<taskId>/schedule
    headers: {
          "Content-Type": "application/json",
          "Authorization": "Bearer <your_personal_access_token_or_service_account_token>"
              }
    payload: N/A

    This request unassigns the schedule from your task. It now becomes orphan and thus can be deleted.

    If you need to know the details of this schedule, issue the following API request:
    method: GET
    endpoint: https://api.<env>.cloud.talend.com/orchestration/schedules/<scheduleId>
    headers: {
          "Content-Type": "application/json",
          "Authorization": "Bearer <your_personal_access_token_or_service_account_token>"
              }
    payload: N/A
    The VIEW permission for the workspace to which this task belongs is required.
  3. Now that this schedule is orphan, delete the schedule using the following API request:

    Example

    method: DELETE
    endpoint: https://api.<env>.cloud.talend.com/orchestration/schedules/<scheduleId>
    headers: {
          "Content-Type": "application/json",
          "Authorization": "Bearer <your_personal_access_token_or_service_account_token>"
              }
    payload: N/A

Results

The schedule is now deleted.