Fix BMS endpoint and auth issues

This commit is contained in:
Steve W
2026-04-07 19:50:24 +00:00
parent 4cfea24c7e
commit 0916a308b2
5 changed files with 18 additions and 13 deletions

3
scripts/bms-accounts.sh Executable file → Normal file
View File

@@ -1,4 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Get token from bms-auth.sh
if ! token=$(bash "${SCRIPT_DIR}/bms-auth.sh" get-token 2>/dev/null); then

4
scripts/bms-auth.sh Executable file → Normal file
View File

@@ -88,8 +88,8 @@ cmd_auth_refresh() {
local response
response=$(curl -sf -X POST "${BMS_API_BASE}/v2/security/refreshtoken" \
-H "Content-Type: application/json" \
-d "{\"AccessToken\":\"${access_token}\",\"RefreshToken\":\"${refresh_token}\"}") \
-F "AccessToken=${access_token}" \
-F "RefreshToken=${refresh_token}") \
|| { echo "Refresh failed, re-authenticating..." >&2; cmd_auth_login; return; }
save_token "$response"

3
scripts/bms-locations.sh Executable file → Normal file
View File

@@ -1,4 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Get token from bms-auth.sh
if ! token=$(bash "${SCRIPT_DIR}/bms-auth.sh" get-token 2>/dev/null); then

9
scripts/bms-lookup.sh Executable file → Normal file
View File

@@ -53,12 +53,10 @@ cmd_lookup() {
bms_curl "/v2/system/issuetypes/lookup" | format_lookup
;;
sources|source)
echo "=== Ticket Sources ===" >&2
bms_curl "/v2/system/lookup/TicketSource" | format_lookup
die "Ticket source lookup endpoint is not exposed in the public BMS v2 Swagger. Use tenant-specific documentation or known SourceId values."
;;
ticket-types|tickettypes)
echo "=== Ticket Types ===" >&2
bms_curl "/v2/system/lookup/TicketType" | format_lookup
die "Ticket type lookup endpoint is not exposed in the public BMS v2 Swagger. Use tenant-specific documentation or known TypeId values."
;;
assignees|assignee|technicians)
echo "=== Assignees / Technicians ===" >&2
@@ -73,8 +71,7 @@ cmd_lookup() {
bms_curl "/v2/system/worktypes/lookup" | format_lookup
;;
note-types|notetypes)
echo "=== Note Types (via tenantlookup) ===" >&2
bms_curl "/v2/system/tenantlookup/NoteType" | format_lookup
die "Note type lookup endpoint is not exposed in the public BMS v2 Swagger. Use tenant-specific documentation or known note TypeId values."
;;
all)
cmd_lookup statuses