Files
tilbudgivern/apitest/examples/curl_unit.sh

25 lines
534 B
Bash
Executable File

#!/bin/bash
# Query: unit - Get single unit
if [ -z "$1" ]; then
echo "Usage: $0 <unit_id>"
echo "Example: $0 1"
exit 1
fi
UNIT_ID="$1"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/../apikey"
curl -s -X POST "https://graphql.ordrestyring.dk/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${API_KEY}" \
--data-binary @- <<EOF | jq '.'
{
"query": "query GetUnit(\$id: Int!) { unit(id: \$id) { id name } }",
"variables": {
"id": ${UNIT_ID}
}
}
EOF