25 lines
430 B
Bash
Executable File

#!/bin/bash
api_base_url="${PM_API_BASE_URL:-http://localhost:8081}"
if [ $# -eq 1 ]; then
url="$1"
method="GET"
data=""
elif [ $# -eq 2 ]; then
method="$1"
url="$2"
data=""
else
method="$1"
url="$2"
data="$3"
fi
curl -s -X "$method" \
-H "Content-Type: application/json" \
-H "Authorization: $(cat credential)" \
-H "Origin: https://curl.localhost" \
"${api_base_url}/api/$url" \
-d "$data" \
-v