The API system provides a RESTful interface for programmatic access to forum data. Currently, it supports read operations for repositories and posts, with plans for full CRUD operations and authentication.
Sync Repositories Route (/api/sync-repositories)
Get Repositories Route (/api/repositories)
Get Posts Route (/api/posts)
Get Single Post Route (/api/posts/)
Description: Sync repositories from GitHub organization
Request: None (POST with no body)
Response:
json
{
"success": true,
"message": "Repositories synced successfully",
"repositories": [
{
"id": 1,
"name": "repo-name",
"description": "Repository description",
"github_url": "https://github.com/AutoBotSolutions/repo-name",
"stars": 100,
"language": "Python"
}
]
}
Rate Limit: 5 requests per hour
Example:
bash
curl -X POST http://localhost:5000/api/sync-repositories
Description: Retrieve all repositories
Response:
json
{
"repositories": [
{
"id": 1,
"name": "repo-name",
"description": "Repository description",
"github_url": "https://github.com/AutoBotSolutions/repo-name",
"stars": 100,
"language": "Python",
"updated_at": "2024-01-15T10:30:00"
}
]
}
Example:
bash
curl http://localhost:5000/api/repositories
Description: Retrieve all posts
Response:
json
{
"posts": [
{
"id": 1,
"title": "Post Title",
"content": "Post content...",
"author": {
"id": 1,
"username": "username",
"is_admin": false
},
"category": {
"id": 1,
"name": "General",
"color": "#00f5ff"
},
"repository": {
"id": 1,
"name": "repo-name"
},
"upvotes": 10,
"downvotes": 2,
"created_at": "2024-01-15T10:30:00"
}
]
}
Example:
bash
curl http://localhost:5000/api/posts
Description: Retrieve a specific post
Parameters:
post_id (integer, required): Post IDResponse:
json
{
"post": {
"id": 1,
"title": "Post Title",
"content": "Post content...",
"author": {
"id": 1,
"username": "username",
"is_admin": false
},
"category": {
"id": 1,
"name": "General",
"color": "#00f5ff"
},
"repository": {
"id": 1,
"name": "repo-name"
},
"upvotes": 10,
"downvotes": 2,
"created_at": "2024-01-15T10:30:00",
"comments": [
{
"id": 1,
"content": "Comment content...",
"author": {
"id": 2,
"username": "commenter",
"is_admin": false
},
"upvotes": 5,
"downvotes": 0,
"created_at": "2024-01-15T11:00:00"
}
]
}
}
Example:
bash
curl http://localhost:5000/api/posts/1
All endpoints may return error responses:
json
{
"error": "Error message",
"status_code": 400
}
200 OK: Request successful400 Bad Request: Invalid request parameters404 Not Found: Resource not found429 Too Many Requests: Rate limit exceeded500 Internal Server Error: Server error/api/sync-repositories: 5 requests per hourX-RateLimit-Limit: Maximum requests per windowX-RateLimit-Remaining: Remaining requests in current windowX-RateLimit-Reset: Unix timestamp when rate limit resets
Authorization: Bearer
/api/v1/page, per_pagePOST /api/posts - Create postPUT /api/posts/ - Update postDELETE /api/posts/ - Delete postGET /api/posts//comments - List commentsPOST /api/posts//comments - Create commentPUT /api/comments/ - Update commentDELETE /api/comments/ - Delete commentGET /api/users - List usersGET /api/users/ - Get userPUT /api/users/ - Update userGET /api/categories - List categoriesPOST /api/categories - Create categoryPUT /api/categories/ - Update categoryDELETE /api/categories/ - Delete categoryPOST /api/posts//vote - Vote on postPOST /api/comments//vote - Vote on commentGET /api/bookmarks - List user bookmarksPOST /api/bookmarks - Create bookmarkDELETE /api/bookmarks/ - Delete bookmarkGET /api/notifications - List notificationsPUT /api/notifications//read - Mark as readGET /api/messages - List messagesPOST /api/messages - Send messagePUT /api/messages//read - Mark as readbash
Get repositories
curl http://localhost:5000/api/repositoriesGet posts
curl http://localhost:5000/api/postsGet specific post
curl http://localhost:5000/api/posts/1Sync repositories
curl -X POST http://localhost:5000/api/sync-repositories