Skip to content

API Inventory

All endpoints are HTTP GET and mounted under /dashboard.

# Path Path params Query params Response shape
1 /dashboard/getAccountInsights/:startTime/:endTime/:pId startTime (date string, parsed by moment.utc), endTime (date), pId (JSON array of provider_Id) { status, data, code, message } with per-platform followers + fpercentage
2 /dashboard/getAccountFollowers/:startTime/:endTime/:pId same Followers time-series
3 /dashboard/getTopPostsInsights/:startTime/:endTime/:pId/:cId + cId (channel id) Top posts
4 /dashboard/getPostsLikes/:startTime/:endTime/:pId same Likes time-series
5 /dashboard/getRoiViews ROI views
6 /dashboard/getPostsViews/:startTime/:endTime/:pId same Views time-series
7 /dashboard/getPostsEngagements/:startTime/:endTime/:pId same Engagements time-series
8 /dashboard/getPostInsights/:startTime/:endTime/:pId same Per-post insights
9 /dashboard/getPostsTotalEngagements/:startTime/:endTime/:pId same Total engagements

Production-only endpoint

The in-process copy at someli-api/dashboard/routes/index.js has one additional endpoint that does not exist in this standalone repo:

# Path Notes
10 /dashboard/leaderboard/:pId Paginated (?page=, ?limit=), searchable (?search=); ranks members by followers and growth. ~1615 lines of code.

If you are working in the standalone and need leaderboard support, you must port that endpoint from someli-api/dashboard/routes/index.js (or vice versa, if the standalone is the source of truth for a particular fix).

Auth

In production (isLocal === false), there is no router.use(auth) line — auth is expected to be applied higher up by someli-api/server.js before the dashboard router is mounted. The routes/index.js reads userId and accountId off res (not req), implying an upstream middleware writes them onto the response object.

In local-dev (isLocal === true), routes/index.js calls router.use(auth) where auth = require("../mock/middlewares/auth"). The mock middleware sets fixed values for res.userId and res.accountId to make endpoint testing possible without a real token.

Response envelope

All endpoints return:

{
  status: false,
  data: null,
  code: '500',
  message: 'Something Went Wrong!'
}

… initialised at the top of each handler and overwritten on success to { status: true, data: <result>, code: '200', message: 'OK' } or similar.

This is not the { status, errorMsg, response } envelope used elsewhere in someli-api. Callers must know which endpoint shape to expect.

Response shape note

The shapes are returned directly by con.query(...) (raw rows), which means SQL column names are exposed to the client. There is no DTO layer. Field names like fpercentage (followers-percentage), platform (= provider_Id), engagement_rate, etc. are SQL artifacts. Frontend consumers depend on these names.

Cross-reference

For the comprehensive analytics narrative (what gets computed, why, when), see ../someli-api/dashboard-analytics.md. That document was authored against the in-process copy but is accurate for the 9 endpoints in this standalone too.