Files
tilbudgivern/apitest/examples/curl_service_document.sh

18 lines
547 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 <serviceDocumentId>" >&2
exit 1
fi
DOC_ID=$1
curl -sS -X POST "$API_URL" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
--data "{\"query\":\"query { serviceDocument(id: $DOC_ID) { id filename description fileUrl fileType createdAt } }\"}" | jq .