mirror of
https://codeberg.org/likwid/likwid.git
synced 2026-02-09 21:13:09 +00:00
- Backend: Rust/Axum with PostgreSQL, plugin architecture - Frontend: Astro with polished UI - Voting methods: Approval, Ranked Choice, Schulze, STAR, Quadratic - Features: Liquid delegation, transparent moderation, structured deliberation - Documentation: User and admin guides in /docs - Deployment: Docker/Podman compose files for production and demo - Demo: Seeded data with 3 communities, 13 users, 7 proposals License: AGPLv3
3.3 KiB
3.3 KiB
API Reference
Likwid exposes a REST API for all functionality.
Base URL
http://localhost:3000/api
Authentication
Most endpoints require a JWT token:
curl -H "Authorization: Bearer YOUR_TOKEN" http://localhost:3000/api/...
Login
POST /api/auth/login
Content-Type: application/json
{
"username": "user",
"password": "password"
}
Response:
{
"token": "eyJ...",
"user": {
"id": "uuid",
"username": "user",
"display_name": "User Name"
}
}
Register
POST /api/auth/register
Content-Type: application/json
{
"username": "newuser",
"email": "user@example.com",
"password": "password",
"display_name": "New User"
}
Communities
List Communities
GET /api/communities
Get Community
GET /api/communities/{id}
Create Community
POST /api/communities
Authorization: Bearer TOKEN
Content-Type: application/json
{
"name": "My Community",
"slug": "my-community",
"description": "Description here"
}
Join Community
POST /api/communities/{id}/join
Authorization: Bearer TOKEN
Leave Community
POST /api/communities/{id}/leave
Authorization: Bearer TOKEN
Proposals
List Proposals
GET /api/communities/{id}/proposals
Get Proposal
GET /api/proposals/{id}
Create Proposal
POST /api/communities/{id}/proposals
Authorization: Bearer TOKEN
Content-Type: application/json
{
"title": "Proposal Title",
"description": "Full description",
"voting_method": "approval",
"options": [
{"label": "Option A", "description": "..."},
{"label": "Option B", "description": "..."}
]
}
Vote
POST /api/proposals/{id}/vote
Authorization: Bearer TOKEN
Content-Type: application/json
{
"option_ids": ["uuid1", "uuid2"]
}
Vote (Ranked)
POST /api/proposals/{id}/vote/ranked
Authorization: Bearer TOKEN
Content-Type: application/json
{
"rankings": [
{"option_id": "uuid1", "rank": 1},
{"option_id": "uuid2", "rank": 2}
]
}
Vote (Quadratic)
POST /api/proposals/{id}/vote/quadratic
Authorization: Bearer TOKEN
Content-Type: application/json
{
"allocations": {
"uuid1": 5,
"uuid2": 3
}
}
Delegations
List Delegations
GET /api/delegations
Authorization: Bearer TOKEN
Create Delegation
POST /api/delegations
Authorization: Bearer TOKEN
Content-Type: application/json
{
"delegate_id": "user-uuid",
"community_id": "community-uuid",
"scope": "topic",
"topic_id": "topic-uuid"
}
Revoke Delegation
DELETE /api/delegations/{id}
Authorization: Bearer TOKEN
Users
Get Current User
GET /api/users/me
Authorization: Bearer TOKEN
Update Profile
PUT /api/users/me
Authorization: Bearer TOKEN
Content-Type: application/json
{
"display_name": "New Name",
"bio": "Updated bio"
}
Demo Endpoints
Demo Status
GET /api/demo/status
Reset Demo (Admin)
POST /api/demo/reset
Authorization: Bearer TOKEN
Error Responses
{
"error": "Error message",
"code": "ERROR_CODE"
}
Common status codes:
400- Bad request401- Unauthorized403- Forbidden404- Not found422- Validation error500- Server error