/charts EndpointThe /charts endpoint is a POST endpoint in our Podcast Performance Server designed to return episode performance data based on a provided GUID and a valid Podcast Performance Admin Token. This document provides a step-by-step guide on how to use this endpoint.
/chartsAuthorization: Bearer <Podcast Performance Admin Token>guid and optionally publickey properties/token endpoint first.PERFORMANCE_SECRET_KEY & PERFORMANCE_PUBLIC_KEY environment variable is set on your server.The request body must be a JSON object with the following properties:
guid: The unique identifier for the episode.{
"guid": "your-episode-guid",
}
curl --location --request POST 'http://localhost:7000/charts' \
--header 'Authorization: Bearer your-podcast-performance-admin-token' \
--header 'Content-Type: application/json' \
--data-raw '{
"guid": "your-episode-guid"
}'
curl --location --request POST 'http://localhost:7000/charts' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzIjoibHd1czh6NnAtZDYyNjBhN2RkYmIwODZlNCIsImQiOiIxIiwiYSI6dHJ1ZSwiaWF0IjoxNzE3MTY1OTE0LCJleHAiOjE3MTcxNjk1MTR9.eUTxAjLJ8NcP_I-mNgVAlUyQSJpSIuuQBNz6wDiYcXM' \
--header 'Content-Type: application/json' \
--data-raw '{
"guid": "your-episode-guid"
}'
The response will be a JSON object containing the following properties:
guid: The GUID of the episode.duration: The total duration of the episode in seconds.data: An array of objects, each containing time and percentage properties representing the performance data.{
"guid": "your-episode-guid",
"duration": 3600,
"data": [
{ "time": 0, "percentage": 100 },
{ "time": 10, "percentage": 95 },
// more data points...
]
}
The endpoint may return various HTTP status codes to indicate errors:
401 Unauthorized: Invalid or missing Podcast Performance Admin Token.400 Bad Request: Invalid request body.404 Not Found: Episode not found or no data found for the episode.500 Internal Server Error: Server encountered an unexpected condition.{
"error": "Unauthorized"
}
The /charts endpoint is implemented using the getChartDataRouter, which handles the following tasks:
By following this guide, you should be able to successfully interact with the /charts endpoint to retrieve episode performance data.