Skip to content

API Documentation

BytexGrid edited this page Jan 16, 2025 · 1 revision

API Documentation

This document outlines the available API endpoints in SoftStacker.

Authentication

All authenticated endpoints require a valid session cookie obtained through GitHub OAuth.

Templates

Get Templates

GET /api/templates

Query Parameters:

  • os (string): Filter by operating system (windows, macos, linux)
  • category (string): Filter by category
  • search (string): Search templates by title or description

Response:

[
  {
    "id": "string",
    "title": "string",
    "description": "string",
    "category": "string",
    "target_os": "string",
    "apps": Array,
    "votes": number,
    "author_name": "string",
    "author_avatar": "string"
  }
]

Get Template by ID

GET /api/templates/{id}

Response: Single template object

Create Template

POST /api/templates

Request Body:

{
  "title": "string",
  "description": "string",
  "category": "string",
  "target_os": "string",
  "apps": [
    {
      "name": "string",
      "description": "string",
      "website": "string",
      "category": "string",
      "isRequired": boolean,
      "packageName": "string"
    }
  ]
}

Save Draft

POST /api/templates/draft

Request Body: Same as Create Template

Load Draft

GET /api/templates/draft

Voting System

Get Vote Status

GET /api/templates/{id}/vote/check

Response:

{
  "voteType": "up" | "down" | null,
  "votes": number
}

Cast Vote

POST /api/templates/{id}/vote

Request Body:

{
  "voteType": "up" | "down"
}

Response:

{
  "message": "Vote added" | "Vote updated" | "Vote removed",
  "votes": number
}

User Management

Get User Profile

GET /api/user/profile

Response:

{
  "id": "string",
  "name": "string",
  "email": "string",
  "avatar_url": "string"
}

Get User Analytics

GET /api/user/analytics

Response:

{
  "total_templates": number,
  "total_votes_received": number,
  "most_popular_template": Template
}

Delete User Data

DELETE /api/user/data

Response:

{
  "message": "User data deleted successfully"
}

Error Responses

All endpoints may return the following error responses:

  • 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

Error Response Format:

{
  "error": "Error message"
}

Clone this wiki locally