Change a channel's notifications
curl --request PUT \
--url https://api.liara.ir/v1/channels/{channelID} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "email",
"interestedNotifications": [
"LowCredit",
"TicketCreated",
"TicketCommentCreated"
]
}
'import requests
url = "https://api.liara.ir/v1/channels/{channelID}"
payload = {
"type": "email",
"interestedNotifications": ["LowCredit", "TicketCreated", "TicketCommentCreated"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'email',
interestedNotifications: ['LowCredit', 'TicketCreated', 'TicketCommentCreated']
})
};
fetch('https://api.liara.ir/v1/channels/{channelID}', 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.liara.ir/v1/channels/{channelID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'email',
'interestedNotifications' => [
'LowCredit',
'TicketCreated',
'TicketCommentCreated'
]
]),
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.liara.ir/v1/channels/{channelID}"
payload := strings.NewReader("{\n \"type\": \"email\",\n \"interestedNotifications\": [\n \"LowCredit\",\n \"TicketCreated\",\n \"TicketCommentCreated\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.liara.ir/v1/channels/{channelID}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"email\",\n \"interestedNotifications\": [\n \"LowCredit\",\n \"TicketCreated\",\n \"TicketCommentCreated\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.liara.ir/v1/channels/{channelID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"email\",\n \"interestedNotifications\": [\n \"LowCredit\",\n \"TicketCreated\",\n \"TicketCommentCreated\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 400,
"error": "Bad Request",
"message": "Request param is not valid.",
"data": null
}{
"error": "Unauthorized."
}{
"statusCode": 123,
"error": "<string>",
"message": "<string>",
"data": {
"code": "<string>"
}
}{
"statusCode": 404,
"error": "Not Found",
"message": "Channel not found.",
"data": null
}Notification Channels
Change a channel's notifications
Replaces the notification types sent to a channel. type must match the channel’s type. Your account must be verified. With teamID, this needs the team.manage permission.
PUT
/
v1
/
channels
/
{channelID}
Change a channel's notifications
curl --request PUT \
--url https://api.liara.ir/v1/channels/{channelID} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "email",
"interestedNotifications": [
"LowCredit",
"TicketCreated",
"TicketCommentCreated"
]
}
'import requests
url = "https://api.liara.ir/v1/channels/{channelID}"
payload = {
"type": "email",
"interestedNotifications": ["LowCredit", "TicketCreated", "TicketCommentCreated"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'email',
interestedNotifications: ['LowCredit', 'TicketCreated', 'TicketCommentCreated']
})
};
fetch('https://api.liara.ir/v1/channels/{channelID}', 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.liara.ir/v1/channels/{channelID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'email',
'interestedNotifications' => [
'LowCredit',
'TicketCreated',
'TicketCommentCreated'
]
]),
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.liara.ir/v1/channels/{channelID}"
payload := strings.NewReader("{\n \"type\": \"email\",\n \"interestedNotifications\": [\n \"LowCredit\",\n \"TicketCreated\",\n \"TicketCommentCreated\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.liara.ir/v1/channels/{channelID}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"email\",\n \"interestedNotifications\": [\n \"LowCredit\",\n \"TicketCreated\",\n \"TicketCommentCreated\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.liara.ir/v1/channels/{channelID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"email\",\n \"interestedNotifications\": [\n \"LowCredit\",\n \"TicketCreated\",\n \"TicketCommentCreated\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 400,
"error": "Bad Request",
"message": "Request param is not valid.",
"data": null
}{
"error": "Unauthorized."
}{
"statusCode": 123,
"error": "<string>",
"message": "<string>",
"data": {
"code": "<string>"
}
}{
"statusCode": 404,
"error": "Not Found",
"message": "Channel not found.",
"data": null
}Authorizations
Send your API token as Authorization: Bearer <api-token>.
Path Parameters
24-character hexadecimal ID.
Pattern:
^[0-9a-fA-F]{24}$Query Parameters
Run the request in the context of a team you belong to, instead of your personal account. 24-character hexadecimal ID.
Pattern:
^[0-9a-fA-F]{24}$Body
application/json
Response
The channel was updated. The response body is empty.
⌘I
