Top 4
Endpoint
Section titled “Endpoint”GET /api/public/:username/top4Returns user top picks grouped by category.
Path params
Section titled “Path params”| Param | Type | Required | Description |
|---|---|---|---|
username | string | yes | Interis username to resolve |
Query params
Section titled “Query params”None.
Response
Section titled “Response”{ "categories": [ { "id": 1, "key": "cinema", "supported": true, "items": [ { "slot": 1, "mediaType": "movie", "mediaSource": "tmdb", "mediaSourceId": "550", "entityId": 123, "tmdbId": 550, "title": "Fight Club", "posterPath": "/a.jpg", "releaseYear": 1999 } ] }, { "id": 2, "key": "serial", "supported": true, "items": [] } ]}- Categories are currently fixed to
cinema(id: 1) andserial(id: 2). itemsare sorted byslot.entityIdandtmdbIdcan benullfor unresolved/non-TMDB records.
Empty state behavior
Section titled “Empty state behavior”- Existing users still receive
categories. - A category with no picks returns
items: [].
Error behavior
Section titled “Error behavior”404when username does not exist.429when the public rate limit is exceeded.500for unexpected server errors.
Examples
Section titled “Examples”const res = await fetch(`https://api.interis.gorkemkaryol.dev/api/public/your_username/top4`);if (!res.ok) throw new Error(`Top4 failed: ${res.status}`);
const data = await res.json();const cinema = data.categories.find((category) => category.key === 'cinema');console.log(cinema?.items ?? []);curl "https://api.interis.gorkemkaryol.dev/api/public/your_username/top4"Practical: map categories into sections
Section titled “Practical: map categories into sections”function toTopPickSections(response) { return response.categories.map((category) => ({ key: category.key, heading: category.key === 'cinema' ? 'Top 4 Films' : 'Top 4 Series', items: category.items, }));}Next: Recent endpoint