Migrate APIs from Tyk Classic to Tyk OAS format.
curl --request POST \
--url https://{tenant}/api/apis/migrate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mode": "dryRun",
"apiIDs": [
"api123",
"api456"
],
"abortOnFailure": true
}
'import requests
url = "https://{tenant}/api/apis/migrate"
payload = {
"mode": "dryRun",
"apiIDs": ["api123", "api456"],
"abortOnFailure": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({mode: 'dryRun', apiIDs: ['api123', 'api456'], abortOnFailure: true})
};
fetch('https://{tenant}/api/apis/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://{tenant}/api/apis/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([
'mode' => 'dryRun',
'apiIDs' => [
'api123',
'api456'
],
'abortOnFailure' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://{tenant}/api/apis/migrate"
payload := strings.NewReader("{\n \"mode\": \"dryRun\",\n \"apiIDs\": [\n \"api123\",\n \"api456\"\n ],\n \"abortOnFailure\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{tenant}/api/apis/migrate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mode\": \"dryRun\",\n \"apiIDs\": [\n \"api123\",\n \"api456\"\n ],\n \"abortOnFailure\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/apis/migrate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mode\": \"dryRun\",\n \"apiIDs\": [\n \"api123\",\n \"api456\"\n ],\n \"abortOnFailure\": true\n}"
response = http.request(request)
puts response.read_body{
"success": {
"count": 123,
"apiIDs": [
"<string>"
],
"stagedAPIs": [
{
"classicAPIID": "<string>",
"oasAPIID": "<string>"
}
],
"definitions": [
{
"apiID": "<string>",
"baseAPI": {},
"versions": [
{}
]
}
]
},
"failure": {
"count": 123,
"errors": [
{
"apiID": "<string>",
"message": [
"<string>"
]
}
]
},
"skipped": {
"count": 123,
"apis": [
{
"apiID": "<string>",
"message": "<string>",
"key": "already_migrated"
}
]
},
"abortedOnFailure": true
}{
"ID": "<string>",
"Message": "<string>",
"Meta": "<unknown>",
"Status": "<string>"
}{
"ID": "<string>",
"Message": "<string>",
"Meta": "<unknown>",
"Status": "<string>"
}MigrateOAS
Migrate APIs from Tyk Classic to Tyk OAS format.
Migrate APIs from Tyk Classic to Tyk OAS format. The endpoint supports different migration modes including dry run, staging, promotion and direct migration.
POST
/
api
/
apis
/
migrate
Migrate APIs from Tyk Classic to Tyk OAS format.
curl --request POST \
--url https://{tenant}/api/apis/migrate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mode": "dryRun",
"apiIDs": [
"api123",
"api456"
],
"abortOnFailure": true
}
'import requests
url = "https://{tenant}/api/apis/migrate"
payload = {
"mode": "dryRun",
"apiIDs": ["api123", "api456"],
"abortOnFailure": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({mode: 'dryRun', apiIDs: ['api123', 'api456'], abortOnFailure: true})
};
fetch('https://{tenant}/api/apis/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://{tenant}/api/apis/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([
'mode' => 'dryRun',
'apiIDs' => [
'api123',
'api456'
],
'abortOnFailure' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://{tenant}/api/apis/migrate"
payload := strings.NewReader("{\n \"mode\": \"dryRun\",\n \"apiIDs\": [\n \"api123\",\n \"api456\"\n ],\n \"abortOnFailure\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{tenant}/api/apis/migrate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mode\": \"dryRun\",\n \"apiIDs\": [\n \"api123\",\n \"api456\"\n ],\n \"abortOnFailure\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/apis/migrate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mode\": \"dryRun\",\n \"apiIDs\": [\n \"api123\",\n \"api456\"\n ],\n \"abortOnFailure\": true\n}"
response = http.request(request)
puts response.read_body{
"success": {
"count": 123,
"apiIDs": [
"<string>"
],
"stagedAPIs": [
{
"classicAPIID": "<string>",
"oasAPIID": "<string>"
}
],
"definitions": [
{
"apiID": "<string>",
"baseAPI": {},
"versions": [
{}
]
}
]
},
"failure": {
"count": 123,
"errors": [
{
"apiID": "<string>",
"message": [
"<string>"
]
}
]
},
"skipped": {
"count": 123,
"apis": [
{
"apiID": "<string>",
"message": "<string>",
"key": "already_migrated"
}
]
},
"abortedOnFailure": true
}{
"ID": "<string>",
"Message": "<string>",
"Meta": "<unknown>",
"Status": "<string>"
}{
"ID": "<string>",
"Message": "<string>",
"Meta": "<unknown>",
"Status": "<string>"
}Body
application/json
Response
Migration completed
migration API response object
Was this page helpful?