Skip to main content
POST
/
v2
/
accounts
/
{account_id}
/
edit_schedules
Bulk edit schedules of an account
curl --request POST \
  --url https://api.togai.com/v2/accounts/{account_id}/edit_schedules \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "edits": [
    {
      "effectiveFrom": "2023-12-25",
      "effectiveUntil": "2023-12-25",
      "associationConfig": {
        "pricePlanId": "<string>",
        "scheduleId": "<string>",
        "retainStartOffsets": true
      },
      "mergeSchedules": true
    }
  ]
}
'
import requests

url = "https://api.togai.com/v2/accounts/{account_id}/edit_schedules"

payload = { "edits": [
{
"effectiveFrom": "2023-12-25",
"effectiveUntil": "2023-12-25",
"associationConfig": {
"pricePlanId": "<string>",
"scheduleId": "<string>",
"retainStartOffsets": True
},
"mergeSchedules": 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({
edits: [
{
effectiveFrom: '2023-12-25',
effectiveUntil: '2023-12-25',
associationConfig: {pricePlanId: '<string>', scheduleId: '<string>', retainStartOffsets: true},
mergeSchedules: true
}
]
})
};

fetch('https://api.togai.com/v2/accounts/{account_id}/edit_schedules', 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/accounts/{account_id}/edit_schedules",
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([
'edits' => [
[
'effectiveFrom' => '2023-12-25',
'effectiveUntil' => '2023-12-25',
'associationConfig' => [
'pricePlanId' => '<string>',
'scheduleId' => '<string>',
'retainStartOffsets' => true
],
'mergeSchedules' => 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://api.togai.com/v2/accounts/{account_id}/edit_schedules"

payload := strings.NewReader("{\n \"edits\": [\n {\n \"effectiveFrom\": \"2023-12-25\",\n \"effectiveUntil\": \"2023-12-25\",\n \"associationConfig\": {\n \"pricePlanId\": \"<string>\",\n \"scheduleId\": \"<string>\",\n \"retainStartOffsets\": true\n },\n \"mergeSchedules\": true\n }\n ]\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/accounts/{account_id}/edit_schedules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"edits\": [\n {\n \"effectiveFrom\": \"2023-12-25\",\n \"effectiveUntil\": \"2023-12-25\",\n \"associationConfig\": {\n \"pricePlanId\": \"<string>\",\n \"scheduleId\": \"<string>\",\n \"retainStartOffsets\": true\n },\n \"mergeSchedules\": true\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.togai.com/v2/accounts/{account_id}/edit_schedules")

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 \"edits\": [\n {\n \"effectiveFrom\": \"2023-12-25\",\n \"effectiveUntil\": \"2023-12-25\",\n \"associationConfig\": {\n \"pricePlanId\": \"<string>\",\n \"scheduleId\": \"<string>\",\n \"retainStartOffsets\": true\n },\n \"mergeSchedules\": true\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "accountId": "G234DZZKBKACATFFGVGEMERFI",
  "accountName": "ACME Enterprise - Account2",
  "pricingSchedules": [
    {
      "id": "sch.4325kbjedsc.34dww",
      "pricePlanId": "pp.1zYnCiM9Bpg.lv25y",
      "pricePlanName": "ENTERPRISE_PLAN",
      "startDate": "2022-12-02T00:00:00Z",
      "endDate": "9999-01-01T00:00:00Z"
    }
  ]
}
{
"message": "<Reason message>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

account_id
string
required

account_id corresponding to an account

Maximum string length: 50
Example:

"ACC00001"

Query Parameters

discard
boolean
Example:

false

Body

application/json

Payload to edit schedules of an account

Request to dis/associate one or more schedules to an account

edits
object[]
required
Required array length: 1 - 10 elements

Response

Response for dis/associate price plan request

accountId
string
required

Identifier of the account

Maximum string length: 50
accountName
string
required

Name of the Account

pricingSchedules
object[]
required