curl --request POST \
--url https://api.togai.com/v2/price_plans/migration \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"requireConfirmation": true,
"sourceId": "pp.1zYnCiM9Bpg.lv25y",
"sourceVersion": 1,
"targetId": "pp.2zYnCiM9Bpg.bfeu2",
"targetVersion": 2,
"migrationMode": "IMMEDIATE"
}
'import requests
url = "https://api.togai.com/v2/price_plans/migration"
payload = {
"requireConfirmation": True,
"sourceId": "pp.1zYnCiM9Bpg.lv25y",
"sourceVersion": 1,
"targetId": "pp.2zYnCiM9Bpg.bfeu2",
"targetVersion": 2,
"migrationMode": "IMMEDIATE"
}
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({
requireConfirmation: true,
sourceId: 'pp.1zYnCiM9Bpg.lv25y',
sourceVersion: 1,
targetId: 'pp.2zYnCiM9Bpg.bfeu2',
targetVersion: 2,
migrationMode: 'IMMEDIATE'
})
};
fetch('https://api.togai.com/v2/price_plans/migration', 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.togai.com/v2/price_plans/migration",
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([
'requireConfirmation' => true,
'sourceId' => 'pp.1zYnCiM9Bpg.lv25y',
'sourceVersion' => 1,
'targetId' => 'pp.2zYnCiM9Bpg.bfeu2',
'targetVersion' => 2,
'migrationMode' => 'IMMEDIATE'
]),
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://api.togai.com/v2/price_plans/migration"
payload := strings.NewReader("{\n \"requireConfirmation\": true,\n \"sourceId\": \"pp.1zYnCiM9Bpg.lv25y\",\n \"sourceVersion\": 1,\n \"targetId\": \"pp.2zYnCiM9Bpg.bfeu2\",\n \"targetVersion\": 2,\n \"migrationMode\": \"IMMEDIATE\"\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://api.togai.com/v2/price_plans/migration")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"requireConfirmation\": true,\n \"sourceId\": \"pp.1zYnCiM9Bpg.lv25y\",\n \"sourceVersion\": 1,\n \"targetId\": \"pp.2zYnCiM9Bpg.bfeu2\",\n \"targetVersion\": 2,\n \"migrationMode\": \"IMMEDIATE\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/v2/price_plans/migration")
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 \"requireConfirmation\": true,\n \"sourceId\": \"pp.1zYnCiM9Bpg.lv25y\",\n \"sourceVersion\": 1,\n \"targetId\": \"pp.2zYnCiM9Bpg.bfeu2\",\n \"targetVersion\": 2,\n \"migrationMode\": \"IMMEDIATE\"\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}Create a price plan v2 migration
Migrates accounts across price plans. This is an asynchronous process functioning on top of Togaiβs Jobs framework. Status of the created migrations can be obtained using the Jobs APIs
curl --request POST \
--url https://api.togai.com/v2/price_plans/migration \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"requireConfirmation": true,
"sourceId": "pp.1zYnCiM9Bpg.lv25y",
"sourceVersion": 1,
"targetId": "pp.2zYnCiM9Bpg.bfeu2",
"targetVersion": 2,
"migrationMode": "IMMEDIATE"
}
'import requests
url = "https://api.togai.com/v2/price_plans/migration"
payload = {
"requireConfirmation": True,
"sourceId": "pp.1zYnCiM9Bpg.lv25y",
"sourceVersion": 1,
"targetId": "pp.2zYnCiM9Bpg.bfeu2",
"targetVersion": 2,
"migrationMode": "IMMEDIATE"
}
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({
requireConfirmation: true,
sourceId: 'pp.1zYnCiM9Bpg.lv25y',
sourceVersion: 1,
targetId: 'pp.2zYnCiM9Bpg.bfeu2',
targetVersion: 2,
migrationMode: 'IMMEDIATE'
})
};
fetch('https://api.togai.com/v2/price_plans/migration', 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.togai.com/v2/price_plans/migration",
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([
'requireConfirmation' => true,
'sourceId' => 'pp.1zYnCiM9Bpg.lv25y',
'sourceVersion' => 1,
'targetId' => 'pp.2zYnCiM9Bpg.bfeu2',
'targetVersion' => 2,
'migrationMode' => 'IMMEDIATE'
]),
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://api.togai.com/v2/price_plans/migration"
payload := strings.NewReader("{\n \"requireConfirmation\": true,\n \"sourceId\": \"pp.1zYnCiM9Bpg.lv25y\",\n \"sourceVersion\": 1,\n \"targetId\": \"pp.2zYnCiM9Bpg.bfeu2\",\n \"targetVersion\": 2,\n \"migrationMode\": \"IMMEDIATE\"\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://api.togai.com/v2/price_plans/migration")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"requireConfirmation\": true,\n \"sourceId\": \"pp.1zYnCiM9Bpg.lv25y\",\n \"sourceVersion\": 1,\n \"targetId\": \"pp.2zYnCiM9Bpg.bfeu2\",\n \"targetVersion\": 2,\n \"migrationMode\": \"IMMEDIATE\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/v2/price_plans/migration")
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 \"requireConfirmation\": true,\n \"sourceId\": \"pp.1zYnCiM9Bpg.lv25y\",\n \"sourceVersion\": 1,\n \"targetId\": \"pp.2zYnCiM9Bpg.bfeu2\",\n \"targetVersion\": 2,\n \"migrationMode\": \"IMMEDIATE\"\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}Authorizations
Body
Payload to create price plan migration request
Request to create price plan migration request
If this flag is true, current pricing cycle of the account on the date of association will continue rather
than the configurations of the newly associated price plan. Pricing cycle overrides specified using
pricePlanDetailsOverride will take precedence over the pricing cycle configurations of
the new price plan that the account needs to migrate to. PricingCycleInterval of the existing plan and
the new plan must be same for this to work. We'll return a 400 BadRequest otherwise.
Examples:
- Ongoing plan (1st Oct to 30th Oct) - {dayOffset: 1, monthOffset: NIL} New association (15th Oct to 15th Nov) of different price plan with retainStartOffsets option true will use the same pricing cycle configuration {dayOffset: 1, monthOffset: NIL} rather than using the pricing cycle configuration of the new price plan that the account needs to migrate to.
- Ongoing plan (1st Oct to 30th Oct) - {dayOffset: 1, monthOffset: NIL}
New association (1st Nov to 30th Nov) of different price plan with retainStartOffsets option true will
throw a
400 BadRequestas no existing price plan configuration found on date of association
