# VTL Endpoints - Quick Fix Guide

## Issue: 404 Not Found on VTL Endpoints

The VTL endpoints **ARE implemented** in the code, but the server needs to be restarted to load them.

## ✅ Solution: Restart the API Server

### Option 1: Quick Restart Script

```bash
# Rebuild and get restart instructions
./scripts/restart-api.sh
```

### Option 2: Manual Restart

```bash
# 1. Stop the current server
pkill -f calypso-api

# 2. Rebuild
cd backend
go build -o bin/calypso-api ./cmd/calypso-api

# 3. Set environment variables
export CALYPSO_DB_PASSWORD="your_password"
export CALYPSO_JWT_SECRET="your_jwt_secret_min_32_chars"

# 4. Start the server
./bin/calypso-api -config config.yaml.example
```

### Option 3: If Using Systemd

```bash
# Rebuild
cd backend
go build -o /opt/calypso/backend/bin/calypso-api ./cmd/calypso-api

# Restart service
sudo systemctl restart calypso-api

# Check status
sudo systemctl status calypso-api
```

## 🔍 Verify Routes are Working

After restart, test:

```bash
# Should return 401 (unauthorized) NOT 404 (not found)
curl http://localhost:8080/api/v1/tape/vtl/libraries

# With auth, should return 200 with empty array
curl http://localhost:8080/api/v1/tape/vtl/libraries \
  -H "Authorization: Bearer $TOKEN"
```

## 📋 Implemented Endpoints

All these endpoints are implemented and should work after restart:

✅ `GET /api/v1/tape/vtl/libraries`  
✅ `POST /api/v1/tape/vtl/libraries`  
✅ `GET /api/v1/tape/vtl/libraries/:id`  
✅ `DELETE /api/v1/tape/vtl/libraries/:id`  
✅ `GET /api/v1/tape/vtl/libraries/:id/drives`  
✅ `GET /api/v1/tape/vtl/libraries/:id/tapes`  
✅ `POST /api/v1/tape/vtl/libraries/:id/tapes`  
✅ `POST /api/v1/tape/vtl/libraries/:id/load`  
✅ `POST /api/v1/tape/vtl/libraries/:id/unload`  

## 🎯 Next Steps After Restart

1. **Test the endpoints** using `./scripts/test-vtl.sh`
2. **Create a VTL library** via API
3. **Verify database records** are created
4. **Test load/unload operations**

The endpoints are ready - just need the server restarted! 🚀

