Files
tilbudgivern/apitest/examples/curl_customer.sh

28 lines
753 B
Bash
Executable File

#!/bin/bash
# Query: customer - Get customer by ID
# Note: Requires valid customer ID - cannot be tested without real data
if [ -z "$1" ]; then
echo "Usage: $0 <customer_id>"
echo "Example: $0 123"
echo ""
echo "Note: Requires a valid customer ID from your system"
exit 1
fi
CUSTOMER_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 GetCustomer(\$id: Int!) { customer(id: \$id) { id name email phone address { street city postalCode } } }",
"variables": {
"id": ${CUSTOMER_ID}
}
}
EOF