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/{id} endpoint retrieves a single post by its unique numeric ID. The response includes the full post record along with the aggregated vote count and the owner’s details. A valid JWT Bearer token must be supplied with every request.

Endpoint

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

Path Parameters

id
integer
required
The unique numeric identifier of the post to retrieve.

Response

HTTP 200 OK — Returns a single PostOut object.
Post
object
The full post record.
vote
integer
Total number of votes this post has received.

Error Responses

Status CodeDescription
401 UnauthorizedNo token was provided or the token is invalid/expired.
404 Not FoundNo post with the specified id exists.

Examples

# Fetch post with ID 1
curl -H "Authorization: Bearer TOKEN" \
  http://localhost:8000/posts/1

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
}

404 Not Found Response Example

{
  "detail": "Post with the id:99 was not found"
}

Build docs developers (and LLMs) love