curl --request GET \
--url https://api.pnplayer.com/v1/api/analytics \
--header 'X-Auth-Token: <api-key>'import requests
url = "https://api.pnplayer.com/v1/api/analytics"
headers = {"X-Auth-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Auth-Token': '<api-key>'}};
fetch('https://api.pnplayer.com/v1/api/analytics', 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.pnplayer.com/v1/api/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Auth-Token: <api-key>"
],
]);
$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://api.pnplayer.com/v1/api/analytics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Auth-Token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.pnplayer.com/v1/api/analytics")
.header("X-Auth-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pnplayer.com/v1/api/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Auth-Token"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"totalPlays": 123,
"totalWatch": 123,
"playsDateWise": [
{}
],
"categoryWise": [
{}
],
"countryWise": [
{}
],
"videoWise": [
{}
],
"totalBandwidthUsed": 123,
"storageUsed": 123,
"averageServerResponseTime": 123,
"bandwidthUsage": {},
"geoTrafficUsage": {}
}{
"message": "Forbidden"
}{
"message": "<string>"
}Get analytics overview
Returns plays and watch time for a date range, broken down by date, category, country and video. The range defaults to the current month. Add includeBandwidth=true to include CDN bandwidth, storage and response-time figures. Requires the READ_ANALYTICS scope.
curl --request GET \
--url https://api.pnplayer.com/v1/api/analytics \
--header 'X-Auth-Token: <api-key>'import requests
url = "https://api.pnplayer.com/v1/api/analytics"
headers = {"X-Auth-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Auth-Token': '<api-key>'}};
fetch('https://api.pnplayer.com/v1/api/analytics', 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.pnplayer.com/v1/api/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Auth-Token: <api-key>"
],
]);
$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://api.pnplayer.com/v1/api/analytics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Auth-Token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.pnplayer.com/v1/api/analytics")
.header("X-Auth-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pnplayer.com/v1/api/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Auth-Token"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"totalPlays": 123,
"totalWatch": 123,
"playsDateWise": [
{}
],
"categoryWise": [
{}
],
"countryWise": [
{}
],
"videoWise": [
{}
],
"totalBandwidthUsed": 123,
"storageUsed": 123,
"averageServerResponseTime": 123,
"bandwidthUsage": {},
"geoTrafficUsage": {}
}{
"message": "Forbidden"
}{
"message": "<string>"
}Authorizations
API key created in the dashboard or via POST /v1/api/api-keys. Keys are prefixed pn_ and do not expire until revoked.
Query Parameters
Start date (YYYY-MM-DD). Defaults to the start of the current month.
End date (YYYY-MM-DD). Defaults to today.
Any non-empty value adds bandwidth, storage and CDN metrics
"true"
Filter by traffic source
Comma-separated tag IDs. Restricts results to videos carrying any of the tags.
ISO country code filter
"AU"
Restrict to a single video ID
Response
Analytics overview
Total watch time in seconds
Bytes. Only with includeBandwidth.
MB. Only with includeBandwidth.
Only with includeBandwidth
Bandwidth chart series. Only with includeBandwidth.
Traffic by region. Only with includeBandwidth.
