create-rep-interaction.sh

#!/bin/sh
if [ "$#" -ne 4 ]
then
	echo "Usage: $0 JWT_FILE VENDOR_ID REP_ID ATTENDEE_ID"
	exit 1
fi

jwt_filepath=$1
VENDOR_ID=$2
REP_ID=$3
ATTENDEE_ID=$4

# Read the JWT token from the JSON file
access_token=$(jq -r '.access_token' "$jwt_filepath")
token_type=$(jq -r '.token_type' "$jwt_filepath")

# Check if token_type is "bearer"
if [ "$token_type" != "bearer" ]; then
    echo "Error: invalid token_type"
    exit 1
fi

# Set the Authorization header to the JWT token
authorization="Authorization: Bearer $access_token"

SERVER_URL="${SWGY_SERVER:-http://127.0.0.1}"

curl -k -vvv -X "PUT" \
  -H "Content-Type: application/json" \
  -H "$authorization" \
  -d "{\"attendee-id\":\"${ATTENDEE_ID}\"}\"}" \
  ${SERVER_URL}/api/vendors/${VENDOR_ID}/reps/${REP_ID}/interxs