Now we have an API

This commit is contained in:
James Pattinson
2025-10-12 19:33:45 +00:00
parent 35f710049a
commit b8a91103e9
7 changed files with 660 additions and 3 deletions

30
api/test_api.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/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}"