Run a custom report
curl --request POST \
--url https://api.pnplayer.com/v1/api/analytics/raw \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"from": "2023-12-25",
"to": "2023-12-25",
"videoIds": [
"<string>"
],
"tags": [
123
]
}
'import requests
url = "https://api.pnplayer.com/v1/api/analytics/raw"
payload = {
"from": "2023-12-25",
"to": "2023-12-25",
"videoIds": ["<string>"],
"tags": [123]
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({from: '2023-12-25', to: '2023-12-25', videoIds: ['<string>'], tags: [123]})
};
fetch('https://api.pnplayer.com/v1/api/analytics/raw', 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/raw",
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([
'from' => '2023-12-25',
'to' => '2023-12-25',
'videoIds' => [
'<string>'
],
'tags' => [
123
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pnplayer.com/v1/api/analytics/raw"
payload := strings.NewReader("{\n \"from\": \"2023-12-25\",\n \"to\": \"2023-12-25\",\n \"videoIds\": [\n \"<string>\"\n ],\n \"tags\": [\n 123\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Auth-Token", "<api-key>")
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.pnplayer.com/v1/api/analytics/raw")
.header("X-Auth-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"2023-12-25\",\n \"to\": \"2023-12-25\",\n \"videoIds\": [\n \"<string>\"\n ],\n \"tags\": [\n 123\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pnplayer.com/v1/api/analytics/raw")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Auth-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": \"2023-12-25\",\n \"to\": \"2023-12-25\",\n \"videoIds\": [\n \"<string>\"\n ],\n \"tags\": [\n 123\n ]\n}"
response = http.request(request)
puts response.read_body{
"summary": {},
"dateWise": [
{}
],
"data": [
{}
],
"totalRows": 123
}{
"message": "<string>"
}{
"message": "Forbidden"
}{
"message": "<string>"
}Analytics
Run a custom report
Runs a custom analytics query and returns tabular rows plus a date-wise series, or streams a CSV when download is set. tags are resolved to video IDs before the query runs; a tag with no videos yields an empty report. Requires the READ_ANALYTICS scope.
POST
/
v1
/
api
/
analytics
/
raw
Run a custom report
curl --request POST \
--url https://api.pnplayer.com/v1/api/analytics/raw \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"from": "2023-12-25",
"to": "2023-12-25",
"videoIds": [
"<string>"
],
"tags": [
123
]
}
'import requests
url = "https://api.pnplayer.com/v1/api/analytics/raw"
payload = {
"from": "2023-12-25",
"to": "2023-12-25",
"videoIds": ["<string>"],
"tags": [123]
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({from: '2023-12-25', to: '2023-12-25', videoIds: ['<string>'], tags: [123]})
};
fetch('https://api.pnplayer.com/v1/api/analytics/raw', 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/raw",
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([
'from' => '2023-12-25',
'to' => '2023-12-25',
'videoIds' => [
'<string>'
],
'tags' => [
123
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pnplayer.com/v1/api/analytics/raw"
payload := strings.NewReader("{\n \"from\": \"2023-12-25\",\n \"to\": \"2023-12-25\",\n \"videoIds\": [\n \"<string>\"\n ],\n \"tags\": [\n 123\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Auth-Token", "<api-key>")
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.pnplayer.com/v1/api/analytics/raw")
.header("X-Auth-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"2023-12-25\",\n \"to\": \"2023-12-25\",\n \"videoIds\": [\n \"<string>\"\n ],\n \"tags\": [\n 123\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pnplayer.com/v1/api/analytics/raw")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Auth-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": \"2023-12-25\",\n \"to\": \"2023-12-25\",\n \"videoIds\": [\n \"<string>\"\n ],\n \"tags\": [\n 123\n ]\n}"
response = http.request(request)
puts response.read_body{
"summary": {},
"dateWise": [
{}
],
"data": [
{}
],
"totalRows": 123
}{
"message": "<string>"
}{
"message": "Forbidden"
}{
"message": "<string>"
}Authorizations
apiKeyAuthbearerAuth
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
Return a CSV of the table rows or the dateWise series instead of JSON
Available options:
table, dateWise Body
application/json
