json
{
"ServiceName": "Caller Id",
"Cost": 1.23,
"Monthly": true
}curl -X POST https://api.telegent.com/v1.0/services \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"ServiceName": "Caller Id",
"Cost": 1.23,
"Monthly": true
}'import requests
url = "https://api.telegent.com/v1.0/services"
payload = {
"ServiceName": "Caller Id",
"Cost": 1.23,
"Monthly": True
}
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({ServiceName: 'Caller Id', Cost: 1.23, Monthly: true})
};
fetch('https://api.telegent.com/v1.0/services', 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/services",
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([
'ServiceName' => 'Caller Id',
'Cost' => 1.23,
'Monthly' => true
]),
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/services"
payload := strings.NewReader("{\n \"ServiceName\": \"Caller Id\",\n \"Cost\": 1.23,\n \"Monthly\": true\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/services")
.header("Content-Type", "application/json")
.body("{\n \"ServiceName\": \"Caller Id\",\n \"Cost\": 1.23,\n \"Monthly\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telegent.com/v1.0/services")
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 \"ServiceName\": \"Caller Id\",\n \"Cost\": 1.23,\n \"Monthly\": true\n}"
response = http.request(request)
puts response.read_body{
"ServiceId": "SID-65d007be-8b49-45ac-b8ae-77b8d6a66c8b",
"ServiceName": "Caller Id",
"Cost": 1.23,
"Monthly": true,
"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>"
}Services
Create Service
Create a new service with a name, cost, and billing frequency. Services can be added to packages and assigned to subscribers.
What this does: Returns the new service’s ServiceId (SID-) and full record. Services are the billable unit; add pricing tiers using the service items endpoints, then associate the service with products.
Next steps:
- Add a pricing item —
POST /v1.0/services/items/add
POST
/
v1.0
/
services
json
{
"ServiceName": "Caller Id",
"Cost": 1.23,
"Monthly": true
}curl -X POST https://api.telegent.com/v1.0/services \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"ServiceName": "Caller Id",
"Cost": 1.23,
"Monthly": true
}'import requests
url = "https://api.telegent.com/v1.0/services"
payload = {
"ServiceName": "Caller Id",
"Cost": 1.23,
"Monthly": True
}
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({ServiceName: 'Caller Id', Cost: 1.23, Monthly: true})
};
fetch('https://api.telegent.com/v1.0/services', 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/services",
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([
'ServiceName' => 'Caller Id',
'Cost' => 1.23,
'Monthly' => true
]),
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/services"
payload := strings.NewReader("{\n \"ServiceName\": \"Caller Id\",\n \"Cost\": 1.23,\n \"Monthly\": true\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/services")
.header("Content-Type", "application/json")
.body("{\n \"ServiceName\": \"Caller Id\",\n \"Cost\": 1.23,\n \"Monthly\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telegent.com/v1.0/services")
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 \"ServiceName\": \"Caller Id\",\n \"Cost\": 1.23,\n \"Monthly\": true\n}"
response = http.request(request)
puts response.read_body{
"ServiceId": "SID-65d007be-8b49-45ac-b8ae-77b8d6a66c8b",
"ServiceName": "Caller Id",
"Cost": 1.23,
"Monthly": true,
"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>"
}⌘I