API Specifications
API specs are YAML definitions for extracting data from REST APIs. They handle authentication, pagination, response processing, and incremental sync automatically.
When to Use
- Extract data from REST APIs (GET endpoints only)
- Build incremental sync workflows
- Handle complex pagination patterns
- Process nested JSON responses
- Chain multiple API calls with queues
Basic Structure
name: "My API"
description: "Data extraction from My API"
authentication:
type: "static"
headers:
Authorization: "Bearer {secrets.api_token}"
defaults:
state:
base_url: "https://api.example.com/v1"
request:
headers:
Accept: "application/json"
endpoints:
users:
description: "Fetch users"
request:
url: "{state.base_url}/users"
response:
records:
jmespath: "data[]"
primary_key: ["id"]
MCP Operations
Parse a Spec
{
"action": "parse",
"input": {"file_path": "/path/to/spec.yaml"}
}
Test Endpoints
{
"action": "test",
"input": {
"connection": "MY_API",
"endpoints": ["users"],
"debug": true,
"limit": 10
}
}
Topics Reference
This skill includes detailed documentation for each aspect of API specification building:
| Topic |
Description |
| AUTHENTICATION.md |
All 8 authentication types (static, basic, OAuth2, AWS, HMAC, sequence) |
| ENDPOINTS.md |
Endpoint configuration, setup/teardown sequences |
| REQUEST.md |
HTTP request configuration, rate limiting |
| PAGINATION.md |
All pagination patterns (cursor, offset, page, link header) |
| RESPONSE.md |
Record extraction, deduplication |
| PROCESSORS.md |
Data transformations, aggregations |
| VARIABLES.md |
Variable scopes, expressions, rendering order |
| QUEUES.md |
Endpoint chaining, iteration |
| INCREMENTAL.md |
Sync state, context variables |
| DYNAMIC.md |
Runtime endpoint generation |
| FUNCTIONS.md |
Expression functions reference |
| RULES.md |
Response rules, retries, error handling |
Quick Reference
Authentication Types
| Type |
Use Case |
static |
API key, Bearer token |
basic |
Username/password |
oauth2 |
OAuth 2.0 flows (client_credentials, authorization_code, device_code) |
aws-sigv4 |
AWS services |
hmac |
Crypto exchanges, custom signing |
sequence |
Multi-step custom auth |
Pagination Patterns
| Pattern |
Example |
| Cursor |
starting_after, page_token |
| Offset |
offset + limit |
| Page |
page number |
| Link header |
GitHub-style rel="next" |
Variable Scopes
| Scope |
Description |
secrets.* |
Credentials from connection |
state.* |
Endpoint state variables |
sync.* |
Persisted from previous run |
response.* |
HTTP response data |
record.* |
Current record in processor |
queue.* |
Endpoint chaining |
Full Documentation
See https://docs.slingdata.io/concepts/api-specs.md for complete reference.
1---
2name: sling-api-specs
3description: >
4 Build REST API specifications for Sling data extraction.
5 Use when creating API specs, configuring authentication (OAuth, API key, Bearer token, HMAC), setting up pagination (cursor, offset, page), processing responses, handling rate limits, chaining endpoints with queues, or implementing incremental sync.
6metadata:
7 source: https://skillmd.com/skills/modbender/sling-api-specs
8---
9
10# API Specifications
11
12API specs are YAML definitions for extracting data from REST APIs. They handle authentication, pagination, response processing, and incremental sync automatically.
13
14## When to Use
15
16- Extract data from REST APIs (GET endpoints only)
17- Build incremental sync workflows
18- Handle complex pagination patterns
19- Process nested JSON responses
20- Chain multiple API calls with queues
21
22## Basic Structure
23
24```yaml
25name: "My API"
26description: "Data extraction from My API"
27
28authentication:
29 type: "static"
30 headers:
31 Authorization: "Bearer {secrets.api_token}"
32
33defaults:
34 state:
35 base_url: "https://api.example.com/v1"
36 request:
37 headers:
38 Accept: "application/json"
39
40endpoints:
41 users:
42 description: "Fetch users"
43 request:
44 url: "{state.base_url}/users"
45 response:
46 records:
47 jmespath: "data[]"
48 primary_key: ["id"]
49```
50
51## MCP Operations
52
53### Parse a Spec
54```json
55{
56 "action": "parse",
57 "input": {"file_path": "/path/to/spec.yaml"}
58}
59```
60
61### Test Endpoints
62```json
63{
64 "action": "test",
65 "input": {
66 "connection": "MY_API",
67 "endpoints": ["users"],
68 "debug": true,
69 "limit": 10
70 }
71}
72```
73
74## Topics Reference
75
76This skill includes detailed documentation for each aspect of API specification building:
77
78| Topic | Description |
79|-------|-------------|
80| [AUTHENTICATION.md](AUTHENTICATION.md) | All 8 authentication types (static, basic, OAuth2, AWS, HMAC, sequence) |
81| [ENDPOINTS.md](ENDPOINTS.md) | Endpoint configuration, setup/teardown sequences |
82| [REQUEST.md](REQUEST.md) | HTTP request configuration, rate limiting |
83| [PAGINATION.md](PAGINATION.md) | All pagination patterns (cursor, offset, page, link header) |
84| [RESPONSE.md](RESPONSE.md) | Record extraction, deduplication |
85| [PROCESSORS.md](PROCESSORS.md) | Data transformations, aggregations |
86| [VARIABLES.md](VARIABLES.md) | Variable scopes, expressions, rendering order |
87| [QUEUES.md](QUEUES.md) | Endpoint chaining, iteration |
88| [INCREMENTAL.md](INCREMENTAL.md) | Sync state, context variables |
89| [DYNAMIC.md](DYNAMIC.md) | Runtime endpoint generation |
90| [FUNCTIONS.md](FUNCTIONS.md) | Expression functions reference |
91| [RULES.md](RULES.md) | Response rules, retries, error handling |
92
93## Quick Reference
94
95### Authentication Types
96
97| Type | Use Case |
98|------|----------|
99| `static` | API key, Bearer token |
100| `basic` | Username/password |
101| `oauth2` | OAuth 2.0 flows (client_credentials, authorization_code, device_code) |
102| `aws-sigv4` | AWS services |
103| `hmac` | Crypto exchanges, custom signing |
104| `sequence` | Multi-step custom auth |
105
106### Pagination Patterns
107
108| Pattern | Example |
109|---------|---------|
110| Cursor | `starting_after`, `page_token` |
111| Offset | `offset` + `limit` |
112| Page | `page` number |
113| Link header | GitHub-style `rel="next"` |
114
115### Variable Scopes
116
117| Scope | Description |
118|-------|-------------|
119| `secrets.*` | Credentials from connection |
120| `state.*` | Endpoint state variables |
121| `sync.*` | Persisted from previous run |
122| `response.*` | HTTP response data |
123| `record.*` | Current record in processor |
124| `queue.*` | Endpoint chaining |
125
126## Full Documentation
127
128See https://docs.slingdata.io/concepts/api-specs.md for complete reference.