Files
tilbudgivern/apitest/examples/curl_offer_task.sh

18 lines
496 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
API_URL="https://graphql.ordrestyring.dk/graphql"
KEY_FILE="$ROOT_DIR/apikey"
API_KEY=$(tr -d '\r\n' < "$KEY_FILE")
if [[ ${1:-} == "" ]]; then
echo "Usage: $0 <taskId>" >&2
exit 1
fi
TASK_ID=$1
curl -sS -X POST "$API_URL" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
--data "{\"query\":\"query { offerTask(id: $TASK_ID) { id description } }\"}" | jq .