Query community activity metrics
curl --request GET \
--url https://apix.us.amity.co/api/v1/analytics/community-metrics/{communityId}/activities \
--header 'Authorization: Bearer <token>'import requests
url = "https://apix.us.amity.co/api/v1/analytics/community-metrics/{communityId}/activities"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://apix.us.amity.co/api/v1/analytics/community-metrics/{communityId}/activities', 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://apix.us.amity.co/api/v1/analytics/community-metrics/{communityId}/activities",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://apix.us.amity.co/api/v1/analytics/community-metrics/{communityId}/activities"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://apix.us.amity.co/api/v1/analytics/community-metrics/{communityId}/activities")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v1/analytics/community-metrics/{communityId}/activities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"granularity": "daily",
"from": "2024-05-01",
"to": "2024-05-05",
"data": [
{
"date": "2024-05-01",
"total_posts": 1,
"total_comments": 0,
"total_reactions": 2
},
{
"date": "2024-05-02",
"total_posts": 0,
"total_comments": 0,
"total_reactions": 0
},
{
"date": "2024-05-03",
"total_posts": 5,
"total_comments": 2,
"total_reactions": 1
},
{
"date": "2024-05-04",
"total_posts": 0,
"total_comments": 0,
"total_reactions": 0
},
{
"date": "2024-05-05",
"total_posts": 2,
"total_comments": 1,
"total_reactions": 3
}
]
}Analytic
Query community activity metrics
Returns post/comment/reaction activity metrics for a community.
Modes:
- granularity=daily: time series (zero-filled missing dates)
- granularity=aggregate: aggregate totals across range
GET
/
api
/
v1
/
analytics
/
community-metrics
/
{communityId}
/
activities
Query community activity metrics
curl --request GET \
--url https://apix.us.amity.co/api/v1/analytics/community-metrics/{communityId}/activities \
--header 'Authorization: Bearer <token>'import requests
url = "https://apix.us.amity.co/api/v1/analytics/community-metrics/{communityId}/activities"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://apix.us.amity.co/api/v1/analytics/community-metrics/{communityId}/activities', 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://apix.us.amity.co/api/v1/analytics/community-metrics/{communityId}/activities",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://apix.us.amity.co/api/v1/analytics/community-metrics/{communityId}/activities"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://apix.us.amity.co/api/v1/analytics/community-metrics/{communityId}/activities")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v1/analytics/community-metrics/{communityId}/activities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"granularity": "daily",
"from": "2024-05-01",
"to": "2024-05-05",
"data": [
{
"date": "2024-05-01",
"total_posts": 1,
"total_comments": 0,
"total_reactions": 2
},
{
"date": "2024-05-02",
"total_posts": 0,
"total_comments": 0,
"total_reactions": 0
},
{
"date": "2024-05-03",
"total_posts": 5,
"total_comments": 2,
"total_reactions": 1
},
{
"date": "2024-05-04",
"total_posts": 0,
"total_comments": 0,
"total_reactions": 0
},
{
"date": "2024-05-05",
"total_posts": 2,
"total_comments": 1,
"total_reactions": 3
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Community ID
Query Parameters
Inclusive start date (YYYY-MM-DD). Defaults to 7 days before yesterday.
Inclusive end date (YYYY-MM-DD). Defaults to yesterday.
daily (default) or aggregate.
Available options:
daily, aggregate ⌘I