Migrate tasks between versions within the same branch. Supports two modes: bulk migration by source version (from_version_id), or migration of specific tasks (task_ids). Target can be explicit (to_version_id) or latest active version (to_latest).
POST
/
tasks
/
migrate
Migrate Tasks Between Versions
curl --request POST \
--url https://api.example.com/tasks/migrate \
--header 'Content-Type: application/json' \
--data '
{
"from_version_id": "<string>",
"task_ids": [
"<string>"
],
"to_latest": false,
"to_version_id": "<string>"
}
'import requests
url = "https://api.example.com/tasks/migrate"
payload = {
"from_version_id": "<string>",
"task_ids": ["<string>"],
"to_latest": False,
"to_version_id": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
from_version_id: '<string>',
task_ids: ['<string>'],
to_latest: false,
to_version_id: '<string>'
})
};
fetch('https://api.example.com/tasks/migrate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/tasks/migrate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from_version_id' => '<string>',
'task_ids' => [
'<string>'
],
'to_latest' => false,
'to_version_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/tasks/migrate"
payload := strings.NewReader("{\n \"from_version_id\": \"<string>\",\n \"task_ids\": [\n \"<string>\"\n ],\n \"to_latest\": false,\n \"to_version_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/tasks/migrate")
.header("Content-Type", "application/json")
.body("{\n \"from_version_id\": \"<string>\",\n \"task_ids\": [\n \"<string>\"\n ],\n \"to_latest\": false,\n \"to_version_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/tasks/migrate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"from_version_id\": \"<string>\",\n \"task_ids\": [\n \"<string>\"\n ],\n \"to_latest\": false,\n \"to_version_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"branch_id": "<string>",
"tasks": [
{
"filesystem_id": "<string>",
"id": "<string>",
"namespace_id": "<string>",
"agents": [
{
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"id": "<string>",
"name": "<string>",
"namespace_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"registered_at": "2023-11-07T05:31:56Z",
"registration_metadata": {},
"status": "ACTIVE",
"status_reason": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"created_version_id": "<string>",
"current_version_id": "<string>",
"name": "<string>",
"params": {},
"status_reason": "<string>",
"task_metadata": {},
"updated_at": "2023-11-07T05:31:56Z"
}
],
"to_version": {
"author_email": "<string>",
"author_name": "<string>",
"branch_id": "<string>",
"deployed_at": "2023-11-07T05:31:56Z",
"git_branch": "<string>",
"git_hash": "<string>",
"id": "<string>",
"image_url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"failure_diagnostics": {},
"failure_reason": "<string>",
"git_message": "",
"image_expires_at": "2023-11-07T05:31:56Z",
"is_dirty": false,
"last_rollback_at": "2023-11-07T05:31:56Z",
"replicas": 0,
"retired_at": "2023-11-07T05:31:56Z",
"rollback_count": 0,
"rolled_back_at": "2023-11-07T05:31:56Z",
"source_filesystem_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"from_version_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Migrate tasks between versions within the same branch. Supports two modes:
- Bulk migration: Migrate all tasks from a source version (
from_version_id) - Specific tasks: Migrate specific tasks (
task_ids)
to_version_id) or the latest active version (to_latest).Body
application/json
Request model for migrating tasks between versions.
Response
Successful Response
Response model for task migration operation.
Was this page helpful?
⌘I
Migrate Tasks Between Versions
curl --request POST \
--url https://api.example.com/tasks/migrate \
--header 'Content-Type: application/json' \
--data '
{
"from_version_id": "<string>",
"task_ids": [
"<string>"
],
"to_latest": false,
"to_version_id": "<string>"
}
'import requests
url = "https://api.example.com/tasks/migrate"
payload = {
"from_version_id": "<string>",
"task_ids": ["<string>"],
"to_latest": False,
"to_version_id": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
from_version_id: '<string>',
task_ids: ['<string>'],
to_latest: false,
to_version_id: '<string>'
})
};
fetch('https://api.example.com/tasks/migrate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/tasks/migrate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from_version_id' => '<string>',
'task_ids' => [
'<string>'
],
'to_latest' => false,
'to_version_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/tasks/migrate"
payload := strings.NewReader("{\n \"from_version_id\": \"<string>\",\n \"task_ids\": [\n \"<string>\"\n ],\n \"to_latest\": false,\n \"to_version_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/tasks/migrate")
.header("Content-Type", "application/json")
.body("{\n \"from_version_id\": \"<string>\",\n \"task_ids\": [\n \"<string>\"\n ],\n \"to_latest\": false,\n \"to_version_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/tasks/migrate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"from_version_id\": \"<string>\",\n \"task_ids\": [\n \"<string>\"\n ],\n \"to_latest\": false,\n \"to_version_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"branch_id": "<string>",
"tasks": [
{
"filesystem_id": "<string>",
"id": "<string>",
"namespace_id": "<string>",
"agents": [
{
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"id": "<string>",
"name": "<string>",
"namespace_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"registered_at": "2023-11-07T05:31:56Z",
"registration_metadata": {},
"status": "ACTIVE",
"status_reason": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"created_version_id": "<string>",
"current_version_id": "<string>",
"name": "<string>",
"params": {},
"status_reason": "<string>",
"task_metadata": {},
"updated_at": "2023-11-07T05:31:56Z"
}
],
"to_version": {
"author_email": "<string>",
"author_name": "<string>",
"branch_id": "<string>",
"deployed_at": "2023-11-07T05:31:56Z",
"git_branch": "<string>",
"git_hash": "<string>",
"id": "<string>",
"image_url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"failure_diagnostics": {},
"failure_reason": "<string>",
"git_message": "",
"image_expires_at": "2023-11-07T05:31:56Z",
"is_dirty": false,
"last_rollback_at": "2023-11-07T05:31:56Z",
"replicas": 0,
"retired_at": "2023-11-07T05:31:56Z",
"rollback_count": 0,
"rolled_back_at": "2023-11-07T05:31:56Z",
"source_filesystem_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"from_version_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}