Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from bundle
Operational SendPulse skill with live-verified REST, MCP handshake, and MCP tool-call tests.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/rest_api_key_smoke.sh
1#!/usr/bin/env bash2set -euo pipefail34BASE_URL="https://api.sendpulse.com"5ENDPOINT="/user/info"6API_KEY="${SENDPULSE_API_KEY:-}"7DRY_RUN=089usage() {10cat <<'EOF'11Usage:12rest_api_key_smoke.sh [--api-key <key>] [--base-url <url>] [--endpoint <path>] [--dry-run]1314Purpose:15Run a safe SendPulse REST API smoke test using API key auth.16Default endpoint is /user/info.1718Env fallback:19SENDPULSE_API_KEY20EOF21}2223while [[ $# -gt 0 ]]; do24case "$1" in25--api-key)26API_KEY="${2:-}"27shift 228;;29--base-url)30BASE_URL="${2:-}"31shift 232;;33--endpoint)34ENDPOINT="${2:-}"35shift 236;;37--dry-run)38DRY_RUN=139shift40;;41-h|--help)42usage43exit 044;;45*)46echo "Unknown argument: $1" >&247usage >&248exit 149;;50esac51done5253if [[ "${ENDPOINT}" != /* ]]; then54ENDPOINT="/${ENDPOINT}"55fi5657if [[ -z "${API_KEY}" ]]; then58echo "Missing API key. Pass --api-key or set SENDPULSE_API_KEY." >&259exit 160fi6162URL="${BASE_URL}${ENDPOINT}"63CURL_CMD=(64curl --silent --show-error --fail-with-body65-H "Accept: application/json"66-H "Authorization: Bearer ${API_KEY}"67"$URL"68)6970if [[ ${DRY_RUN} -eq 1 ]]; then71echo "[dry-run] GET ${URL}"72echo "[dry-run] Authorization: Bearer <redacted>"73printf '[dry-run] curl'; printf ' %q' "${CURL_CMD[@]//${API_KEY}/<redacted>}"; printf '\n'74exit 075fi7677"${CURL_CMD[@]}"78