Skip to main content Skip to complementary content

Updating a task with a new artifact version

Use the orchestration/executables/tasks/<task_id> endpoint to update a task with a new artifact version.

Procedure

Issue the following request to get the scheduled task runs of a given environment.

Example

method: PUT
endpoint: https://api.<env>.cloud.talend.com/orchestration/executables/tasks/<task_id>
headers: {
          "Content-Type": "application/json",
          "Authorization": "Bearer <your_personal_access_token_or_service_account_token>"
          }
payload: {
  "name": "task_name",
  "description": "",
  "workspaceId": "workspace_id",

  "artifact": {
    "id": "id_of_the_artifact_that_the_task_uses",    
    "version": "target_version_of_this_artifact (for example, 0.1.22.20212710014123)"
  }
}
This example contains only the minimum number of parameters of a task. When updating your tasks, ensure to include the whole task entities in the payload, that is to say, all the existing fields of the tasks to be updated. Otherwise, any field values that your tasks have but which are not included are replaced with null.

Results

The status code 200 is returned with the task details in the body of the response. You can see the new artifact is being used. The following example shows how a task could look like in the response
{
  "id": "5c1111d7a4186a4eafed0587",
  "name": "Hello world task",
  "description": "task detail description",
  "workspace": {
    "id": "57f64991e4b0b689a64feed2",
    "name": "Personal",
    "description": "workspace detail description",
    "owner": "admin",
    "type": "custom",
    "environment": {
      "id": "57f64991e4b0b689a64feed3",
      "name": "Development",
      "description": "environment detail description",
      "default": true
    }
  },
  "version": "0.1",
  "artifact": {
    "createDate": "2021-11-22T13:13:27.608Z",
    "updateDate": "2021-11-22T13:13:27.608Z",
    "id": "id_of_the_artifact_to_be_updated",
    "name": "my_artifact",
    "version": "0.1.22.20212710014123" (The new  artifact version)
  },
  "tags": [
    "tag1",
    "tag2"
  ],
  "connections": {
    "aws": "5d405e381f40e07fbab6757c",
    "googledrive": "5d405e831f40e07fbab6757d"
  },
  "parameters": {
    "parameter_p1": "1111",
    "custom_parameter": "custom"
  },
  "resources": {
    "resource_file_f1": "5d567ad48f68ae1a1e16e4a4"
  },
  "autoUpgradeInfo": {
    "autoUpgradable": false,
    "overrideWithDefaultParameters": false
  }
}

In the real-world practice, you can develop your own script to automatically issue this request on each of the tasks you retrieved in the previous section: Getting tasks for which you need update the artifact version.

In the Downloads tab on the left, you can download an example of this kind of scripts, add appropriate values to the required parameters listed at the beginning of this script, and use it to automate the update of your tasks. This script is designed for demonstration purposes only. Talend does not provide support service for it.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!