REST API Documentation with OpenAPI/Swagger Last Update: 2026-02-09 β
The backend REST API is automatically documented using MicroProfile OpenAPI.
When backend is running:
cd /home/r-uu/develop/github/main/root/app/jeeeraaah/backend/api/ws_rs
mvn liberty:dev
Open browser: http://localhost:9080/openapi/ui
Example: Get all task groups
/taskgroups endpointMost endpoints require authentication with JWT token.
curl -X POST 'http://localhost:8080/realms/jeeeraaah-realm/protocol/openid-connect/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'username=testuser' \
-d 'password=testpassword' \
-d 'grant_type=password' \
-d 'client_id=jeeeraaah-frontend' \
| jq -r '.access_token'
Bearer <your-token-here>| Method | Endpoint | Description |
|βββ|βββ-|ββββ-|
| GET | /taskgroups | List all task groups |
| GET | /taskgroups/{id} | Get specific task group |
| POST | /taskgroups | Create new task group |
| PUT | /taskgroups/{id} | Update task group |
| DELETE | /taskgroups/{id} | Delete task group |
| Method | Endpoint | Description |
|βββ|βββ-|ββββ-|
| GET | /tasks | List all tasks |
| GET | /tasks/{id} | Get specific task |
| POST | /tasks | Create new task |
| PUT | /tasks/{id} | Update task |
| DELETE | /tasks/{id} | Delete task |
| Method | Endpoint | Description |
|βββ|βββ-|ββββ-|
| GET | /health | Overall health status |
| GET | /health/live | Liveness check |
| GET | /health/ready | Readiness check |
| GET | /metrics | Application metrics |
β
application/jsonapplication/jsonUse OpenAPI annotations in your JAX-RS resources:
@Path("/tasks")
@Tag(name = "Tasks", description = "Task management operations")
public class TaskService {
@GET
@Operation(
summary = "List all tasks",
description = "Returns a list of all tasks in the system"
)
@APIResponse(
responseCode = "200",
description = "List of tasks",
content = @Content(schema = @Schema(implementation = TaskDTO[].class))
)
public List<TaskDTO> findAll() {
// ...
}
@POST
@Operation(summary = "Create new task")
@APIResponse(
responseCode = "201",
description = "Task created",
content = @Content(schema = @Schema(implementation = TaskDTO.class))
)
public TaskDTO create(TaskDTO task) {
// ...
}
}
Main configuration in: JeeeRaaah.java
@OpenAPIDefinition(
info = @Info(
title = "JEEE-RAAAH backend API",
version = "1.0.0",
description = "Backend API with JTA/JPA"
),
servers = {
@Server(url = "http://localhost:9080/jeeeraaah")
}
)
public class JeeeRaaah extends Application {
// ...
}
curl http://localhost:9080/openapi -o openapi.yaml
curl http://localhost:9080/openapi \
-H "Accept: application/json" \
-o openapi.json
Postman:
openapi.yamlopenapi.yamlopenapi.yaml# Without auth (may fail if protected)
curl http://localhost:9080/jeeeraaah/taskgroups
# With JWT token
TOKEN="your-jwt-token-here"
curl http://localhost:9080/jeeeraaah/taskgroups \
-H "Authorization: Bearer $TOKEN"
TOKEN="your-jwt-token-here"
curl -X POST http://localhost:9080/jeeeraaah/taskgroups \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "New Project",
"description": "My new project"
}'
TOKEN="your-jwt-token-here"
curl http://localhost:9080/jeeeraaah/taskgroups/1 \
-H "Authorization: Bearer $TOKEN"
β Do:
@Operation summary to all endpoints@APIResponse for different status codes@GET
@Path("/{id}")
@Operation(
summary = "Get task by ID",
description = "Returns a single task by its unique identifier"
)
@APIResponses({
@APIResponse(
responseCode = "200",
description = "Task found",
content = @Content(schema = @Schema(implementation = TaskDTO.class))
),
@APIResponse(
responseCode = "404",
description = "Task not found"
),
@APIResponse(
responseCode = "401",
description = "Unauthorized - valid JWT required"
)
})
public TaskDTO findById(@PathParam("id") Long id) {
// ...
}
Check backend is running:
curl http://localhost:9080/health
Check OpenAPI endpoint:
curl http://localhost:9080/openapi
Verify JAX-RS annotations:
@Path annotation@GET, @POST, etc.cd /home/r-uu/develop/github/main/root/app/jeeeraaah/backend/api/ws_rs
mvn liberty:dev
# Watch console for errors
See: config/JWT-TROUBLESHOOTING.md β
Last updated: 2026-02-09
Status: OpenAPI configured and working
Access: http://localhost:9080/openapi/ui