Files
sasa-maillist/api/test_api.sh
James Pattinson b8a91103e9 Now we have an API
2025-10-12 19:33:45 +00:00

31 lines
824 B
Bash
Executable File

#!/bin/bash
# Quick test script for the Mailing List API
API_URL="http://localhost:8000"
TOKEN="your_api_token_here_change_this"
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}Testing Mailing List API${NC}\n"
echo -e "${GREEN}1. Health Check:${NC}"
curl -s $API_URL/health | jq .
echo -e "\n"
echo -e "${GREEN}2. Get All Lists:${NC}"
curl -s -H "Authorization: Bearer $TOKEN" $API_URL/lists | jq .
echo -e "\n"
echo -e "${GREEN}3. Get All Members:${NC}"
curl -s -H "Authorization: Bearer $TOKEN" $API_URL/members | jq .
echo -e "\n"
echo -e "${GREEN}4. Get Members of Community List:${NC}"
curl -s -H "Authorization: Bearer $TOKEN" $API_URL/lists/1/members | jq .
echo -e "\n"
echo -e "${BLUE}Visit http://localhost:8000/docs for interactive API documentation${NC}"