Social Posts
Ce contenu n’est pas encore disponible dans votre langue.
Overview
Section titled “Overview”The Social Posts resource provides fake social media post data with content, visibility settings, engagement metrics, and author information.
Endpoints
Section titled “Endpoints”| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/social-posts | List all social posts |
| GET | /v1/social-posts/:id | Get a specific social post |
| GET | /v1/social-posts/:id/comments | Get post's comments |
| GET | /v1/social-posts/:id/likes | Get post's likes |
| GET | /v1/social-posts/:id/media | Get post's media |
Social Post Object
Section titled “Social Post Object”{ "id": 1, "authorId": 1, "content": "Just shipped a new feature! #coding #webdev", "visibility": "public", "status": "published", "likesCount": 42, "commentsCount": 8, "createdAt": "2026-01-15T10:30:00.000Z", "updatedAt": "2026-01-15T10:30:00.000Z"}| Field | Type | Description |
|---|---|---|
id |
number |
Unique identifier |
authorId |
number |
ID of the post author |
content |
string |
Post text content |
visibility |
string |
Visibility (public, friends, private) |
status |
string |
Status (published, draft, archived) |
likesCount |
number |
Number of likes |
commentsCount |
number |
Number of comments |
createdAt |
string |
ISO 8601 timestamp |
updatedAt |
string |
ISO 8601 timestamp |
List Social Posts
Section titled “List Social Posts”curl https://api.phantomjson.app/v1/social-postsQuery 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 |
q |
string |
— | Search query |
fields |
string |
— | Fields to return |
authorId |
number |
— | Filter by author ID |
visibility |
string |
— | Filter by visibility |
status |
string |
— | Filter by status |
Response
Section titled “Response”{ "data": [ { "id": 1, "authorId": 1, "content": "Just shipped a new feature! #coding #webdev", "visibility": "public", "status": "published", "likesCount": 42, "commentsCount": 8 } ], "meta": { "total": 100, "page": 1, "limit": 20, "totalPages": 5 }}Get Social Post by ID
Section titled “Get Social Post by ID”curl https://api.phantomjson.app/v1/social-posts/1Response
Section titled “Response”{ "data": { "id": 1, "authorId": 1, "content": "Just shipped a new feature! #coding #webdev", "visibility": "public", "status": "published", "likesCount": 42, "commentsCount": 8, "createdAt": "2026-01-15T10:30:00.000Z", "updatedAt": "2026-01-15T10:30:00.000Z" }}Get Post’s Comments
Section titled “Get Post’s Comments”curl https://api.phantomjson.app/v1/social-posts/1/commentsResponse
Section titled “Response”{ "data": [ { "id": 1, "socialPostId": 1, "userId": 2, "content": "Congrats on the launch!", "likesCount": 3 } ], "meta": { "total": 8, "page": 1, "limit": 20, "totalPages": 1 }}Get Post’s Likes
Section titled “Get Post’s Likes”curl https://api.phantomjson.app/v1/social-posts/1/likesResponse
Section titled “Response”{ "data": [ { "id": 1, "socialPostId": 1, "userId": 2, "createdAt": "2026-01-15T11:00:00.000Z" } ], "meta": { "total": 42, "page": 1, "limit": 20, "totalPages": 3 }}Get Post’s Media
Section titled “Get Post’s Media”curl https://api.phantomjson.app/v1/social-posts/1/mediaResponse
Section titled “Response”{ "data": [ { "id": 1, "socialPostId": 1, "url": "https://example.com/images/screenshot.jpg", "type": "image", "width": 1920, "height": 1080 } ], "meta": { "total": 2, "page": 1, "limit": 20, "totalPages": 1 }}Examples
Section titled “Examples”Search Posts
Section titled “Search Posts”curl "https://api.phantomjson.app/v1/social-posts?q=coding"Filter by Author
Section titled “Filter by Author”curl "https://api.phantomjson.app/v1/social-posts?authorId=1"Filter by Visibility
Section titled “Filter by Visibility”curl "https://api.phantomjson.app/v1/social-posts?visibility=public"Filter by Status
Section titled “Filter by Status”curl "https://api.phantomjson.app/v1/social-posts?status=published"Sort by Creation Date
Section titled “Sort by Creation Date”# Newest firstcurl "https://api.phantomjson.app/v1/social-posts?sort=createdAt:desc"
# Oldest firstcurl "https://api.phantomjson.app/v1/social-posts?sort=createdAt:asc"Field Selection
Section titled “Field Selection”curl "https://api.phantomjson.app/v1/social-posts?fields=id,content,likesCount,commentsCount"Combined Query
Section titled “Combined Query”# Published public posts from author 1, sorted by newestcurl "https://api.phantomjson.app/v1/social-posts?authorId=1&visibility=public&status=published&sort=createdAt:desc"Relations
Section titled “Relations”- Author — Each post belongs to a user (
authorId) - Comments — Each post has many comments (access via
/v1/social-posts/:id/comments) - Likes — Each post has many likes (access via
/v1/social-posts/:id/likes) - Media — Each post has many media attachments (access via
/v1/social-posts/:id/media)
