Repository navigation
API System
AutoBot Solutions edited this page Apr 29, 2026
·
1 revision
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)
- Method: POST
- Rate limit: 5 requests per hour
- Fetches repositories from GitHub
- Stores in database
- Returns synced repositories
Get Repositories Route (/api/repositories)
- Method: GET
- Returns all repositories
- Includes metadata
- No authentication required
Get Posts Route (/api/posts)
- Method: GET
- Returns all posts
- Includes author and category
- Includes vote counts
- No authentication required
Get Single Post Route (/api/posts/<post_id>)
- Method: GET
- Returns single post
- Includes comments
- Includes author information
- No authentication required
Description: Sync repositories from GitHub organization
Request: None (POST with no body)
Response:
{
"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:
curl -X POST http://localhost:5000/api/sync-repositoriesDescription: Retrieve all repositories
Response:
{
"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:
curl http://localhost:5000/api/repositoriesDescription: Retrieve all posts
Response:
{
"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:
curl http://localhost:5000/api/postsDescription: Retrieve a specific post
Parameters:
-
post_id(integer, required): Post ID
Response:
{
"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:
curl http://localhost:5000/api/posts/1All endpoints may return error responses:
{
"error": "Error message",
"status_code": 400
}-
200 OK: Request successful -
400 Bad Request: Invalid request parameters -
404 Not Found: Resource not found -
429 Too Many Requests: Rate limit exceeded -
500 Internal Server Error: Server error
-
/api/sync-repositories: 5 requests per hour - Other endpoints: Default limits apply
-
X-RateLimit-Limit: Maximum requests per window -
X-RateLimit-Remaining: Remaining requests in current window -
X-RateLimit-Reset: Unix timestamp when rate limit resets
- Flask-Limiter integration
- IP-based limiting
- Configurable per endpoint
- Redis-backed (future)
- No authentication required for read operations
- Write operations should be protected in production
- JWT tokens
- OAuth2 integration
- API keys
- Session-based authentication
Authorization: Bearer <token>
- Resource-based URLs
- HTTP methods (GET, POST, PUT, DELETE)
- JSON request/response
- Standard HTTP status codes
- HATEOAS links (future)
- URL versioning:
/api/v1/ - Header versioning (future)
- Backward compatibility
- Deprecation policy
- Query parameters:
page,per_page - Response metadata
- Links to next/previous pages
-
POST /api/posts- Create post -
PUT /api/posts/<id>- Update post -
DELETE /api/posts/<id>- Delete post
-
GET /api/posts/<id>/comments- List comments -
POST /api/posts/<id>/comments- Create comment -
PUT /api/comments/<id>- Update comment -
DELETE /api/comments/<id>- Delete comment
-
GET /api/users- List users -
GET /api/users/<id>- Get user -
PUT /api/users/<id>- Update user
-
GET /api/categories- List categories -
POST /api/categories- Create category -
PUT /api/categories/<id>- Update category -
DELETE /api/categories/<id>- Delete category
-
POST /api/posts/<id>/vote- Vote on post -
POST /api/comments/<id>/vote- Vote on comment
-
GET /api/bookmarks- List user bookmarks -
POST /api/bookmarks- Create bookmark -
DELETE /api/bookmarks/<id>- Delete bookmark
-
GET /api/notifications- List notifications -
PUT /api/notifications/<id>/read- Mark as read
-
GET /api/messages- List messages -
POST /api/messages- Send message -
PUT /api/messages/<id>/read- Mark as read
- Interactive API documentation
- Request/response examples
- Schema definitions
- Try-it-out feature
- Python SDK
- JavaScript SDK
- Mobile SDKs
- CSRF protection (for forms)
- Rate limiting
- Input validation
- API authentication (JWT)
- API keys
- OAuth2
- Rate limiting per user
- IP whitelisting
- Request signing
- cURL
- Postman
- Insomnia
- HTTPie
- Python requests library
# Get repositories
curl http://localhost:5000/api/repositories
# Get posts
curl http://localhost:5000/api/posts
# Get specific post
curl http://localhost:5000/api/posts/1
# Sync repositories
curl -X POST http://localhost:5000/api/sync-repositories- Use appropriate HTTP methods
- Return proper status codes
- Provide error messages
- Include pagination metadata
- Version your API
- Document endpoints
- Provide examples
- Handle errors gracefully
- Respect rate limits
- Cache responses when appropriate
- Use HTTPS in production
- Validate responses
- Implement retry logic
- Database query optimization
- Response caching (Redis)
- Pagination
- Lazy loading
- Connection pooling
- CDN for static assets
- Response time tracking
- Error rate monitoring
- Rate limit monitoring
- API usage analytics