Get Security Exceptions
/api/stats/security/exceptions
Get the links with the most security violations or failed access attempts. Useful for identifying potentially problematic or heavily targeted links.
Query Parameters
Maximum number of results to return
Response
Returns an array of security exception records ordered by count (highest first):
The short code of the link with security exceptions
Number of security exceptions for this link
[
{
"shortCode": "abc123",
"count": 47
},
{
"shortCode": "xyz789",
"count": 32
},
{
"shortCode": "def456",
"count": 28
},
{
"shortCode": "ghi789",
"count": 19
},
{
"shortCode": "jkl012",
"count": 12
}
]
Example Request
curl -X GET "http://localhost:8080/api/stats/security/exceptions?limit=10"
Get Link Status Statistics
Get counts of links grouped by their current status. Provides an overview of your link inventory.
Response
Number of currently active links
{
"active": 342,
"expired": 156,
"revoked": 23
}
Example Request
curl -X GET "http://localhost:8080/api/stats/links"
Get Top Links
Get the most accessed links ordered by access count. Identify your most popular content.
Query Parameters
Maximum number of results to return
Response
Returns an array of top link records ordered by access count (highest first):
The short code of the link
Total number of accesses for this link
[
{
"shortCode": "popular1",
"accessCount": 1523
},
{
"shortCode": "trending2",
"accessCount": 1247
},
{
"shortCode": "viral3",
"accessCount": 982
},
{
"shortCode": "shared4",
"accessCount": 756
},
{
"shortCode": "common5",
"accessCount": 634
}
]
Example Request
curl -X GET "http://localhost:8080/api/stats/links/top?limit=20"
Use Cases
Identify Popular Content
Use the top links endpoint to understand which content resonates most with your audience:
const topLinks = await fetch('/api/stats/links/top?limit=10')
.then(res => res.json());
// Analyze patterns in popular links
topLinks.forEach(link => {
console.log(`${link.shortCode}: ${link.accessCount} accesses`);
});
Security Monitoring Dashboard
Combine security exceptions with failure data to monitor potential attacks:
const [exceptions, failures] = await Promise.all([
fetch('/api/stats/security/exceptions?limit=10'),
fetch('/api/stats/access/failures')
]);
// Alert if any link has excessive security exceptions
const securityThreshold = 50;
const problematicLinks = exceptions.filter(e => e.count > securityThreshold);
Link Lifecycle Analysis
Monitor the health of your link inventory:
const linkStats = await fetch('/api/stats/links')
.then(res => res.json());
const total = linkStats.active + linkStats.expired + linkStats.revoked;
const activePercentage = (linkStats.active / total) * 100;
console.log(`Active links: ${activePercentage.toFixed(2)}%`);