|
| 1 | +# /api - OpenAPI-Based API Access |
| 2 | + |
| 3 | +Execute API calls using OpenAPI specifications via Restish. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +```bash |
| 8 | +# Register an API |
| 9 | +stackmemory api add <name> <base-url> [--spec <openapi-url>] [--auth-type api-key] |
| 10 | + |
| 11 | +# List registered APIs |
| 12 | +stackmemory api list |
| 13 | + |
| 14 | +# Execute API call |
| 15 | +stackmemory api exec <name> <path> [--param value...] |
| 16 | + |
| 17 | +# Configure authentication |
| 18 | +stackmemory api auth <name> --token <token> --env-var <VAR_NAME> |
| 19 | +``` |
| 20 | + |
| 21 | +## Examples |
| 22 | + |
| 23 | +### GitHub API |
| 24 | + |
| 25 | +```bash |
| 26 | +# Register |
| 27 | +stackmemory api add github https://api.github.com |
| 28 | + |
| 29 | +# Auth (optional) |
| 30 | +stackmemory api auth github --token "$GITHUB_TOKEN" --env-var GITHUB_TOKEN |
| 31 | + |
| 32 | +# Execute |
| 33 | +stackmemory api exec github /repos/anthropics/anthropic-sdk-python |
| 34 | +stackmemory api exec github /users/octocat |
| 35 | +stackmemory api exec github /search/repositories --q "language:typescript stars:>1000" |
| 36 | +``` |
| 37 | + |
| 38 | +### Linear API |
| 39 | + |
| 40 | +```bash |
| 41 | +# Register |
| 42 | +stackmemory api add linear https://api.linear.app --auth-type api-key |
| 43 | + |
| 44 | +# Auth |
| 45 | +stackmemory api auth linear --token "$LINEAR_API_KEY" --env-var LINEAR_API_KEY |
| 46 | + |
| 47 | +# Execute (GraphQL via POST) |
| 48 | +stackmemory api exec linear /graphql |
| 49 | +``` |
| 50 | + |
| 51 | +## How It Works |
| 52 | + |
| 53 | +1. **Registration**: Stores API config in `~/.stackmemory/api-registry.json` and configures Restish |
| 54 | +2. **Auth**: Injects tokens from environment variables into request headers |
| 55 | +3. **Execution**: Uses Restish CLI for HTTP requests with automatic JSON parsing |
| 56 | +4. **Output**: Returns JSON response data |
| 57 | + |
| 58 | +## Requirements |
| 59 | + |
| 60 | +- Restish CLI: `brew install restish` |
| 61 | + |
| 62 | +## Integration |
| 63 | + |
| 64 | +This skill integrates with StackMemory's context system to: |
| 65 | +- Track API calls in session history |
| 66 | +- Enable context-aware suggestions for common operations |
| 67 | +- Store API responses for later retrieval |
| 68 | + |
| 69 | +## See Also |
| 70 | + |
| 71 | +- [Restish Documentation](https://rest.sh/) |
| 72 | +- [OpenAPI Specification](https://swagger.io/specification/) |
0 commit comments