Stats
Lists don't return totals: the stats do. They count your workspace's posts, its posts in each status, its votes, its boards and its end users: each field says what it counts.
The examples read your API key and your workspace's base URL from two shell variables. Set them once, with your workspace's id in place of ws_... (API keys says where to find both):
export SWINGBACK_API_KEY="s_live_..."
export SWINGBACK_API="https://api.swingback.dev/v1/workspaces/ws_..." Retrieve workspace stats#
/ v1/ workspaces/ {workspace_id}/ statsAny API key: Read or Read and write
Returns the totals that lists don't give: posts, posts by status, votes, boards and end users. Each field says what it counts.
Path parameters
workspace_idstringrequiredYour workspace's id, shown under Settings → Sign-in.
Starts with
ws_
Responses
- 200OKThe counts. Returns a stats object.
- 4xxErrorProblem details with a stable
code: see Errors.
Example
curl "$SWINGBACK_API/stats" \
-H "Authorization: Bearer $SWINGBACK_API_KEY"{
"boards": 4,
"end_users": 512,
"posts": 128,
"posts_by_status": {
"pending": 6,
"review": 12,
"planned": 9,
"in_progress": 4,
"completed": 85,
"closed": 12
},
"votes": 1024
}The stats object#
Fields
boardsintegerThe boards not in the trash.
end_usersintegerEvery end user: customers, guests and your team members' own, erased ones included.
postsintegerThe posts, without those in the trash, on a board in the trash, or merged into another.
posts_by_statusobjectThe same posts, counted by status.
Child fields (6)
closedintegercompletedintegerin_progressintegerpendingintegerplannedintegerreviewinteger
votesintegerThe votes on posts not in the trash, those on a board in the trash included. A merged post's votes count on the post it went into, once per customer.
Example
{
"boards": 4,
"end_users": 512,
"posts": 128,
"posts_by_status": {
"pending": 6,
"review": 12,
"planned": 9,
"in_progress": 4,
"completed": 85,
"closed": 12
},
"votes": 1024
}