curl --request GET \
--url 'https://YOURSITE.konstant.ly/openapi/v1/statistics' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
from typing import Dict, Any
def get_global_statistics(api_key: str) -> Dict[str, Any]:
url = "https://YOURSITE.konstant.ly/openapi/v1/statistics"
headers = {"X-API-KEY": api_key}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
# Example usage
try:
stats = get_global_statistics("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv")
# Print general statistics
print("Platform Statistics:")
print(f"Total Courses: {stats['statistics']['coursesCount']}")
print(f"Total Users: {stats['statistics']['usersCount']}")
print(f"Total Groups: {stats['statistics']['groupsCount']}")
# Print inactive users
print(f"\nUsers without activity: {len(stats['usersWithoutActivity'])}")
# Print top performers
print("\nTop Performers:")
for leader in stats['leaders']:
print(f"User: {leader['user']['name']}")
print(f"Completed Courses: {leader['coursesCount']}")
print(f"Average Score: {leader['resultValue']}%")
print("---")
# Print unassigned courses
print(f"\nUnassigned Courses: {len(stats['unassignedCourses'])}")
except Exception as e:
print(f"Error fetching statistics: {str(e)}")
const axios = require('axios');
async function getGlobalStatistics(apiKey) {
try {
const response = await axios.get(
'https://YOURSITE.konstant.ly/openapi/v1/statistics',
{
headers: {
'X-API-KEY': apiKey
}
}
);
return response.data;
} catch (error) {
console.error('Error fetching statistics:', error.message);
throw error;
}
}
// Example usage
getGlobalStatistics('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv')
.then(stats => {
// Print general statistics
console.log('Platform Statistics:');
console.log(`Total Courses: ${stats.statistics.coursesCount}`);
console.log(`Total Users: ${stats.statistics.usersCount}`);
console.log(`Total Groups: ${stats.statistics.groupsCount}`);
// Print inactive users
console.log(`\nUsers without activity: ${stats.usersWithoutActivity.length}`);
// Print top performers
console.log('\nTop Performers:');
stats.leaders.forEach(leader => {
console.log(`User: ${leader.user.name}`);
console.log(`Completed Courses: ${leader.coursesCount}`);
console.log(`Average Score: ${leader.resultValue}%`);
console.log('---');
});
// Print unassigned courses
console.log(`\nUnassigned Courses: ${stats.unassignedCourses.length}`);
})
.catch(error => console.error('Error:', error.message));
{
"statistics": {
"coursesCount": 25,
"assignedCoursesCount": 150,
"groupsCount": 10,
"usersCount": 100
},
"usersWithoutActivity": [
{
"id": "user123",
"name": "John Smith",
"email": "john@example.com",
"language": "en",
"timezone": "Europe/London",
"role": {
"alias": "learner"
},
"isBanned": false,
"fromApi": false,
"image": null
}
],
"usersWithoutResults": [
{
"id": "user456",
"name": "Jane Doe",
"email": "jane@example.com",
"language": "en",
"timezone": "America/New_York",
"role": {
"alias": "learner"
},
"isBanned": false,
"fromApi": false,
"image": null
}
],
"leaders": [
{
"coursesCount": 15,
"resultValue": 95,
"user": {
"id": "user789",
"name": "Alice Johnson",
"email": "alice@example.com",
"role": {
"alias": "learner"
}
}
}
],
"unassignedCourses": [
{
"id": 123,
"name": "Introduction Course",
"annotation": "Basic introduction",
"isDraft": false,
"createdAt": 1507807711,
"updatedAt": 1507808372,
"publishedAt": 1508225229,
"image": null
}
]
}
Statistics
Get Global Statistics
Get the global statistics of Konstantly site
GET
/
statistics
curl --request GET \
--url 'https://YOURSITE.konstant.ly/openapi/v1/statistics' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
from typing import Dict, Any
def get_global_statistics(api_key: str) -> Dict[str, Any]:
url = "https://YOURSITE.konstant.ly/openapi/v1/statistics"
headers = {"X-API-KEY": api_key}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
# Example usage
try:
stats = get_global_statistics("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv")
# Print general statistics
print("Platform Statistics:")
print(f"Total Courses: {stats['statistics']['coursesCount']}")
print(f"Total Users: {stats['statistics']['usersCount']}")
print(f"Total Groups: {stats['statistics']['groupsCount']}")
# Print inactive users
print(f"\nUsers without activity: {len(stats['usersWithoutActivity'])}")
# Print top performers
print("\nTop Performers:")
for leader in stats['leaders']:
print(f"User: {leader['user']['name']}")
print(f"Completed Courses: {leader['coursesCount']}")
print(f"Average Score: {leader['resultValue']}%")
print("---")
# Print unassigned courses
print(f"\nUnassigned Courses: {len(stats['unassignedCourses'])}")
except Exception as e:
print(f"Error fetching statistics: {str(e)}")
const axios = require('axios');
async function getGlobalStatistics(apiKey) {
try {
const response = await axios.get(
'https://YOURSITE.konstant.ly/openapi/v1/statistics',
{
headers: {
'X-API-KEY': apiKey
}
}
);
return response.data;
} catch (error) {
console.error('Error fetching statistics:', error.message);
throw error;
}
}
// Example usage
getGlobalStatistics('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv')
.then(stats => {
// Print general statistics
console.log('Platform Statistics:');
console.log(`Total Courses: ${stats.statistics.coursesCount}`);
console.log(`Total Users: ${stats.statistics.usersCount}`);
console.log(`Total Groups: ${stats.statistics.groupsCount}`);
// Print inactive users
console.log(`\nUsers without activity: ${stats.usersWithoutActivity.length}`);
// Print top performers
console.log('\nTop Performers:');
stats.leaders.forEach(leader => {
console.log(`User: ${leader.user.name}`);
console.log(`Completed Courses: ${leader.coursesCount}`);
console.log(`Average Score: ${leader.resultValue}%`);
console.log('---');
});
// Print unassigned courses
console.log(`\nUnassigned Courses: ${stats.unassignedCourses.length}`);
})
.catch(error => console.error('Error:', error.message));
{
"statistics": {
"coursesCount": 25,
"assignedCoursesCount": 150,
"groupsCount": 10,
"usersCount": 100
},
"usersWithoutActivity": [
{
"id": "user123",
"name": "John Smith",
"email": "john@example.com",
"language": "en",
"timezone": "Europe/London",
"role": {
"alias": "learner"
},
"isBanned": false,
"fromApi": false,
"image": null
}
],
"usersWithoutResults": [
{
"id": "user456",
"name": "Jane Doe",
"email": "jane@example.com",
"language": "en",
"timezone": "America/New_York",
"role": {
"alias": "learner"
},
"isBanned": false,
"fromApi": false,
"image": null
}
],
"leaders": [
{
"coursesCount": 15,
"resultValue": 95,
"user": {
"id": "user789",
"name": "Alice Johnson",
"email": "alice@example.com",
"role": {
"alias": "learner"
}
}
}
],
"unassignedCourses": [
{
"id": 123,
"name": "Introduction Course",
"annotation": "Basic introduction",
"isDraft": false,
"createdAt": 1507807711,
"updatedAt": 1507808372,
"publishedAt": 1508225229,
"image": null
}
]
}
Retrieve comprehensive statistics about your platform’s usage, including course metrics, user activity, and performance data.
Request Headers
Response
Array of users without any activity
Show User properties
Show User properties
Array of users who haven’t completed any courses
Show User properties
Show User properties
Same structure as usersWithoutActivity
Usage Notes
- Activity Tracking:
- Users are considered “without activity” if they haven’t started any courses
- Users are considered “without results” if they haven’t completed any courses
- Leaders are ranked by combination of completion count and average score
- Timestamps:
- All timestamps are in Unix epoch format (seconds since 1970)
- Timezone conversions should be handled client-side
- Performance:
- This endpoint aggregates data across the entire platform
- Response times may increase with platform size
- Consider caching results if frequent polling is needed
curl --request GET \
--url 'https://YOURSITE.konstant.ly/openapi/v1/statistics' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
from typing import Dict, Any
def get_global_statistics(api_key: str) -> Dict[str, Any]:
url = "https://YOURSITE.konstant.ly/openapi/v1/statistics"
headers = {"X-API-KEY": api_key}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
# Example usage
try:
stats = get_global_statistics("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv")
# Print general statistics
print("Platform Statistics:")
print(f"Total Courses: {stats['statistics']['coursesCount']}")
print(f"Total Users: {stats['statistics']['usersCount']}")
print(f"Total Groups: {stats['statistics']['groupsCount']}")
# Print inactive users
print(f"\nUsers without activity: {len(stats['usersWithoutActivity'])}")
# Print top performers
print("\nTop Performers:")
for leader in stats['leaders']:
print(f"User: {leader['user']['name']}")
print(f"Completed Courses: {leader['coursesCount']}")
print(f"Average Score: {leader['resultValue']}%")
print("---")
# Print unassigned courses
print(f"\nUnassigned Courses: {len(stats['unassignedCourses'])}")
except Exception as e:
print(f"Error fetching statistics: {str(e)}")
const axios = require('axios');
async function getGlobalStatistics(apiKey) {
try {
const response = await axios.get(
'https://YOURSITE.konstant.ly/openapi/v1/statistics',
{
headers: {
'X-API-KEY': apiKey
}
}
);
return response.data;
} catch (error) {
console.error('Error fetching statistics:', error.message);
throw error;
}
}
// Example usage
getGlobalStatistics('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv')
.then(stats => {
// Print general statistics
console.log('Platform Statistics:');
console.log(`Total Courses: ${stats.statistics.coursesCount}`);
console.log(`Total Users: ${stats.statistics.usersCount}`);
console.log(`Total Groups: ${stats.statistics.groupsCount}`);
// Print inactive users
console.log(`\nUsers without activity: ${stats.usersWithoutActivity.length}`);
// Print top performers
console.log('\nTop Performers:');
stats.leaders.forEach(leader => {
console.log(`User: ${leader.user.name}`);
console.log(`Completed Courses: ${leader.coursesCount}`);
console.log(`Average Score: ${leader.resultValue}%`);
console.log('---');
});
// Print unassigned courses
console.log(`\nUnassigned Courses: ${stats.unassignedCourses.length}`);
})
.catch(error => console.error('Error:', error.message));
{
"statistics": {
"coursesCount": 25,
"assignedCoursesCount": 150,
"groupsCount": 10,
"usersCount": 100
},
"usersWithoutActivity": [
{
"id": "user123",
"name": "John Smith",
"email": "john@example.com",
"language": "en",
"timezone": "Europe/London",
"role": {
"alias": "learner"
},
"isBanned": false,
"fromApi": false,
"image": null
}
],
"usersWithoutResults": [
{
"id": "user456",
"name": "Jane Doe",
"email": "jane@example.com",
"language": "en",
"timezone": "America/New_York",
"role": {
"alias": "learner"
},
"isBanned": false,
"fromApi": false,
"image": null
}
],
"leaders": [
{
"coursesCount": 15,
"resultValue": 95,
"user": {
"id": "user789",
"name": "Alice Johnson",
"email": "alice@example.com",
"role": {
"alias": "learner"
}
}
}
],
"unassignedCourses": [
{
"id": 123,
"name": "Introduction Course",
"annotation": "Basic introduction",
"isDraft": false,
"createdAt": 1507807711,
"updatedAt": 1507808372,
"publishedAt": 1508225229,
"image": null
}
]
}
Was this page helpful?