Files
tilbudgivern/apitest/examples/mutation_close_scheme.sh

35 lines
894 B
Bash
Executable File

#!/bin/bash
# MUTATION: Close scheme
# SAFETY: Medium - changes scheme status to closed
if [ -z "$1" ]; then
echo "Usage: $0 <scheme_id>"
echo ""
echo "Example: $0 456"
echo ""
echo "⚠️ WARNING: This mutation closes a scheme."
echo "Closed schemes may not be editable afterwards."
echo "Only use with test schemes or after confirmation."
echo ""
echo "Note: Requires a valid scheme ID from production."
exit 1
fi
SCHEME_ID=$1
source "$(dirname "$0")/../apikey"
source "$(dirname "$0")/../apiendpoint"
curl -X POST "$GRAPHQL_ENDPOINT" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
--data-binary @- <<EOF | jq
{
"query": "mutation CloseScheme(\$schemeId: Int!) { closeScheme(schemeId: \$schemeId) { id status closed closedAt closedBy { id name } } }",
"variables": {
"schemeId": $SCHEME_ID
}
}
EOF