-
Notifications
You must be signed in to change notification settings - Fork 0
User API
The User API provides endpoints for creating and querying user information.
Base URL: http://localhost:8081/api/1/users
Create a new user in the system.
Endpoint: POST /api/1/users
Authentication: Not required (public endpoint)
{
"username": "string"
}| Field | Type | Required | Description |
|---|---|---|---|
| username | string | Yes | Unique username |
Status: 201 Created
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"username": "johndoe"
}curl -X POST http://localhost:8081/api/1/users \
-H "Content-Type: application/json" \
-d '{
"username": "johndoe"
}'Base URL: http://localhost:8082/api/1/users
Retrieve a specific user by their UUID.
Endpoint: GET /api/1/users/{id}
Authentication: Required (USER or ADMIN role)
| Parameter | Type | Description |
|---|---|---|
| id | UUID | User's unique identifier |
Status: 200 OK
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"username": "johndoe"
}curl -X GET http://localhost:8082/api/1/users/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer <your-token>"Retrieve a user by their username.
Endpoint: GET /api/1/users/username/{username}
Authentication: Not required (public endpoint)
| Parameter | Type | Description |
|---|---|---|
| username | string | User's username |
Status: 200 OK
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"username": "johndoe"
}curl -X GET http://localhost:8082/api/1/users/username/johndoeRetrieve the profile of the currently authenticated user.
Endpoint: GET /api/1/users/me
Authentication: Required (USER or ADMIN role)
Status: 200 OK
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"username": "johndoe"
}curl -X GET http://localhost:8082/api/1/users/me \
-H "Authorization: Bearer <your-token>"User doesn't exist:
{
"timestamp": "2025-10-16T10:30:00.000Z",
"status": 404,
"error": "Not Found",
"message": "User not found with id: 550e8400-e29b-41d4-a716-446655440000",
"path": "/api/1/users/550e8400-e29b-41d4-a716-446655440000"
}Missing or invalid authentication token:
{
"timestamp": "2025-10-16T10:30:00.000Z",
"status": 401,
"error": "Unauthorized",
"message": "Full authentication is required to access this resource",
"path": "/api/1/users/550e8400-e29b-41d4-a716-446655440000"
}# 1. Register a new user (creates user and returns token)
RESPONSE=$(curl -X POST http://localhost:8083/api/1/auth/register \
-H "Content-Type: application/json" \
-d '{"username":"johndoe","password":"secret123"}')
# Extract token
TOKEN=$(echo $RESPONSE | jq -r '.token')
# 2. Get your own profile
curl -X GET http://localhost:8082/api/1/users/me \
-H "Authorization: Bearer $TOKEN"
# 3. Look up another user by username
curl -X GET http://localhost:8082/api/1/users/username/janedoe- Trip API - Create and manage trips
- Authentication API - Learn about authentication
- Getting Started Guide - Full workflow examples
Welcome to the Trip Tracker Backend API documentation! This wiki provides comprehensive information about all available REST APIs in the system.
- API Overview - Introduction to the API architecture and general concepts
- Getting Started - Quick start guide with examples
- Authentication - How to authenticate and obtain JWT tokens
- User API - User management endpoints
- Trip API - Trip creation, updates, and queries
- Trip Plan API - Trip planning and route management
- Comment API - Comments and reactions on trips
- Trip Update API - Location updates and tracking
- API Response Formats - Common response structures and error handling
- Security & Authorization - Authentication, roles, and permissions
The Trip Tracker Backend follows a CQRS (Command Query Responsibility Segregation) architecture with three main services:
| Service | Port | Purpose | Base Path |
|---|---|---|---|
| tracker-auth | 8083 | Authentication & user registration | /api/1/auth |
| tracker-command | 8081 | Write operations (Create, Update, Delete) | /api/1 |
| tracker-query | 8082 | Read operations (Queries) | /api/1 |
All API endpoints (except registration and login) require JWT authentication. Include the token in the Authorization header:
Authorization: Bearer <your-jwt-token>
Get your token by calling the Login endpoint.
Here's a quick example to get you started:
# 1. Register a new user
curl -X POST http://localhost:8083/api/1/auth/register \
-H "Content-Type: application/json" \
-d '{"username":"john","password":"secret123"}'
# 2. Use the returned token to create a trip
curl -X POST http://localhost:8081/api/1/trips \
-H "Authorization: Bearer <your-token>" \
-H "Content-Type: application/json" \
-d '{"name":"My Camino","visibility":"PUBLIC"}'
# 3. Query your trips
curl -X GET http://localhost:8082/api/1/trips/me \
-H "Authorization: Bearer <your-token>"For interactive API documentation with try-it-out functionality, access the Swagger UI:
- Auth Service: http://localhost:8083/swagger-ui.html
- Command Service: http://localhost:8081/swagger-ui.html
- Query Service: http://localhost:8082/swagger-ui.html
For issues, questions, or contributions:
- GitHub Issues: Report a bug or request a feature
- Source Code: View on GitHub
Ready to get started? Check out the Getting Started Guide!