#!/bin/bash # Make authenticated API calls using saved token # Usage: /opt/media-downloader/scripts/api-call.sh "/api/endpoint?params" # # First run get-api-token.sh to get a token, then use this script. # Example: /opt/media-downloader/scripts/api-call.sh "/api/video-queue?limit=2" ENDPOINT="$1" shift if [ ! -f /tmp/api_token.txt ]; then echo "No token found. Run get-api-token.sh first." exit 1 fi TOKEN=$(cat /tmp/api_token.txt) curl -s "http://localhost:8000${ENDPOINT}" -b "auth_token=$TOKEN" "$@"