Fetch usage
curl --request POST \
--url https://apimgmt.cometchat.io/apps/{appId}/usage \
--header 'Content-Type: application/json' \
--header 'key: <key>' \
--header 'secret: <secret>' \
--data '
{
"usePreviousBillingCycle": true
}
'import requests
url = "https://apimgmt.cometchat.io/apps/{appId}/usage"
payload = { "usePreviousBillingCycle": True }
headers = {
"key": "<key>",
"secret": "<secret>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {key: '<key>', secret: '<secret>', 'Content-Type': 'application/json'},
body: JSON.stringify({usePreviousBillingCycle: true})
};
fetch('https://apimgmt.cometchat.io/apps/{appId}/usage', 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://apimgmt.cometchat.io/apps/{appId}/usage",
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([
'usePreviousBillingCycle' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"key: <key>",
"secret: <secret>"
],
]);
$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://apimgmt.cometchat.io/apps/{appId}/usage"
payload := strings.NewReader("{\n \"usePreviousBillingCycle\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("key", "<key>")
req.Header.Add("secret", "<secret>")
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://apimgmt.cometchat.io/apps/{appId}/usage")
.header("key", "<key>")
.header("secret", "<secret>")
.header("Content-Type", "application/json")
.body("{\n \"usePreviousBillingCycle\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apimgmt.cometchat.io/apps/{appId}/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["key"] = '<key>'
request["secret"] = '<secret>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"usePreviousBillingCycle\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"success": true,
"message": "Your usage request has been accepted and is being processed for . You will receive an email with the details at <emailID>@example.com"
}
}App
Fetch usage
Retrieves usage data for multi-tenant apps.
POST
/
apps
/
{appId}
/
usage
Fetch usage
curl --request POST \
--url https://apimgmt.cometchat.io/apps/{appId}/usage \
--header 'Content-Type: application/json' \
--header 'key: <key>' \
--header 'secret: <secret>' \
--data '
{
"usePreviousBillingCycle": true
}
'import requests
url = "https://apimgmt.cometchat.io/apps/{appId}/usage"
payload = { "usePreviousBillingCycle": True }
headers = {
"key": "<key>",
"secret": "<secret>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {key: '<key>', secret: '<secret>', 'Content-Type': 'application/json'},
body: JSON.stringify({usePreviousBillingCycle: true})
};
fetch('https://apimgmt.cometchat.io/apps/{appId}/usage', 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://apimgmt.cometchat.io/apps/{appId}/usage",
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([
'usePreviousBillingCycle' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"key: <key>",
"secret: <secret>"
],
]);
$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://apimgmt.cometchat.io/apps/{appId}/usage"
payload := strings.NewReader("{\n \"usePreviousBillingCycle\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("key", "<key>")
req.Header.Add("secret", "<secret>")
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://apimgmt.cometchat.io/apps/{appId}/usage")
.header("key", "<key>")
.header("secret", "<secret>")
.header("Content-Type", "application/json")
.body("{\n \"usePreviousBillingCycle\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apimgmt.cometchat.io/apps/{appId}/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["key"] = '<key>'
request["secret"] = '<secret>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"usePreviousBillingCycle\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"success": true,
"message": "Your usage request has been accepted and is being processed for . You will receive an email with the details at <emailID>@example.com"
}
}For the complete error reference, see Error Guide.
Path Parameters
The parent appId to which the subscription is linked.
Body
application/json
Indicates whether the usage from the previous billing cycle should be retrieved.
If set to false, the usage for the current cycle will be fetched.
If set to true, the usage from the previous cycle will be fetched.
Response
200 - application/json
Updated App
Show child attributes
Show child attributes
Was this page helpful?
⌘I