Skip to main content

Testing: API

Test pagination, filtering, error handling, and authentication.

Demo Credentials

RoleEmailPasswordTenant
Admindaniel.harris@example.comDemo1234!demo-association

Test 1: Authentication

# Login
curl -s -X POST https://ams.14.jugaar.ai/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"daniel.harris@example.com","password":"Demo1234!","tenant_id":"demo-association"}'

# Get user info
curl -s https://ams.14.jugaar.ai/api/v1/auth/me \
-H "Authorization: Bearer $TOKEN"

Test 2: Pagination

# First page
curl -s "https://ams.14.jugaar.ai/api/v1/members/?page=1&per_page=10" \
-H "Authorization: Bearer $TOKEN"

# Second page
curl -s "https://ams.14.jugaar.ai/api/v1/members/?page=2&per_page=10" \
-H "Authorization: Bearer $TOKEN"

Test 3: Error Handling

# 401 — No token
curl -s -o /dev/null -w "%{http_code}" https://ams.14.jugaar.ai/api/v1/members/
# Expected: 401

# 404 — Not found
curl -s -o /dev/null -w "%{http_code}" https://ams.14.jugaar.ai/api/v1/members/nonexistent \
-H "Authorization: Bearer $TOKEN"
# Expected: 404

# 422 — Validation error
curl -s -o /dev/null -w "%{http_code}" -X POST https://ams.14.jugaar.ai/api/v1/members/ \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{}'
# Expected: 422

Test 4: Trailing Slash

warning

All list endpoints require a trailing slash!

# ✅ Correct — trailing slash
curl -s -o /dev/null -w "%{http_code}" https://ams.14.jugaar.ai/api/v1/members/ \
-H "Authorization: Bearer $TOKEN"
# Expected: 200

# ❌ Wrong — no trailing slash (returns 307 redirect)
curl -s -o /dev/null -w "%{http_code}" https://ams.14.jugaar.ai/api/v1/members \
-H "Authorization: Bearer $TOKEN"
# Expected: 307

Test 5: Health Check

  1. Go to https://ams.14.jugaar.ai/health
  2. ✅ See JSON with service status

Expected HTTP Status Codes

CodeMeaning
200Success
201Created
401Not authenticated
403Forbidden (wrong role)
404Not found
422Validation error
307Redirect (missing trailing slash)