API Reference
Stats API
Get platform statistics and metrics
Stats API
The Stats API provides access to platform-wide statistics and metrics about Bubbly Maps.
Endpoints
GET /api/stats
Get comprehensive statistics about the Bubbly Maps platform.
Authentication: Not required
Example Request:
curl https://bubblymaps.org/api/statsResponse:
{
"totalWaypoints": 1234,
"totalVerifiedWaypoints": 856,
"totalUsers": 567,
"totalReviews": 2341,
"totalContributions": 4523
}Response Fields
| Field | Type | Description |
|---|---|---|
totalWaypoints | number | Total number of waypoints in the system |
totalVerifiedWaypoints | number | Number of verified waypoints |
totalUsers | number | Total number of registered users |
totalReviews | number | Total number of reviews |
totalContributions | number | Total number of contributions (edits, additions, etc.) |
Usage Examples
JavaScript/Fetch
async function getPlatformStats() {
const response = await fetch('https://bubblymaps.org/api/stats');
if (!response.ok) {
throw new Error('Failed to fetch stats');
}
const data = await response.json();
return data;
}
// Usage
getPlatformStats()
.then(stats => {
console.log(`Total Waypoints: ${stats.totalWaypoints}`);
console.log(`Verified Waypoints: ${stats.totalVerifiedWaypoints}`);
console.log(`Total Users: ${stats.totalUsers}`);
console.log(`Total Reviews: ${stats.totalReviews}`);
console.log(`Total Contributions: ${stats.totalContributions}`);
})
.catch(error => console.error('Error:', error));Python
import requests
def get_platform_stats():
url = "https://bubblymaps.org/api/stats"
response = requests.get(url)
if response.status_code == 200:
return response.json()
else:
raise Exception(f"Failed to fetch stats: {response.status_code}")
# Usage
stats = get_platform_stats()
print(f"Total Waypoints: {stats['totalWaypoints']}")
print(f"Verified Waypoints: {stats['totalVerifiedWaypoints']}")
print(f"Total Users: {stats['totalUsers']}")
print(f"Total Reviews: {stats['totalReviews']}")
print(f"Total Contributions: {stats['totalContributions']}")cURL with Pretty Print
curl -s https://bubblymaps.org/api/stats | jq '.'Use Cases
The Stats API is useful for:
- Dashboard widgets - Display real-time platform metrics
- Analytics - Track platform growth over time
- Public displays - Show community impact and engagement
- Reports - Generate statistics for presentations or reports
Error Responses
500 Internal Server Error- Failed to fetch statistics from the database
Notes
- This endpoint is publicly accessible and does not require authentication
- Statistics are calculated in real-time from the database
- The
totalContributionsincludes all logged actions (waypoint creation, edits, reviews, etc.)