Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/pvnm4/Social-Media-Backend/llms.txt

Use this file to discover all available pages before exploring further.

The GET /posts/ endpoint returns a paginated list of all posts, each enriched with an aggregated vote count. You can narrow results by filtering on post title and control the number of results returned via the Limit and skip parameters. All requests must include a valid JWT Bearer token.

Endpoint

GET /posts/
Authentication required — include a Bearer token in the Authorization header.

Query Parameters

Limit
integer
default:10
Maximum number of posts to return in a single response. Defaults to 10.
skip
integer
default:0
Number of posts to skip before returning results. Use together with Limit to paginate through the full list of posts. Defaults to 0.
Case-insensitive substring filter applied to the post title. Only posts whose title contains this string are returned. Defaults to an empty string (no filter applied).

Response

HTTP 200 OK — Returns an array of PostOut objects.
[]
array
Array of post objects, each containing a nested Post and a vote count.

Error Responses

Status CodeDescription
401 UnauthorizedNo token was provided or the token is invalid/expired.

Examples

# Get the first 10 posts (default)
curl -H "Authorization: Bearer TOKEN" \
  http://localhost:8000/posts/

# Get the next page (posts 11–15)
curl -H "Authorization: Bearer TOKEN" \
  "http://localhost:8000/posts/?skip=10&Limit=5"

# Search posts by title keyword
curl -H "Authorization: Bearer TOKEN" \
  "http://localhost:8000/posts/?search=hello"

Successful Response Example

[
  {
    "Post": {
      "id": 1,
      "title": "Hello World",
      "content": "This is my first post.",
      "published": true,
      "created_at": "2024-01-15T10:30:00.000000Z",
      "owner": {
        "id": 3,
        "email": "alice@example.com",
        "created_at": "2024-01-01T08:00:00.000000Z"
      }
    },
    "vote": 5
  },
  {
    "Post": {
      "id": 2,
      "title": "Hello Again",
      "content": "Another post here.",
      "published": true,
      "created_at": "2024-01-16T14:00:00.000000Z",
      "owner": {
        "id": 7,
        "email": "bob@example.com",
        "created_at": "2024-01-02T09:00:00.000000Z"
      }
    },
    "vote": 2
  }
]

Build docs developers (and LLMs) love