claude-configs/skills/major-domo/API_REFERENCE.md
Cal Corum 67337a6771 Modularize major-domo skill (1005 -> 173 lines in SKILL.md)
Extract API and CLI references into dedicated files:
- SKILL.md (173 lines): routing, safety rules, architecture, common queries
- API_REFERENCE.md (99 lines): endpoints, auth, Python client
- CLI_REFERENCE.md (115 lines): commands, flag ordering, compliance workflow

Total content reduced from 1005 to 387 lines.
Context loaded per session drops from 1005 to 173 lines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 19:50:05 -06:00

100 lines
3.5 KiB
Markdown

# Major Domo - API Reference
## Authentication
All write operations require Bearer token:
```bash
export API_TOKEN='your-token-here'
```
## Environments
- **Production**: `https://api.sba.manticorum.com/v3/`
- **Development**: `http://10.10.0.42:8000/api/v3/`
```bash
export DATABASE='prod' # or 'dev'
```
## Endpoints
### Current Status
- `GET /current` - Current season/week status
- `GET /current?season={N}` - Specific season status
- `PATCH /current/{id}` - Update status (private)
### Players
- `GET /players?season={N}` - List all players in season
- `GET /players?team_id={id}` - Players by team
- `GET /players?name={name}` - Players by name (exact)
- `GET /players/search?q={query}` - Fuzzy search
- `GET /players/{id}` - Single player
- `PATCH /players/{id}` - Update player (private)
### Teams
- `GET /teams?season={N}` - List teams
- `GET /teams?team_abbrev={abbrev}` - By abbreviation
- `GET /teams?active_only=true` - Active teams only
- `GET /teams/{id}` - Single team
- `GET /teams/{id}/roster/{which}` - Roster (current/next)
### Standings
- `GET /standings?season={N}` - All standings
- `GET /standings?season={N}&division_abbrev={div}` - By division
- `GET /standings/team/{team_id}` - Single team
- `POST /standings/s{season}/recalculate` - Recalculate (private)
### Transactions
- `GET /transactions?season={N}` - List transactions
- `GET /transactions?season={N}&team_abbrev={abbrev}` - By team
- `GET /transactions?season={N}&week_start={W}&week_end={W}` - By week range
- `PATCH /transactions/{move_id}` - Update (private)
### Statistics (Advanced Views)
- `GET /views/season-stats/batting?season={N}` - Season batting
- Params: `team_id`, `player_id`, `min_pa`, `sort_by`, `sort_order`, `limit`, `offset`
- `GET /views/season-stats/pitching?season={N}` - Season pitching
- Params: `team_id`, `player_id`, `min_outs`, `sort_by`, `sort_order`, `limit`, `offset`
- `POST /views/season-stats/batting/refresh` - Refresh batting (private)
- `POST /views/season-stats/pitching/refresh` - Refresh pitching (private)
### Other Endpoints
- `/api/v3/schedules` - Game scheduling
- `/api/v3/results` - Game results
- `/api/v3/injuries` - Injury tracking
- `/api/v3/awards` - League awards
- `/api/v3/managers` - Manager profiles
- `/api/v3/divisions` - Division info
- `/api/v3/draftdata` - Draft status
- `/api/v3/draftpicks` - Pick ownership
- `/api/v3/draftlist` - Draft priority lists
- `/api/v3/keepers` - Keeper selections
- `/api/v3/stratgame` - Game data
- `/api/v3/stratplay` - Play-by-play
- `/api/v3/sbaplayers` - Player pool
- `/api/v3/custom_commands` - Custom Discord commands
- `/api/v3/help_commands` - Static help text
## Python API Client
```python
from api_client import MajorDomoAPI
api = MajorDomoAPI(environment='prod', verbose=True)
# Or: api = MajorDomoAPI(environment='dev', token='your-token')
# Common operations
current = api.get_current()
team = api.get_team(abbrev='CAR')
player = api.get_player(name='Mike Trout', season=12)
results = api.search_players(query='trout', season=12, limit=10)
roster = api.get_team_roster(team_id=42, which='current')
standings = api.get_standings(season=12, division_abbrev='ALE')
transactions = api.get_transactions(season=12, team_abbrev='CAR')
batting = api.get_season_batting_stats(season=12, min_pa=100, sort_by='woba', limit=50)
pitching = api.get_season_pitching_stats(season=12, min_outs=150, sort_by='era', limit=50)
```
**OpenAPI docs**: `http://10.10.0.42/api/docs`
**Router source**: `/mnt/NV2/Development/major-domo/database/app/routers_v3/`