coldbox-rest-api-developmentlisted
Install: claude install-skill ColdBox/skills
# REST API Development
## When to Use This Skill
Use this skill when building REST APIs with ColdBox, including API routing, handlers, authentication, versioning, and response formatting.
## Language Mode Reference
Examples use **BoxLang (`.bx`)** syntax by default. Adapt for your target language:
| Concept | BoxLang (`.bx`) | CFML (`.cfc`) |
|---------|-----------------|---------------|
| Class declaration | `class [extends="..."] {` | `component [extends="..."] {` |
| DI annotation | `@inject` above `property name="svc";` | `property name="svc" inject="svc";` |
| View templates | `.bxm` suffix | `.cfm` / `.cfml` suffix |
| Tag prefix | `<bx:if>`, `<bx:output>`, `<bx:set>` | `<cfif>`, `<cfoutput>`, `<cfset>` |
> **CFML Compat Mode**: With BoxLang + CFML Compat module, `.bx` and `.cfc` files coexist freely. BoxLang-native classes use `class {}` (`.bx` files); CFML-compat classes use `component {}` (`.cfc` files).
## Core Concepts
ColdBox REST APIs use:
- **RestHandler** — base handler with built-in error handling and response formatting
- **`event.renderData()`** — renders JSON/XML/text responses with status codes
- **Route resources** — maps CRUD verbs to handler actions
- **Modules** — ideal for versioned API isolation
- **JWT/cbSecurity** — provides API authentication
## API Module Structure
```
modules_app/
api/
config/
Router.cfc # API-specific routes
handlers/
Users.cfc # Users API handler
Posts.cfc
models/
Us