Files
tilbudgivern/apitest/examples/curl_sync_start.sh
T

29 lines
785 B
Bash
Executable File

#!/bin/bash
# Query: syncStart - Start synchronization
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: $0 <direction> <type>"
echo "Example: $0 IMPORT FULL"
echo "Direction: IMPORT, EXPORT"
echo "Type: FULL, INCREMENTAL"
exit 1
fi
DIRECTION="$1"
TYPE="$2"
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 SyncStart(\$direction: SyncDirectionType!, \$type: SyncStartType!) { syncStart(direction: \$direction, type: \$type) { id status startedAt } }",
"variables": {
"direction": "${DIRECTION}",
"type": "${TYPE}"
}
}
EOF