51 lines
1.6 KiB
Bash
Executable file
51 lines
1.6 KiB
Bash
Executable file
#!/bin/bash
|
|
# Setup script for MockAPI API collections
|
|
|
|
echo "🔧 Setting up MockAPI API collections..."
|
|
|
|
# Check if Python is available
|
|
if ! command -v python3 &> /dev/null; then
|
|
echo "❌ Python 3 is not installed or not in PATH"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if MockAPI server is running (optional)
|
|
echo "📡 Checking if MockAPI server is running..."
|
|
if curl -s http://localhost:8000/health > /dev/null 2>&1; then
|
|
echo "✅ MockAPI server is running"
|
|
else
|
|
echo "⚠️ MockAPI server may not be running on http://localhost:8000"
|
|
echo " Start it with: python run.py"
|
|
read -p "Continue anyway? (y/n) " -n 1 -r
|
|
echo
|
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Run the test client setup script
|
|
echo "🔄 Creating test OAuth client..."
|
|
cd "$(dirname "$0")/.." # Go to project root
|
|
python3 examples/setup-test-client.py
|
|
|
|
echo ""
|
|
echo "✅ Setup complete!"
|
|
echo ""
|
|
echo "📋 Next steps:"
|
|
echo "1. Choose your API client:"
|
|
echo " - Bruno: Import 'examples/mockapi-collection.bru'"
|
|
echo " - Postman: Import 'examples/mockapi-postman-collection.json'"
|
|
echo "2. Update variables if needed:"
|
|
echo " - baseUrl: URL of your MockAPI instance"
|
|
echo " - clientId/clientSecret: Use the values printed above"
|
|
echo "3. Start testing!"
|
|
echo ""
|
|
echo "📚 Collections include:"
|
|
echo " - Health check"
|
|
echo " - Admin authentication"
|
|
echo " - Mock endpoint CRUD operations"
|
|
echo " - OAuth2 flows (client credentials, auth code, refresh)"
|
|
echo " - Token introspection and revocation"
|
|
echo " - Protected endpoint testing"
|
|
echo ""
|
|
echo "💡 Tip: Run 'Admin - Login' first to authenticate for admin endpoints"
|