Likes
Overview
Section titled “Overview”The Likes resource provides fake like data, tracking which users have liked which social posts.
Endpoints
Section titled “Endpoints”| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/likes | List all likes |
| GET | /v1/likes/:id | Get a specific like |
Like Object
Section titled “Like Object”{ "id": 1, "socialPostId": 1, "userId": 2, "createdAt": "2026-01-15T11:00:00.000Z"}| Field | Type | Description |
|---|---|---|
id |
number |
Unique identifier |
socialPostId |
number |
ID of the liked post |
userId |
number |
ID of the user who liked |
createdAt |
string |
ISO 8601 timestamp |
List Likes
Section titled “List Likes”curl https://api.phantomjson.app/v1/likesQuery Parameters
Section titled “Query Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
page |
number |
1 |
Page number |
limit |
number |
20 |
Items per page (max: 100) |
sort |
string |
— | Sort field and direction |
fields |
string |
— | Fields to return |
socialPostId |
number |
— | Filter by post ID |
userId |
number |
— | Filter by user ID |
Response
Section titled “Response”{ "data": [ { "id": 1, "socialPostId": 1, "userId": 2, "createdAt": "2026-01-15T11:00:00.000Z" } ], "meta": { "total": 200, "page": 1, "limit": 20, "totalPages": 10 }}Get Like by ID
Section titled “Get Like by ID”curl https://api.phantomjson.app/v1/likes/1Response
Section titled “Response”{ "data": { "id": 1, "socialPostId": 1, "userId": 2, "createdAt": "2026-01-15T11:00:00.000Z" }}Examples
Section titled “Examples”Filter by Post
Section titled “Filter by Post”curl "https://api.phantomjson.app/v1/likes?socialPostId=1"Filter by User
Section titled “Filter by User”curl "https://api.phantomjson.app/v1/likes?userId=2"Sort by Creation Date
Section titled “Sort by Creation Date”# Newest firstcurl "https://api.phantomjson.app/v1/likes?sort=createdAt:desc"
# Oldest firstcurl "https://api.phantomjson.app/v1/likes?sort=createdAt:asc"Field Selection
Section titled “Field Selection”curl "https://api.phantomjson.app/v1/likes?fields=id,socialPostId,userId"Combined Query
Section titled “Combined Query”# Likes on post 1 by user 2curl "https://api.phantomjson.app/v1/likes?socialPostId=1&userId=2"Relations
Section titled “Relations”- Social Post — Each like belongs to a social post (
socialPostId) - User — Each like belongs to a user (
userId)
