Skip to content

API Documentation

Gary Norman edited this page Oct 7, 2025 · 1 revision

API Documentation

Authentication Endpoints

POST /register

Register a new user account.

Request Body:

{
  "username": "string",
  "email": "string",
  "password": "string"
}

Response: Redirects to home page with session cookie

POST /login

Authenticate a user.

Request Body:

{
  "username": "string",
  "password": "string"
}

Response: Redirects to home page with session cookie

POST /logout

End user session.

Response: Redirects to home page, clears session cookie

Post Endpoints

GET /

Home page with post feed.

GET /post/{postId}

View a specific post and its comments.

Parameters:

  • postId (path) - UUID of the post

POST /post

Create a new post.

Request Body:

{
  "title": "string",
  "content": "string",
  "channel_id": "string",
  "image": "file (optional)"
}

Response: Redirects to new post

POST /post/{postId}/edit

Edit an existing post.

Parameters:

  • postId (path) - UUID of the post

Request Body:

{
  "title": "string",
  "content": "string"
}

POST /post/{postId}/delete

Delete a post.

Parameters:

  • postId (path) - UUID of the post

Comment Endpoints

POST /comment

Create a new comment.

Request Body:

{
  "post_id": "string",
  "content": "string"
}

POST /comment/{commentId}/edit

Edit a comment.

Parameters:

  • commentId (path) - UUID of the comment

Request Body:

{
  "content": "string"
}

POST /comment/{commentId}/delete

Delete a comment.

Parameters:

  • commentId (path) - UUID of the comment

Channel Endpoints

GET /channel/{channelId}

View a channel and its posts.

Parameters:

  • channelId (path) - UUID of the channel

POST /channel

Create a new channel.

Request Body:

{
  "name": "string",
  "description": "string",
  "is_private": "boolean",
  "image": "file (optional)"
}

POST /channel/{channelId}/join

Join a channel.

Parameters:

  • channelId (path) - UUID of the channel

POST /channel/{channelId}/leave

Leave a channel.

Parameters:

  • channelId (path) - UUID of the channel

Reaction Endpoints

POST /reaction

Add or update a reaction.

Request Body:

{
  "target_id": "string",
  "target_type": "post|comment",
  "reaction_type": "like|dislike"
}

POST /reaction/{reactionId}/delete

Remove a reaction.

Parameters:

  • reactionId (path) - UUID of the reaction

User Endpoints

GET /user/{userId}

View user profile.

Parameters:

  • userId (path) - UUID of the user

POST /user/edit

Update user profile.

Request Body:

{
  "email": "string (optional)",
  "image": "file (optional)"
}

Search

GET /search

Search posts, channels, and users.

Query Parameters:

  • q - Search query string

Response Codes

  • 200 OK - Successful request
  • 302 Found - Redirect after successful operation
  • 400 Bad Request - Invalid input
  • 401 Unauthorized - Authentication required
  • 403 Forbidden - Insufficient permissions
  • 404 Not Found - Resource not found
  • 500 Internal Server Error - Server error

Rate Limiting

Currently not implemented. Consider adding for production use.

Authentication

Sessions are managed via HTTP-only cookies. Include session cookie in requests to authenticated endpoints.

Clone this wiki locally