Create Threshold Assignment
curl --request POST \
--url https://api.telegent.com/v1.0/subscriptions/thresholds/assignments/add \
--header 'Content-Type: application/json' \
--data '
{
"ThresholdId": "THID-a1b2c3d4-0000-0000-0000-000000000001",
"SubscriptionId": "SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c"
}
'import requests
url = "https://api.telegent.com/v1.0/subscriptions/thresholds/assignments/add"
payload = {
"ThresholdId": "THID-a1b2c3d4-0000-0000-0000-000000000001",
"SubscriptionId": "SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c"
}
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({
ThresholdId: 'THID-a1b2c3d4-0000-0000-0000-000000000001',
SubscriptionId: 'SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c'
})
};
fetch('https://api.telegent.com/v1.0/subscriptions/thresholds/assignments/add', 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.telegent.com/v1.0/subscriptions/thresholds/assignments/add",
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([
'ThresholdId' => 'THID-a1b2c3d4-0000-0000-0000-000000000001',
'SubscriptionId' => 'SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c'
]),
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.telegent.com/v1.0/subscriptions/thresholds/assignments/add"
payload := strings.NewReader("{\n \"ThresholdId\": \"THID-a1b2c3d4-0000-0000-0000-000000000001\",\n \"SubscriptionId\": \"SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c\"\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.telegent.com/v1.0/subscriptions/thresholds/assignments/add")
.header("Content-Type", "application/json")
.body("{\n \"ThresholdId\": \"THID-a1b2c3d4-0000-0000-0000-000000000001\",\n \"SubscriptionId\": \"SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telegent.com/v1.0/subscriptions/thresholds/assignments/add")
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 \"ThresholdId\": \"THID-a1b2c3d4-0000-0000-0000-000000000001\",\n \"SubscriptionId\": \"SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c\"\n}"
response = http.request(request)
puts response.read_body{
"ThresholdAssignmentId": "TAID-00000001-0000-0000-0000-000000000001",
"ThresholdId": "THID-a1b2c3d4-0000-0000-0000-000000000001",
"SubscriptionId": "SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c",
"Active": true
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}Subscriptions
Create Threshold Assignment
Assign an existing threshold to a subscription. Once assigned, the threshold monitors that subscription’s resource usage and fires its configured action when the limit is reached.
What this does: Returns the new ThresholdAssignmentId and assignment record. A threshold can be assigned to multiple subscriptions; each assignment is tracked independently.
Next steps:
- View all assignments for this threshold —
GET /v1.0/subscriptions/thresholds/assignments - Remove the assignment —
POST /v1.0/subscriptions/thresholds/assignments/delete
POST
/
v1.0
/
subscriptions
/
thresholds
/
assignments
/
add
Create Threshold Assignment
curl --request POST \
--url https://api.telegent.com/v1.0/subscriptions/thresholds/assignments/add \
--header 'Content-Type: application/json' \
--data '
{
"ThresholdId": "THID-a1b2c3d4-0000-0000-0000-000000000001",
"SubscriptionId": "SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c"
}
'import requests
url = "https://api.telegent.com/v1.0/subscriptions/thresholds/assignments/add"
payload = {
"ThresholdId": "THID-a1b2c3d4-0000-0000-0000-000000000001",
"SubscriptionId": "SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c"
}
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({
ThresholdId: 'THID-a1b2c3d4-0000-0000-0000-000000000001',
SubscriptionId: 'SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c'
})
};
fetch('https://api.telegent.com/v1.0/subscriptions/thresholds/assignments/add', 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.telegent.com/v1.0/subscriptions/thresholds/assignments/add",
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([
'ThresholdId' => 'THID-a1b2c3d4-0000-0000-0000-000000000001',
'SubscriptionId' => 'SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c'
]),
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.telegent.com/v1.0/subscriptions/thresholds/assignments/add"
payload := strings.NewReader("{\n \"ThresholdId\": \"THID-a1b2c3d4-0000-0000-0000-000000000001\",\n \"SubscriptionId\": \"SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c\"\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.telegent.com/v1.0/subscriptions/thresholds/assignments/add")
.header("Content-Type", "application/json")
.body("{\n \"ThresholdId\": \"THID-a1b2c3d4-0000-0000-0000-000000000001\",\n \"SubscriptionId\": \"SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telegent.com/v1.0/subscriptions/thresholds/assignments/add")
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 \"ThresholdId\": \"THID-a1b2c3d4-0000-0000-0000-000000000001\",\n \"SubscriptionId\": \"SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c\"\n}"
response = http.request(request)
puts response.read_body{
"ThresholdAssignmentId": "TAID-00000001-0000-0000-0000-000000000001",
"ThresholdId": "THID-a1b2c3d4-0000-0000-0000-000000000001",
"SubscriptionId": "SUB-ef84c0b5-d750-4a5a-99b1-4705089cd20c",
"Active": true
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}Body
application/jsontext/jsonapplication/*+json
Threshold_Assignment object
Response
Success — returns the new threshold assignment ID and record
The response is of type object.
⌘I