Skip to main content
GET
/
api
/
get_posts
/
<username>
Get Posts
curl --request GET \
  --url 'https://api.example.com/api/get_posts/<username>'
{
  "posts": [
    {
      "id": 123,
      "username": "<string>",
      "content": "<string>",
      "created_at": "<string>",
      "upvotes": 123,
      "downvotes": 123
    }
  ]
}

Endpoint

GET /api/get_posts/<username>
Retrieves all posts from a specified user, ordered by creation date (most recent first).

Path Parameters

username
string
required
The username of the user whose posts you want to retrieve

Response

posts
array
An array of post objects
id
integer
Unique identifier for the post
username
string
Username of the post author
content
string
The content of the post
created_at
string
Timestamp when the post was created
upvotes
integer
Number of upvotes the post has received
downvotes
integer
Number of downvotes the post has received

Success Response

Status Code: 200 OK
{
  "posts": [
    {
      "id": 123,
      "username": "johndoe",
      "content": "This is a post",
      "created_at": "2026-03-03 12:34:56",
      "upvotes": 42,
      "downvotes": 3
    },
    {
      "id": 122,
      "username": "johndoe",
      "content": "Another post",
      "created_at": "2026-03-02 10:20:30",
      "upvotes": 15,
      "downvotes": 1
    }
  ]
}
If the user has no posts, returns an empty array:
{
  "posts": []
}

Example Request

curl -X GET https://api.example.com/api/get_posts/johndoe

Example Response

{
  "posts": [
    {
      "id": 123,
      "username": "johndoe",
      "content": "This is a post",
      "created_at": "2026-03-03 12:34:56",
      "upvotes": 42,
      "downvotes": 3
    }
  ]
}

Build docs developers (and LLMs) love