""" Debug why server categories aren't appearing """ import requests import json # Authenticate login_response = requests.post('http://localhost:8000/api/v1/auth/login', json={ 'username': 'admin', 'password': 'admin123' }) if login_response.status_code != 200: print(f"Login failed: {login_response.status_code}") exit(1) token = login_response.json()['access_token'] headers = {'Authorization': f'Bearer {token}'} print("="*80) print("DEBUGGING ACTION CATEGORIES") print("="*80) print() # Get the full response response = requests.get('http://localhost:8000/api/v1/configuration/action-categories', headers=headers) print(f"Status: {response.status_code}") print() if response.status_code == 200: data = response.json() categories = data.get('categories', {}) print(f"Total categories: {data.get('total_categories', 0)}") print(f"Total actions: {data.get('total_actions', 0)}") print() print("ALL CATEGORY NAMES:") for i, cat_name in enumerate(sorted(categories.keys()), 1): action_count = len(categories[cat_name]) prefix = "" if cat_name.startswith("G-Core:"): prefix = "[G-CORE] " elif cat_name.startswith("GSC:"): prefix = "[GSC] " print(f"{i:3d}. {prefix}{cat_name} ({action_count} actions)") print() # Count by type base_count = sum(1 for c in categories.keys() if not c.startswith("G-Core:") and not c.startswith("GSC:")) gcore_count = sum(1 for c in categories.keys() if c.startswith("G-Core:")) gsc_count = sum(1 for c in categories.keys() if c.startswith("GSC:")) print(f"Base: {base_count}, G-Core: {gcore_count}, GSC: {gsc_count}") else: print(f"Error: {response.text}")