@dboio/cli 0.11.3 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -3
- package/bin/dbo.js +4 -0
- package/package.json +1 -1
- package/plugins/claude/dbo/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/dbo/commands/dbo.md +65 -244
- package/plugins/claude/dbo/docs/_audit_required/API/all.md +40 -0
- package/plugins/claude/dbo/docs/_audit_required/API/app.md +38 -0
- package/plugins/claude/dbo/docs/_audit_required/API/athenticate.md +26 -0
- package/plugins/claude/dbo/docs/_audit_required/API/cache.md +29 -0
- package/plugins/claude/dbo/docs/_audit_required/API/content.md +14 -0
- package/plugins/claude/dbo/docs/_audit_required/API/data_source.md +28 -0
- package/plugins/claude/dbo/docs/_audit_required/API/email.md +18 -0
- package/plugins/claude/dbo/docs/_audit_required/API/input.md +25 -0
- package/plugins/claude/dbo/docs/_audit_required/API/instance.md +28 -0
- package/plugins/claude/dbo/docs/_audit_required/API/log.md +8 -0
- package/plugins/claude/dbo/docs/_audit_required/API/media.md +12 -0
- package/plugins/claude/dbo/docs/_audit_required/API/output_by_entity.md +12 -0
- package/plugins/claude/dbo/docs/_audit_required/API/upload.md +7 -0
- package/plugins/claude/dbo/docs/_audit_required/dbo-api-syntax.md +1487 -0
- package/plugins/claude/dbo/docs/_audit_required/dbo-problems-code.md +111 -0
- package/plugins/claude/dbo/docs/_audit_required/dbo-problems-performance.md +109 -0
- package/plugins/claude/dbo/docs/_audit_required/dbo-problems-syntax.md +97 -0
- package/plugins/claude/dbo/docs/_audit_required/dbo-product-market.md +119 -0
- package/plugins/claude/dbo/docs/_audit_required/dbo-white-paper.md +125 -0
- package/plugins/claude/dbo/docs/dbo-cheat-sheet.md +323 -0
- package/plugins/claude/dbo/docs/dbo-cli-readme.md +2222 -0
- package/plugins/claude/dbo/docs/dbo-core-entities.md +878 -0
- package/plugins/claude/dbo/docs/dbo-output-customsql.md +677 -0
- package/plugins/claude/dbo/docs/dbo-output-query.md +967 -0
- package/plugins/claude/dbo/skills/cli/SKILL.md +62 -246
- package/src/commands/add.js +366 -62
- package/src/commands/build.js +102 -0
- package/src/commands/clone.js +602 -139
- package/src/commands/diff.js +4 -0
- package/src/commands/init.js +16 -2
- package/src/commands/input.js +3 -1
- package/src/commands/mv.js +12 -4
- package/src/commands/push.js +265 -70
- package/src/commands/rm.js +16 -3
- package/src/commands/run.js +81 -0
- package/src/lib/client.js +4 -7
- package/src/lib/config.js +39 -0
- package/src/lib/delta.js +7 -1
- package/src/lib/diff.js +24 -2
- package/src/lib/filenames.js +120 -41
- package/src/lib/ignore.js +6 -0
- package/src/lib/input-parser.js +13 -4
- package/src/lib/scripts.js +232 -0
- package/src/lib/toe-stepping.js +17 -2
- package/src/migrations/006-remove-uid-companion-filenames.js +181 -0
|
@@ -0,0 +1,1487 @@
|
|
|
1
|
+
# dbo.io API Reference
|
|
2
|
+
------------
|
|
3
|
+
|
|
4
|
+
DBO.io is a database-driven application framework where all content, configuration, and assets are stored in a relational database and accessed via REST API endpoints. This document provides a comprehensive reference for interacting with the DBO.io API.
|
|
5
|
+
|
|
6
|
+
## Token Architecture
|
|
7
|
+
|
|
8
|
+
**System Template Tokens**: DBO uses `<#_` prefix for built-in template tokens in the re-architected system.
|
|
9
|
+
|
|
10
|
+
- ✅ **Preferred (system tokens)**: `<#_embed>`, `<#_header>`, `<#_footer>`, `<#_row>`, `<#_empty>`, `<#_cell>`, `<#_prompt>`, `<#_shared>`, `<#_noresult>`, `<#_rowdelimiter>`, `<#_celldelimiter>`, `<#_value>`
|
|
11
|
+
- ⚠️ **Alternative (still supported)**: `<#embed>`, `<#header>`, `<#footer>`, `<#row>`, `<#cell>`, `<#shared>`, `<#empty>`, `<#summary>`, etc.
|
|
12
|
+
- ❌ **Legacy**: `<EmbedToken>` (demoted, but still works)
|
|
13
|
+
|
|
14
|
+
**Complete list of standard output template tags**: `html`, `prompt`, `shared`, `header`, `row`, `cell`, `summary`, `footer`, `noresult`, `empty`, `rowdelimiter`, `celldelimiter`, `value`
|
|
15
|
+
|
|
16
|
+
**User-Defined Tokens**: Custom tokens do NOT use the underscore prefix.
|
|
17
|
+
|
|
18
|
+
- ✅ **User-defined**: `<#reference>`, `<#myCustomToken>`, `<#anything>`
|
|
19
|
+
- These use `<#name>` syntax (without underscore)
|
|
20
|
+
|
|
21
|
+
**Best Practice**:
|
|
22
|
+
- Use `<#_` prefix for DBO system tokens (embed, header, footer, row, cell, etc.)
|
|
23
|
+
- Use `<#` prefix (no underscore) for your custom user-defined tokens
|
|
24
|
+
- Both `#` and `#_` prefixes are supported by output, input, and email template parsers
|
|
25
|
+
- Message templates only support the `#_` prefix
|
|
26
|
+
- Legacy syntax continues to work for backward compatibility
|
|
27
|
+
|
|
28
|
+
## Core Concepts
|
|
29
|
+
|
|
30
|
+
### Identifiers
|
|
31
|
+
|
|
32
|
+
Every record in DBO has two types of identifiers:
|
|
33
|
+
|
|
34
|
+
- **RowID** - Numeric database primary key (e.g., `10296`)
|
|
35
|
+
- Sequential integer assigned by the database
|
|
36
|
+
- May change across environment migrations
|
|
37
|
+
- Used interchangeably with RowUID in API calls
|
|
38
|
+
|
|
39
|
+
- **RowUID** - Universal unique identifier (e.g., `albain3dwkofbhnd1qtd1q`)
|
|
40
|
+
- Alphanumeric string (22 characters)
|
|
41
|
+
- **Stable across environments** - does not change during migrations
|
|
42
|
+
- Preferred for deployment scripts and cross-environment references
|
|
43
|
+
|
|
44
|
+
**Important**: `RowID:` and `RowUID:` syntax are **freely interchangeable** in API calls. Use `RowUID:` with alphanumeric UIDs for stable cross-environment deployments.
|
|
45
|
+
|
|
46
|
+
### Entity-Column Structure
|
|
47
|
+
|
|
48
|
+
All data operations use the `entity.ColumnName` format:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
column:entity.ColumnName
|
|
52
|
+
↑ ↑
|
|
53
|
+
| └─ Physical column name in the database table
|
|
54
|
+
└─ Entity (table) name
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Common Entities:**
|
|
58
|
+
- `content` - Text/code content (CSS, JS, HTML, JSON)
|
|
59
|
+
- `media` - File references and binary data
|
|
60
|
+
- `extension` - Extension/module code and documentation
|
|
61
|
+
- `user` - User accounts and authentication
|
|
62
|
+
- `app` - Application definitions
|
|
63
|
+
- `site` - Site/domain configuration
|
|
64
|
+
- `output` - Query definitions and data views
|
|
65
|
+
- `entity_column` - Database schema definitions
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Authentication
|
|
70
|
+
_______________________________________________________
|
|
71
|
+
|
|
72
|
+
### URL
|
|
73
|
+
`/api/authenticate`
|
|
74
|
+
|
|
75
|
+
Authentication URL for obtaining a session. Authentication parameters can also be submitted with any request - this URL is optional but provides a direct response from the server.
|
|
76
|
+
|
|
77
|
+
### Identity Parameters
|
|
78
|
+
|
|
79
|
+
Users can authenticate using username, email, or phone number as their identity.
|
|
80
|
+
|
|
81
|
+
- #### `_username` or `_un` [string]
|
|
82
|
+
- Username from `user.Username` column
|
|
83
|
+
- Can be passed at URL level
|
|
84
|
+
- Example: `?_username=john` or `?_un=john`
|
|
85
|
+
|
|
86
|
+
- #### `_email` or `_em` [string]
|
|
87
|
+
- Email from `user.Email` column
|
|
88
|
+
- Alternative identity method to username
|
|
89
|
+
- Example: `?_email=john@example.com` or `?_em=john@example.com`
|
|
90
|
+
|
|
91
|
+
- #### `_phonenumber` or `_pn` [string]
|
|
92
|
+
- Phone number from `user.PhoneNumber` column
|
|
93
|
+
- Alternative identity method to username/email
|
|
94
|
+
- Example: `?_phonenumber=+15551234567` or `?_pn=+15551234567`
|
|
95
|
+
|
|
96
|
+
### Credential Parameters
|
|
97
|
+
|
|
98
|
+
- #### `_password` or `_pw` [string]
|
|
99
|
+
- Password from `user.Password` column
|
|
100
|
+
- Can be passed at URL level
|
|
101
|
+
- Example: `?_password=mySecurePassword` or `?_pw=mySecurePassword`
|
|
102
|
+
|
|
103
|
+
- #### `_passkey` or `_pk` [string]
|
|
104
|
+
- Alternative authentication using `user.PassKey`
|
|
105
|
+
- Username/email/phone and PassKey can be used together for sign in
|
|
106
|
+
- PassKey value automatically updates after each use
|
|
107
|
+
- More secure than password for API access
|
|
108
|
+
|
|
109
|
+
### Session Parameters
|
|
110
|
+
|
|
111
|
+
- #### `_logout` or `_lo` [boolean]
|
|
112
|
+
- Set to `true` to log out through URL bar
|
|
113
|
+
- Logout is processed first when combined with other parameters
|
|
114
|
+
- Example: `?_logout=true` or `?_lo=true`
|
|
115
|
+
|
|
116
|
+
- #### `_security_log` [boolean]
|
|
117
|
+
- Enable security logging for debugging
|
|
118
|
+
- Used with development tools like Glimpse
|
|
119
|
+
|
|
120
|
+
### SSO (Single Sign-On)
|
|
121
|
+
|
|
122
|
+
DBO.io supports SSO via HTTP Headers. When configured:
|
|
123
|
+
- The `SSO_IntegrationMethod` app setting is set to `HTTPHeaders`
|
|
124
|
+
- `SSO_AuthenticationPathRegex` defines which request paths trigger SSO
|
|
125
|
+
- `SSO_UsernameField` and `SSO_EmailField` specify which HTTP headers contain the identity
|
|
126
|
+
- If the user does not exist in the system, they are auto-created on first SSO login
|
|
127
|
+
|
|
128
|
+
### Impersonation
|
|
129
|
+
|
|
130
|
+
- #### `_as` [integer]
|
|
131
|
+
- Impersonate another user by `user.UserID`
|
|
132
|
+
- Requires corresponding access record in security table
|
|
133
|
+
- Example: `?_as=12345`
|
|
134
|
+
|
|
135
|
+
- #### `_as_cookie` [boolean]
|
|
136
|
+
- Used with impersonation to retain UserID in cookies
|
|
137
|
+
- Preserves impersonation across subsequent requests
|
|
138
|
+
- Example: `?_as=12345&_as_cookie=true`
|
|
139
|
+
|
|
140
|
+
### Sample Code (cURL)
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Authenticate and save session cookie
|
|
144
|
+
curl --cookie-jar .cookies \
|
|
145
|
+
--data-urlencode "_username=user@example.com" \
|
|
146
|
+
--data-urlencode "_password=myPassword" \
|
|
147
|
+
https://example.dbo.io/api/authenticate
|
|
148
|
+
|
|
149
|
+
# Use session cookie for subsequent requests
|
|
150
|
+
curl -b .cookies https://example.dbo.io/api/content/myContentUID
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Input API (CRUD Operations)
|
|
156
|
+
_______________________________________________________
|
|
157
|
+
|
|
158
|
+
### URL
|
|
159
|
+
`/api/input/submit`
|
|
160
|
+
|
|
161
|
+
Main endpoint for creating, updating, and deleting records.
|
|
162
|
+
|
|
163
|
+
### Request Format
|
|
164
|
+
|
|
165
|
+
All input operations follow this pattern:
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
[RowUID|RowID]:identifier;column:entity.ColumnName[@file|=value]
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Components:**
|
|
172
|
+
- `RowUID:` or `RowID:` - Record identifier type (interchangeable)
|
|
173
|
+
- `identifier` - Alphanumeric UID or numeric ID
|
|
174
|
+
- `;` - Separator between identifier and column specification
|
|
175
|
+
- `column:entity.ColumnName` - Target column in entity table
|
|
176
|
+
- `@file` - Use file contents as value (for deploying code/content)
|
|
177
|
+
- `=value` - Direct value assignment (for metadata/simple values)
|
|
178
|
+
|
|
179
|
+
### Add (Create New Record)
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
RowID:addkey;column:entity.Column=value
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Sample Code:**
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Add new user
|
|
189
|
+
curl -K config.curl \
|
|
190
|
+
--data-urlencode "RowID:add1;column:user.FirstName=John" \
|
|
191
|
+
--data-urlencode "RowID:add1;column:user.LastName=Doe" \
|
|
192
|
+
--data-urlencode "RowID:add1;column:user.Email=john@example.com" \
|
|
193
|
+
--data-urlencode "_confirm=true" \
|
|
194
|
+
https://example.dbo.io/api/input/submit
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
- #### `addkey` [string]
|
|
198
|
+
- Unique key for this add operation
|
|
199
|
+
- Multiple columns can share the same addkey to create a single record
|
|
200
|
+
- Example: `RowID:add1`, `RowID:add2`, `RowID:addUser123`
|
|
201
|
+
|
|
202
|
+
### Edit (Update Existing Record)
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
RowID:identifier;column:entity.Column=value
|
|
206
|
+
RowUID:uid;column:entity.Column=value
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Sample Code:**
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# Update user by numeric ID
|
|
213
|
+
curl -K config.curl \
|
|
214
|
+
--data-urlencode "RowID:10065;column:user.FirstName=Jane" \
|
|
215
|
+
--data-urlencode "_confirm=true" \
|
|
216
|
+
https://example.dbo.io/api/input/submit
|
|
217
|
+
|
|
218
|
+
# Update content by UID (from file)
|
|
219
|
+
curl -K config.curl \
|
|
220
|
+
--data-urlencode "RowUID:albain3dwkofbhnd1qtd1q;column:content.Content@assets/css/colors.css" \
|
|
221
|
+
--data-urlencode "_confirm=true" \
|
|
222
|
+
https://example.dbo.io/api/input/submit
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
- #### File Upload Syntax `@filepath`
|
|
226
|
+
- Prefix with `@` to upload file contents as column value
|
|
227
|
+
- Used for text content (CSS, JS, HTML, markdown)
|
|
228
|
+
- File path is relative to curl execution directory
|
|
229
|
+
- Example: `column:content.Content@local/file.css`
|
|
230
|
+
|
|
231
|
+
- #### Direct Value Syntax `=value`
|
|
232
|
+
- Use `=` for direct value assignment
|
|
233
|
+
- Used for simple strings, numbers, metadata
|
|
234
|
+
- Example: `column:user.FirstName=Jane`
|
|
235
|
+
|
|
236
|
+
### Delete (Remove Record)
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
RowID:delidentifier;entity:entity=true
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Sample Code:**
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Delete user by ID
|
|
246
|
+
curl -K config.curl \
|
|
247
|
+
--data-urlencode "RowID:del10062;entity:user=true" \
|
|
248
|
+
--data-urlencode "_confirm=true" \
|
|
249
|
+
https://example.dbo.io/api/input/submit
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
- #### `delidentifier` [string]
|
|
253
|
+
- Prefix identifier with `del` to indicate deletion
|
|
254
|
+
- Example: `RowID:del123`, `RowUID:delmyUIDstring`
|
|
255
|
+
|
|
256
|
+
- #### `entity:entity=true` [boolean]
|
|
257
|
+
- Specifies which entity the record belongs to
|
|
258
|
+
- Must be set to `true` for deletion to execute
|
|
259
|
+
- Example: `entity:user=true`
|
|
260
|
+
|
|
261
|
+
### Global Parameters
|
|
262
|
+
|
|
263
|
+
- #### `_confirm` [boolean]
|
|
264
|
+
- Default is `false` (validation only)
|
|
265
|
+
- Set to `true` for changes to persist in database
|
|
266
|
+
- Without `_confirm=true`, DBO only validates the request
|
|
267
|
+
- Example: `_confirm=true`
|
|
268
|
+
|
|
269
|
+
- #### `_transactional` [boolean]
|
|
270
|
+
- Controls transaction behavior
|
|
271
|
+
- Default behavior varies by operation
|
|
272
|
+
- Set to `false` to disable transactional processing
|
|
273
|
+
|
|
274
|
+
- #### `_input_field_delimiter` [string]
|
|
275
|
+
- Allows adaptation for different languages/environments
|
|
276
|
+
- Changes the field delimiter from default
|
|
277
|
+
- Used for database compatibility across regions
|
|
278
|
+
|
|
279
|
+
- #### `_input_descriptor_delimiter` [string]
|
|
280
|
+
- Allows adaptation for different languages/environments
|
|
281
|
+
- Changes the descriptor delimiter from default
|
|
282
|
+
- Used for database compatibility across regions
|
|
283
|
+
|
|
284
|
+
- #### `_login` [boolean]
|
|
285
|
+
- Auto-login a user that is created through input submission
|
|
286
|
+
- Only triggers when exactly one user entity is being added in the submission
|
|
287
|
+
- Example: `_login=true`
|
|
288
|
+
|
|
289
|
+
- #### `_pk_override` [boolean]
|
|
290
|
+
- Allow explicit primary key values on insert operations
|
|
291
|
+
- Bypasses auto-increment behavior
|
|
292
|
+
- Example: `_pk_override=1`
|
|
293
|
+
|
|
294
|
+
### Sample Code (Operator Deployment)
|
|
295
|
+
|
|
296
|
+
```javascript
|
|
297
|
+
// From package.json - Deploy CSS
|
|
298
|
+
"css:colors": "npm run minify:colors.css && curl -K config-data.curl --data-urlencode RowUID:albain3dwkofbhnd1qtd1q;column:content.Content@assets/css/colors.css"
|
|
299
|
+
|
|
300
|
+
// From package.json - Deploy JavaScript
|
|
301
|
+
"js:app": "npm run minify:app.js && curl -K config-data.curl --data-urlencode RowUID:rncjivlghu65bmkbjnxynq;column:content.Content@assets/js/app.js"
|
|
302
|
+
|
|
303
|
+
// From package.json - Deploy Documentation
|
|
304
|
+
"doc:colors": "curl -K config-data.curl --data-urlencode RowUID:l2uv2gu8gu6ziyluuncv0w;column:extension.Text@docs/colors.md"
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Output API (Query Data)
|
|
310
|
+
_______________________________________________________
|
|
311
|
+
|
|
312
|
+
DBO provides three types of output methods for querying data:
|
|
313
|
+
|
|
314
|
+
1. **Custom Output** - Complex queries with custom SQL and filtering
|
|
315
|
+
2. **Simple Output (Output by Entity)** - Direct entity queries
|
|
316
|
+
3. **SQL Output** - Outputs with CustomSQL
|
|
317
|
+
|
|
318
|
+
### Custom Output
|
|
319
|
+
|
|
320
|
+
#### URL
|
|
321
|
+
```
|
|
322
|
+
/api/output/{output.UID}
|
|
323
|
+
/api/o/{output.UID} (short form)
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Access predefined output queries by their UID.
|
|
327
|
+
|
|
328
|
+
#### Target Reference
|
|
329
|
+
- `output.UID` - The UID of the output definition
|
|
330
|
+
|
|
331
|
+
#### Column References
|
|
332
|
+
- `output_value.UID` - Column identifier by UID
|
|
333
|
+
- `output_value.Shortname` - Column identifier by shortname
|
|
334
|
+
|
|
335
|
+
#### Sample Code
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
# Fetch custom output as HTML
|
|
339
|
+
curl -b .cookies \
|
|
340
|
+
"https://example.dbo.io/api/output/qfkyyp2vxeaggdeo7dwbig?_format=html"
|
|
341
|
+
|
|
342
|
+
# Fetch with filter
|
|
343
|
+
curl -b .cookies \
|
|
344
|
+
"https://example.dbo.io/api/output/myOutputUID?_filter@FirstName=John&_format=json"
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Simple Output (Output by Entity)
|
|
348
|
+
|
|
349
|
+
#### URL
|
|
350
|
+
```
|
|
351
|
+
/api/output/entity/{entity.UID}
|
|
352
|
+
/api/output/entity/{entity.UID}/{RowID}
|
|
353
|
+
/api/o/e/{entity.UID} (short form)
|
|
354
|
+
/api/o/e/{entity.UID}/{RowID} (short form)
|
|
355
|
+
/api/output/e/{entity.UID} (medium form)
|
|
356
|
+
/api/o/entity/{entity.UID} (medium form)
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
Query data directly from an entity without a predefined output.
|
|
360
|
+
|
|
361
|
+
#### Sample Code
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
# Get all users as HTML
|
|
365
|
+
curl -b .cookies \
|
|
366
|
+
"https://example.dbo.io/api/output/entity/user?_format=html"
|
|
367
|
+
|
|
368
|
+
# Get specific user record
|
|
369
|
+
curl -b .cookies \
|
|
370
|
+
"https://example.dbo.io/api/output/entity/user/10296?_format=json"
|
|
371
|
+
|
|
372
|
+
# Filter users by first name
|
|
373
|
+
curl -b .cookies \
|
|
374
|
+
"https://example.dbo.io/api/output/entity/user?_filter@FirstName=John&_format=json"
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Embed Tokens
|
|
378
|
+
|
|
379
|
+
Outputs can be embedded in content using special tokens:
|
|
380
|
+
|
|
381
|
+
```html
|
|
382
|
+
<!-- Preferred syntax (new architecture) -->
|
|
383
|
+
<#_embed url="/api/output/target" hide="true" preload="true" >
|
|
384
|
+
|
|
385
|
+
<!-- Alternative syntax (still supported) -->
|
|
386
|
+
<#embed url="/api/output/target" hide="true" preload="true" >
|
|
387
|
+
|
|
388
|
+
<!-- Legacy syntax (demoted, but still works) -->
|
|
389
|
+
<EmbedToken url="/api/output/myOutputUID" hide="true" preload="true" column="reference"/>
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
**Note**: The `<#_` prefix is the preferred architecture. While `<#embed` and `<EmbedToken>` continue to work for legacy support, new implementations should use `<#_embed>`.
|
|
393
|
+
|
|
394
|
+
- #### `hide` [boolean]
|
|
395
|
+
- When `true`, output is hidden but data is still available for token references
|
|
396
|
+
- Allows using embedded data without displaying the table
|
|
397
|
+
- Default is `false`
|
|
398
|
+
|
|
399
|
+
- #### `preload` [boolean]
|
|
400
|
+
- When `true`, loads data before master template tokens are processed
|
|
401
|
+
- Allows using embedded data in master template
|
|
402
|
+
- Default is `false`
|
|
403
|
+
|
|
404
|
+
- #### `column` [string]
|
|
405
|
+
- Comma-separated list of columns to display
|
|
406
|
+
- Limits output to specified columns only
|
|
407
|
+
- Example: `column="FirstName,LastName,Email"`
|
|
408
|
+
|
|
409
|
+
- #### `payload` [boolean]
|
|
410
|
+
- When `true`, embed result is included in the API response payload
|
|
411
|
+
- Example: `payload="true"`
|
|
412
|
+
|
|
413
|
+
- #### `secure` [boolean]
|
|
414
|
+
- When `true`, security checks are applied to the embedded output
|
|
415
|
+
- Example: `secure="true"`
|
|
416
|
+
|
|
417
|
+
- #### `execute` [boolean]
|
|
418
|
+
- Controls whether the embed is executed
|
|
419
|
+
- Set to `false` to skip execution
|
|
420
|
+
- Example: `execute="false"`
|
|
421
|
+
|
|
422
|
+
### Meta Output
|
|
423
|
+
|
|
424
|
+
#### URL
|
|
425
|
+
```
|
|
426
|
+
/api/output/meta/entity/{entity.UID}
|
|
427
|
+
/api/output/meta/column/{entityColumn.UID}
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
Retrieve metadata about entities and columns.
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
# Get entity metadata
|
|
434
|
+
curl -b .cookies \
|
|
435
|
+
"https://example.dbo.io/api/output/meta/entity/userEntityUID"
|
|
436
|
+
|
|
437
|
+
# Get column metadata
|
|
438
|
+
curl -b .cookies \
|
|
439
|
+
"https://example.dbo.io/api/output/meta/column/firstNameColumnUID"
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
## Data Tokens
|
|
445
|
+
_______________________________________________________
|
|
446
|
+
|
|
447
|
+
DBO uses a token system in templates for dynamic content. Tokens follow this format:
|
|
448
|
+
|
|
449
|
+
```
|
|
450
|
+
#{tokenType$target@reference:modifiers!default;comment}
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Value Tokens
|
|
454
|
+
|
|
455
|
+
- #### `#{value@reference}` [token]
|
|
456
|
+
- Get value from a column
|
|
457
|
+
- Reference can be column UID, shortname, or physical name
|
|
458
|
+
- Example: `#{value@FirstName}`, `#{value@user.Email}`
|
|
459
|
+
|
|
460
|
+
### ID/UID Tokens
|
|
461
|
+
|
|
462
|
+
- #### `#{id@table}` [token]
|
|
463
|
+
- Primary key ID token for row
|
|
464
|
+
- If output contains multiple tables, multiple IDs returned
|
|
465
|
+
- Reference not required if only one ID column present
|
|
466
|
+
- Example: `#{id}`, `#{id@user}`
|
|
467
|
+
|
|
468
|
+
- #### `#{uid@table}` [token]
|
|
469
|
+
- UID token for row
|
|
470
|
+
- Based on entity_column.PhysicalName of UID
|
|
471
|
+
- Example: `#{uid}`, `#{uid@content}`
|
|
472
|
+
|
|
473
|
+
- #### `#{title@reference}` [token]
|
|
474
|
+
- Title/label token for columns
|
|
475
|
+
- Returns the display title of a column
|
|
476
|
+
- Example: `#{title@FirstName}` returns "First Name"
|
|
477
|
+
|
|
478
|
+
- #### `#{entity@reference}` [token]
|
|
479
|
+
- Entity UID token for referenced table columns
|
|
480
|
+
- Example: `#{entity@user}`
|
|
481
|
+
|
|
482
|
+
- #### `#{column@reference}` [token]
|
|
483
|
+
- Column UID token for referenced table columns
|
|
484
|
+
- Example: `#{column@FirstName}`
|
|
485
|
+
|
|
486
|
+
### Row Count Tokens
|
|
487
|
+
|
|
488
|
+
- #### `#{RowCount}` [token]
|
|
489
|
+
- Total number of rows in query
|
|
490
|
+
- Ignores paging, maxrows, and rows parameters
|
|
491
|
+
- Example: `#{RowCount}` returns `150`
|
|
492
|
+
|
|
493
|
+
- #### `#{RowNumber}` [token]
|
|
494
|
+
- Row number in output
|
|
495
|
+
- Can only be used at template level
|
|
496
|
+
- Sequential numbering of rows
|
|
497
|
+
- Example: `#{RowNumber}` returns `1`, `2`, `3`...
|
|
498
|
+
|
|
499
|
+
- #### `#{ReturnedRowCount}` [token]
|
|
500
|
+
- Total rows returned to client
|
|
501
|
+
- Considers paging, maxrows, and rows parameters
|
|
502
|
+
- Example: With pagination showing 10 per page, returns `10`
|
|
503
|
+
|
|
504
|
+
- #### `#{ReturnedRowNumber}` [token]
|
|
505
|
+
- Row number within returned set
|
|
506
|
+
- Similar to RowNumber but for paginated results
|
|
507
|
+
|
|
508
|
+
### Meta Tokens
|
|
509
|
+
|
|
510
|
+
- #### `#{output@column}` [token]
|
|
511
|
+
- Meta token for gathering information about an output
|
|
512
|
+
- Currently accepts UID and Name columns
|
|
513
|
+
- Example: `#{output@Name}` returns output name
|
|
514
|
+
|
|
515
|
+
### Request Tokens
|
|
516
|
+
|
|
517
|
+
- #### `#{request@key}` [token]
|
|
518
|
+
- Access request parameters
|
|
519
|
+
- Example: `#{request@EntityUID}`, `#{request@Domain}`
|
|
520
|
+
|
|
521
|
+
- #### `#{CurrentUser@reference}` [token]
|
|
522
|
+
- Current user information
|
|
523
|
+
- Affected by impersonation (`_as` parameter)
|
|
524
|
+
- Example: `#{CurrentUser@UserID}`, `#{CurrentUser@FirstName}`
|
|
525
|
+
|
|
526
|
+
- #### `#{LoggedInUser@reference}` [token]
|
|
527
|
+
- Original logged-in user information
|
|
528
|
+
- Not affected by impersonation
|
|
529
|
+
- Example: `#{LoggedInUser@UserID}`
|
|
530
|
+
|
|
531
|
+
- #### `#{site@reference}` [token]
|
|
532
|
+
- Current site information
|
|
533
|
+
- Example: `#{site@SiteID}`, `#{site@Domain}`
|
|
534
|
+
|
|
535
|
+
- #### `#{request_meta@reference}` [token]
|
|
536
|
+
- Request metadata
|
|
537
|
+
- Available references: Domain, Protocol, Referrer, Port, Method, UserAgent
|
|
538
|
+
- Example: `#{request_meta@Domain}`, `#{request_meta@Protocol}`
|
|
539
|
+
|
|
540
|
+
### Session Tokens
|
|
541
|
+
|
|
542
|
+
- #### `#{session@variable}` [token]
|
|
543
|
+
- Access session-stored values
|
|
544
|
+
- Example: `#{session@userid}`, `#{session@uid}`
|
|
545
|
+
|
|
546
|
+
### Data Source & Connection Tokens (v.9.47+)
|
|
547
|
+
|
|
548
|
+
- #### `#{data_source@physicalname}` [token]
|
|
549
|
+
- Physical name of the current data source
|
|
550
|
+
- Example: `#{data_source@physicalname}`
|
|
551
|
+
|
|
552
|
+
- #### `#{instance_connectionstring@reference}` [token]
|
|
553
|
+
- Instance connection string components
|
|
554
|
+
- Available references: `server`, `port`
|
|
555
|
+
- Example: `#{instance_connectionstring@server}`
|
|
556
|
+
|
|
557
|
+
- #### `#{control_connectionstring@reference}` [token]
|
|
558
|
+
- Control connection string components
|
|
559
|
+
- Available references: `server`, `port`
|
|
560
|
+
- Example: `#{control_connectionstring@server}`
|
|
561
|
+
|
|
562
|
+
### Token Modifiers
|
|
563
|
+
|
|
564
|
+
Modifiers change how token values are processed:
|
|
565
|
+
|
|
566
|
+
- #### `:cached` [modifier]
|
|
567
|
+
- Uses cached value
|
|
568
|
+
- Example: `#{value@RequestPathSecondary:cached}`
|
|
569
|
+
|
|
570
|
+
- #### `:raw` [modifier]
|
|
571
|
+
- Returns unprocessed value
|
|
572
|
+
- Example: `#{value@Description:raw}`
|
|
573
|
+
|
|
574
|
+
- #### `:decrypt` [modifier]
|
|
575
|
+
- Decrypts encrypted value
|
|
576
|
+
- Example: `#{value@Password:decrypt}`
|
|
577
|
+
|
|
578
|
+
- #### `:email_decrypt` [modifier]
|
|
579
|
+
- Decrypts email-encrypted value
|
|
580
|
+
- Example: `#{value@Email:email_decrypt}`
|
|
581
|
+
|
|
582
|
+
- #### `:truncate` [modifier]
|
|
583
|
+
- Truncates long text
|
|
584
|
+
- Example: `#{value@Description:truncate}`
|
|
585
|
+
|
|
586
|
+
- #### `:escape_json` [modifier] (v.9.49+)
|
|
587
|
+
- Escapes value for safe inclusion in JSON strings
|
|
588
|
+
- Example: `#{value@Description:escape_json}`
|
|
589
|
+
|
|
590
|
+
- #### `:format` [modifier]
|
|
591
|
+
- Apply format string to value (e.g., datetime formats)
|
|
592
|
+
- Example: `#{value@_CreatedOn:c1}` (custom datetime format)
|
|
593
|
+
|
|
594
|
+
- #### `:escape_html` [modifier]
|
|
595
|
+
- Escapes HTML characters for safe display
|
|
596
|
+
- Example: `#{value@UserInput:escape_html}`
|
|
597
|
+
|
|
598
|
+
### Token Processing Order
|
|
599
|
+
|
|
600
|
+
Tokens are processed in this order (important for nested tokens):
|
|
601
|
+
|
|
602
|
+
1. User Tokens
|
|
603
|
+
2. Request Tokens (at embeds first)
|
|
604
|
+
3. Request Meta Tokens
|
|
605
|
+
4. Site Tokens
|
|
606
|
+
5. Cached Value Tokens (at embeds first)
|
|
607
|
+
6. Display Tokens
|
|
608
|
+
|
|
609
|
+
**Example:**
|
|
610
|
+
```
|
|
611
|
+
This works:
|
|
612
|
+
#{value@RequestPathSecondary:cached!#{request@EntityUID!}}
|
|
613
|
+
|
|
614
|
+
This doesn't:
|
|
615
|
+
#{request@EntityUID!#{value@RequestPathPrimary:cached}}
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
---
|
|
619
|
+
|
|
620
|
+
## URL Parameters & Modifiers
|
|
621
|
+
_______________________________________________________
|
|
622
|
+
|
|
623
|
+
### Filter Parameters
|
|
624
|
+
|
|
625
|
+
- #### `_filter` [parameter]
|
|
626
|
+
- Filter output results
|
|
627
|
+
- Syntax: `_filter$target@reference:modifiers=value`
|
|
628
|
+
- Multiple filters can be combined with `&`
|
|
629
|
+
- Example: `?_filter@FirstName=John&_filter@LastName=Doe`
|
|
630
|
+
|
|
631
|
+
#### Filter Modifiers
|
|
632
|
+
|
|
633
|
+
**Logic Operators:**
|
|
634
|
+
- `and` - All conditions must match
|
|
635
|
+
- `or` - Any condition can match (default)
|
|
636
|
+
|
|
637
|
+
**Inclusion:**
|
|
638
|
+
- `include` - Include matching records (default)
|
|
639
|
+
- `exclude` - Exclude matching records
|
|
640
|
+
|
|
641
|
+
**Matching:**
|
|
642
|
+
- `exact` - Exact match (default)
|
|
643
|
+
- `contains` - Contains substring
|
|
644
|
+
- `startswith` - Starts with value
|
|
645
|
+
- `endswith` - Ends with value
|
|
646
|
+
|
|
647
|
+
**Comparison:**
|
|
648
|
+
- `GreaterThan` - Value greater than filter
|
|
649
|
+
- `GreaterThanOrEqualTo` - Value >= filter
|
|
650
|
+
- `LessThan` - Value less than filter
|
|
651
|
+
- `LessThanOrEqualTo` - Value <= filter
|
|
652
|
+
|
|
653
|
+
**Shorthand Syntax:**
|
|
654
|
+
- `*=` - Contains (e.g., `_filter@FirstName*=ohn`)
|
|
655
|
+
- `^=` - Starts with (e.g., `_filter@FirstName^=Jo`)
|
|
656
|
+
- `$=` - Ends with (e.g., `_filter@FirstName$=hn`)
|
|
657
|
+
- `!=` - NOT / negation (e.g., `_filter@FirstName!=John`)
|
|
658
|
+
|
|
659
|
+
**Special Values:**
|
|
660
|
+
- `Null` - Filter for null values
|
|
661
|
+
- `_any` - Ignore filter default value (treat as no filter)
|
|
662
|
+
- `CurrentUserID` - Use current user's ID
|
|
663
|
+
- `LoggedInUserID` - Use the logged-in user's ID (not affected by impersonation)
|
|
664
|
+
- `CurrentSiteID` - Use current site's ID
|
|
665
|
+
- `IpAddress` - Use the client's IP address
|
|
666
|
+
- `SessionUID` - Use the current session UID
|
|
667
|
+
- `RequestPath` - Use current request path
|
|
668
|
+
- `Now`, `Today`, `Yesterday` - Date-based filters
|
|
669
|
+
- `ThisWeek`, `LastWeek`, `ThisMonth`, `LastMonth` - Relative dates
|
|
670
|
+
- `ThisQuarter`, `LastQuarter`, `ThisYear`, `LastYear` - Relative dates
|
|
671
|
+
|
|
672
|
+
**Sample Code:**
|
|
673
|
+
|
|
674
|
+
```bash
|
|
675
|
+
# Filter users by first name containing "John"
|
|
676
|
+
curl "https://example.dbo.io/api/output/entity/user?_filter@FirstName:contains=John"
|
|
677
|
+
|
|
678
|
+
# Filter by multiple conditions (OR)
|
|
679
|
+
curl "https://example.dbo.io/api/output/entity/user?_filter@FirstName=John&_filter@FirstName=Jane"
|
|
680
|
+
|
|
681
|
+
# Filter with AND logic
|
|
682
|
+
curl "https://example.dbo.io/api/output/entity/user?_filter@FirstName:and=John&_filter@Active:and=true"
|
|
683
|
+
|
|
684
|
+
# Filter for current user's records
|
|
685
|
+
curl "https://example.dbo.io/api/output/entity/content?_filter@UserID=CurrentUserID"
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
### Format Parameters
|
|
689
|
+
|
|
690
|
+
- #### `_format` [parameter]
|
|
691
|
+
- Specify output format
|
|
692
|
+
- Syntax: `_format$target=format`
|
|
693
|
+
- URL level overrides all other format settings
|
|
694
|
+
- Example: `?_format=json`
|
|
695
|
+
|
|
696
|
+
#### Available Formats
|
|
697
|
+
|
|
698
|
+
- `html` - HTML output (default for browser requests)
|
|
699
|
+
- `json` - JSON output
|
|
700
|
+
- `json_raw` - Raw JSON output (no template rendering, returns data rows directly)
|
|
701
|
+
- `json_indented` - Indented/pretty-printed JSON output
|
|
702
|
+
- `xml` - XML output
|
|
703
|
+
- `csv` - CSV output
|
|
704
|
+
- `txt` - Plain text output
|
|
705
|
+
- `pdf` - PDF output (requires size modifier, e.g., `pdf,letter`)
|
|
706
|
+
|
|
707
|
+
**Sample Code:**
|
|
708
|
+
|
|
709
|
+
```bash
|
|
710
|
+
# Get users as JSON
|
|
711
|
+
curl "https://example.dbo.io/api/output/entity/user?_format=json"
|
|
712
|
+
|
|
713
|
+
# Get raw JSON data (no template)
|
|
714
|
+
curl "https://example.dbo.io/api/output/myOutputUID?_template=json_raw"
|
|
715
|
+
|
|
716
|
+
# Get as CSV
|
|
717
|
+
curl "https://example.dbo.io/api/output/entity/user?_format=csv"
|
|
718
|
+
|
|
719
|
+
# Get as PDF (letter size)
|
|
720
|
+
curl "https://example.dbo.io/api/output/entity/user?_format=pdf,letter"
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
- #### `_format_values` [boolean]
|
|
724
|
+
- Enable value formatting in `json_raw` output
|
|
725
|
+
- When `true`, values are formatted according to their column format settings
|
|
726
|
+
- Example: `?_format_values=true`
|
|
727
|
+
|
|
728
|
+
- #### `_escape_html` [boolean]
|
|
729
|
+
- Control HTML escaping of data values
|
|
730
|
+
- Set to `false` to disable HTML escaping
|
|
731
|
+
- Example: `?_escape_html=false`
|
|
732
|
+
|
|
733
|
+
- #### `_mime` [string]
|
|
734
|
+
- Override the MIME/content type of the response
|
|
735
|
+
- Example: `?_mime=application/json`
|
|
736
|
+
|
|
737
|
+
### Template Parameters
|
|
738
|
+
|
|
739
|
+
- #### `_template` [parameter]
|
|
740
|
+
- Assign custom template to output
|
|
741
|
+
- Syntax: `_template$target=value`
|
|
742
|
+
- URL level (targeted) overrides all other template settings
|
|
743
|
+
- Example: `?_template=myCustomTemplate`
|
|
744
|
+
|
|
745
|
+
#### Template Structure
|
|
746
|
+
|
|
747
|
+
```html
|
|
748
|
+
<#html>
|
|
749
|
+
<#UserDefined></#UserDefined>
|
|
750
|
+
<#header></#header>
|
|
751
|
+
<#shared></#shared>
|
|
752
|
+
<#row></#row>
|
|
753
|
+
<#footer></#footer>
|
|
754
|
+
<#empty></#empty>
|
|
755
|
+
</#html>
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
**Preferred template architecture** uses `<#_` prefix:
|
|
759
|
+
|
|
760
|
+
```html
|
|
761
|
+
<#_html>
|
|
762
|
+
<#_prompt></#_prompt>
|
|
763
|
+
<#_header>
|
|
764
|
+
<#_cell>#{title@FirstName}</#_cell>
|
|
765
|
+
<#_cell>#{title@LastName}</#_cell>
|
|
766
|
+
</#_header>
|
|
767
|
+
<#_shared></#_shared>
|
|
768
|
+
<#_row>
|
|
769
|
+
<#_cell>#{value@FirstName}</#_cell>
|
|
770
|
+
<#_cell>#{value@LastName}</#_cell>
|
|
771
|
+
</#_row>
|
|
772
|
+
<#_rowdelimiter><br/></#_rowdelimiter>
|
|
773
|
+
<#_footer></#_footer>
|
|
774
|
+
<#_empty></#_empty>
|
|
775
|
+
<#_noresult></#_noresult>
|
|
776
|
+
<#UserDefined></#UserDefined>
|
|
777
|
+
</#_html>
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
- #### `<#_header>` or `<#header>` [template section]
|
|
781
|
+
- Rendered once at the beginning of output
|
|
782
|
+
- Use for table headers, titles, etc.
|
|
783
|
+
|
|
784
|
+
- #### `<#_row>` or `<#row>` [template section]
|
|
785
|
+
- Rendered for each record in output
|
|
786
|
+
- Use data tokens here: `#{value@FirstName}`
|
|
787
|
+
|
|
788
|
+
- #### `<#_row.reference>` [template section] (v.9.47+)
|
|
789
|
+
- Row template with a reference qualifier for conditional rendering
|
|
790
|
+
- Example: `<#_row.active>` renders only for rows matching the reference
|
|
791
|
+
|
|
792
|
+
- #### `<#_cell>` or `<#cell>` [template section]
|
|
793
|
+
- Cell-level rendering within rows and headers
|
|
794
|
+
- Use for per-column formatting
|
|
795
|
+
|
|
796
|
+
- #### `<#_footer>` or `<#footer>` [template section]
|
|
797
|
+
- Rendered once after all rows
|
|
798
|
+
- Use for totals, summaries, etc.
|
|
799
|
+
- **Note**: `<#summary>` is demoted but still works (use `<#_footer>` instead)
|
|
800
|
+
|
|
801
|
+
- #### `<#_empty>` or `<#empty>` [template section]
|
|
802
|
+
- Rendered when no records found
|
|
803
|
+
- Use for "No results" messages
|
|
804
|
+
|
|
805
|
+
- #### `<#_noresult>` or `<#noresult>` [template section]
|
|
806
|
+
- Rendered when query returns no results
|
|
807
|
+
- Similar to empty but specifically for query result sets
|
|
808
|
+
|
|
809
|
+
- #### `<#_prompt>` or `<#prompt>` [template section]
|
|
810
|
+
- Prompt/input section rendered before the output data
|
|
811
|
+
|
|
812
|
+
- #### `<#_shared>` or `<#shared>` [template section]
|
|
813
|
+
- Shared content accessible across sections
|
|
814
|
+
- Values are shared if they have the same value for all rows
|
|
815
|
+
|
|
816
|
+
- #### `<#_rowdelimiter>` or `<#rowdelimiter>` [template section]
|
|
817
|
+
- Content rendered between rows as a delimiter/separator
|
|
818
|
+
|
|
819
|
+
- #### `<#_celldelimiter>` or `<#celldelimiter>` [template section]
|
|
820
|
+
- Content rendered between cells as a delimiter/separator
|
|
821
|
+
|
|
822
|
+
- #### `<#_value>` or `<#value>` [template section] (v.9.47+)
|
|
823
|
+
- Value template tag for output rendering
|
|
824
|
+
- Supports column targeting: `<#_value.column_name>`
|
|
825
|
+
|
|
826
|
+
### User-Defined Template Tokens
|
|
827
|
+
|
|
828
|
+
```html
|
|
829
|
+
<!-- User-defined tokens do NOT use underscore prefix -->
|
|
830
|
+
<#reference></#reference>
|
|
831
|
+
<#reference|value></#reference>
|
|
832
|
+
<#reference|notnull></#reference>
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
- User-defined tokens use `<#name>` syntax (no underscore)
|
|
836
|
+
- System tokens use `<#_name>` syntax (with underscore)
|
|
837
|
+
- Conditional rendering based on value presence
|
|
838
|
+
- `|value` renders if value exists
|
|
839
|
+
- `|notnull` renders if value is not null
|
|
840
|
+
|
|
841
|
+
### Paging Parameters
|
|
842
|
+
|
|
843
|
+
- #### `_limit` [parameter]
|
|
844
|
+
- Maximum rows to return (preferred over `_maxrows`)
|
|
845
|
+
- Supports range syntax: `_limit=start-end`
|
|
846
|
+
- Works with `_page` for pagination: `_limit=10&_page=3`
|
|
847
|
+
- Example: `?_limit=30`, `?_limit=10-30`
|
|
848
|
+
|
|
849
|
+
- #### `_rowcount` [boolean]
|
|
850
|
+
- Include total row count in response
|
|
851
|
+
- Default is `true`
|
|
852
|
+
- Set to `false` for improved performance on large datasets
|
|
853
|
+
- Example: `?_rowcount=false`
|
|
854
|
+
|
|
855
|
+
- #### `_rows` [parameter]
|
|
856
|
+
- Display range of rows
|
|
857
|
+
- Syntax: `_rows=start-end`
|
|
858
|
+
- Deprecated: prefer `_limit` with range syntax
|
|
859
|
+
- Example: `?_rows=1-10` (first 10 rows), `?_rows=11-20` (next 10)
|
|
860
|
+
|
|
861
|
+
- #### `_page` [parameter]
|
|
862
|
+
- Page number for pagination
|
|
863
|
+
- Works with `_limit` or `_RowsPerPage`
|
|
864
|
+
- Example: `?_limit=10&_page=3`, `?_page=2&_RowsPerPage=25`
|
|
865
|
+
|
|
866
|
+
- #### `_RowsPerPage` [parameter]
|
|
867
|
+
- Number of rows per page
|
|
868
|
+
- Works with `_page` parameter
|
|
869
|
+
- Overrides `_maxrows` setting
|
|
870
|
+
- Deprecated: prefer `_limit` with `_page`
|
|
871
|
+
- Example: `?_RowsPerPage=50`
|
|
872
|
+
|
|
873
|
+
- #### `_maxrows` [parameter]
|
|
874
|
+
- Maximum rows to display
|
|
875
|
+
- Syntax: `_maxrows=count`
|
|
876
|
+
- Deprecated: prefer `_limit`
|
|
877
|
+
- Example: `?_maxrows=100`
|
|
878
|
+
|
|
879
|
+
**Sample Code:**
|
|
880
|
+
|
|
881
|
+
```bash
|
|
882
|
+
# Limit to 30 rows
|
|
883
|
+
curl "https://example.dbo.io/api/output/entity/user?_limit=30"
|
|
884
|
+
|
|
885
|
+
# Range: rows 10 through 30
|
|
886
|
+
curl "https://example.dbo.io/api/output/entity/user?_limit=10-30"
|
|
887
|
+
|
|
888
|
+
# Page 3 with 10 rows per page
|
|
889
|
+
curl "https://example.dbo.io/api/output/entity/user?_limit=10&_page=3"
|
|
890
|
+
|
|
891
|
+
# Disable row count for performance
|
|
892
|
+
curl "https://example.dbo.io/api/output/entity/user?_limit=50&_rowcount=false"
|
|
893
|
+
|
|
894
|
+
# Legacy: get first 10 rows
|
|
895
|
+
curl "https://example.dbo.io/api/output/entity/user?_rows=1-10"
|
|
896
|
+
|
|
897
|
+
# Legacy: limit to 50 rows maximum
|
|
898
|
+
curl "https://example.dbo.io/api/output/entity/user?_maxrows=50"
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
### Sort Parameters
|
|
902
|
+
|
|
903
|
+
- #### `_sort` [parameter]
|
|
904
|
+
- Sort output by column
|
|
905
|
+
- Syntax: `_sort=ColumnName:direction` or `_sort$target@reference:modifier`
|
|
906
|
+
- Multiple sorts: comma-separated `_sort=Col1:ASC,Col2:DESC` or multiple `_sort` parameters
|
|
907
|
+
- Direction defaults to ascending when omitted
|
|
908
|
+
- Example: `?_sort=LastName:ASC`, `?_sort=LastName:ASC,FirstName:ASC`
|
|
909
|
+
|
|
910
|
+
#### Sort Modifiers
|
|
911
|
+
|
|
912
|
+
- `ASC` / `asc` - Ascending order (default)
|
|
913
|
+
- `DESC` / `desc` - Descending order
|
|
914
|
+
|
|
915
|
+
**Sample Code:**
|
|
916
|
+
|
|
917
|
+
```bash
|
|
918
|
+
# Sort by last name ascending
|
|
919
|
+
curl "https://example.dbo.io/api/output/entity/user?_sort=LastName:ASC"
|
|
920
|
+
|
|
921
|
+
# Sort by creation date descending (newest first)
|
|
922
|
+
curl "https://example.dbo.io/api/output/entity/content?_sort=_Created:DESC"
|
|
923
|
+
|
|
924
|
+
# Multiple sort columns (comma-separated)
|
|
925
|
+
curl "https://example.dbo.io/api/output/entity/user?_sort=LastName:ASC,FirstName:ASC"
|
|
926
|
+
|
|
927
|
+
# Multiple sort columns (separate parameters)
|
|
928
|
+
curl "https://example.dbo.io/api/output/entity/user?_sort=LastName:ASC&_sort=FirstName:ASC"
|
|
929
|
+
|
|
930
|
+
# Targeted sort (scoped to specific output)
|
|
931
|
+
curl "https://example.dbo.io/api/output/myUID?_sort$outputTarget@LastName:asc"
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
### Search Parameters
|
|
935
|
+
|
|
936
|
+
- #### `_search` [parameter]
|
|
937
|
+
- Full-text search across output columns
|
|
938
|
+
- Syntax: `_search$target@reference=value`
|
|
939
|
+
- Example: `?_search@FirstName,LastName=John`
|
|
940
|
+
|
|
941
|
+
### Debug & Profiling Parameters
|
|
942
|
+
|
|
943
|
+
- #### `_debug` [boolean]
|
|
944
|
+
- Show debug information in output
|
|
945
|
+
- Displays embed tokens and parameters in HTML comments
|
|
946
|
+
- Example: `?_debug=true`
|
|
947
|
+
|
|
948
|
+
- #### `_debug:sql` or `_debug_sql` [boolean]
|
|
949
|
+
- Show SQL queries in output without executing them
|
|
950
|
+
- Useful for troubleshooting custom outputs
|
|
951
|
+
- Example: `?_debug:sql=true`
|
|
952
|
+
|
|
953
|
+
- #### `_debug:verbose` [boolean]
|
|
954
|
+
- Verbose debug output with additional detail
|
|
955
|
+
- Example: `?_debug:verbose=true`
|
|
956
|
+
|
|
957
|
+
- #### `_debug:analysis` [boolean]
|
|
958
|
+
- Analysis debug output
|
|
959
|
+
- Example: `?_debug:analysis=true`
|
|
960
|
+
|
|
961
|
+
#### Additional Debug Sub-Keys
|
|
962
|
+
|
|
963
|
+
The `_debug` parameter supports many sub-keys for targeted debugging:
|
|
964
|
+
|
|
965
|
+
`http_modules`, `instance`, `rewrites`, `cache`, `executable_contents`, `security`, `controllers`, `embeds`, `includes`, `contents`, `template_render`, `tokens`, `messages`, `media`, `request_stack`, `query_execution`, `query_building`
|
|
966
|
+
|
|
967
|
+
Example: `?_debug:cache=true`, `?_debug:security=true`
|
|
968
|
+
|
|
969
|
+
- #### `_profile` [boolean]
|
|
970
|
+
- Enable MiniProfiler output for performance profiling
|
|
971
|
+
- Example: `?_profile=true`
|
|
972
|
+
|
|
973
|
+
### Display Control Parameters
|
|
974
|
+
|
|
975
|
+
- #### `_display@key` [parameter]
|
|
976
|
+
- Control element display by showing or hiding template content tags
|
|
977
|
+
- Syntax: `_display@tagName=show|hide`
|
|
978
|
+
- Example: `?_display@sidebar=hide`, `?_display@filters=show`
|
|
979
|
+
|
|
980
|
+
- #### `_empty_response_code` [integer]
|
|
981
|
+
- HTTP status code to return when output produces no results
|
|
982
|
+
- Example: `?_empty_response_code=404`
|
|
983
|
+
|
|
984
|
+
- #### `_fallback_content` [parameter]
|
|
985
|
+
- Render a different content record when a specific HTTP status code is returned
|
|
986
|
+
- Syntax: `_fallback_content:statusCode=contentUID`
|
|
987
|
+
- Example: `?_fallback_content:404=myNotFoundContentUID`
|
|
988
|
+
|
|
989
|
+
### Control Flags
|
|
990
|
+
|
|
991
|
+
- #### `_strict` [boolean]
|
|
992
|
+
- Enable strict error mode
|
|
993
|
+
- Example: `?_strict=true`
|
|
994
|
+
|
|
995
|
+
- #### `_confirm` [boolean]
|
|
996
|
+
- Confirmation flag for operations
|
|
997
|
+
- Example: `?_confirm=true`
|
|
998
|
+
|
|
999
|
+
- #### `_no_transaction` [boolean]
|
|
1000
|
+
- Disable transaction wrapping for the query
|
|
1001
|
+
- Example: `?_no_transaction=true`
|
|
1002
|
+
|
|
1003
|
+
- #### `_skip` [string]
|
|
1004
|
+
- Skip execution phases (admin-only)
|
|
1005
|
+
- Example: `?_skip=all`
|
|
1006
|
+
|
|
1007
|
+
- #### `_include` [string]
|
|
1008
|
+
- Include token for additional content inclusion
|
|
1009
|
+
- Example: `?_include=value`
|
|
1010
|
+
|
|
1011
|
+
- #### `_security` [string]
|
|
1012
|
+
- Security filter enforcement
|
|
1013
|
+
- Example: `?_security=value`
|
|
1014
|
+
|
|
1015
|
+
---
|
|
1016
|
+
|
|
1017
|
+
## Content API
|
|
1018
|
+
_______________________________________________________
|
|
1019
|
+
|
|
1020
|
+
### URL
|
|
1021
|
+
```
|
|
1022
|
+
/api/content/{content.UID}
|
|
1023
|
+
/api/c/{content.UID} (short form)
|
|
1024
|
+
/app/{app.Shortname}/{site.Shortname}/{content.Path}
|
|
1025
|
+
{control.domain.Domain}/{content.Path}
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
Access content records (HTML, CSS, JS, text) by UID or path. Also supports OPTIONS method for CORS preflight requests.
|
|
1029
|
+
|
|
1030
|
+
### Sample Code
|
|
1031
|
+
|
|
1032
|
+
```bash
|
|
1033
|
+
# Get content by UID
|
|
1034
|
+
curl -b .cookies \
|
|
1035
|
+
"https://example.dbo.io/api/content/ykqucv0eb0ggjqgcncj6dq"
|
|
1036
|
+
|
|
1037
|
+
# Get content by app path
|
|
1038
|
+
curl -b .cookies \
|
|
1039
|
+
"https://example.dbo.io/app/operator/ui/master.html"
|
|
1040
|
+
```
|
|
1041
|
+
|
|
1042
|
+
### Embed Content
|
|
1043
|
+
|
|
1044
|
+
```html
|
|
1045
|
+
<!-- Preferred syntax -->
|
|
1046
|
+
<#_embed url="/api/content/target" hide="true" preload="true" >
|
|
1047
|
+
|
|
1048
|
+
<!-- Alternative syntax (still supported) -->
|
|
1049
|
+
<#embed url="/api/content/target" hide="true" preload="true" >
|
|
1050
|
+
|
|
1051
|
+
<!-- Legacy syntax (demoted) -->
|
|
1052
|
+
<EmbedToken url="/api/content/myContentUID" />
|
|
1053
|
+
```
|
|
1054
|
+
|
|
1055
|
+
### Content Parameters
|
|
1056
|
+
|
|
1057
|
+
- #### `_minify` [boolean]
|
|
1058
|
+
- Enable/disable minification
|
|
1059
|
+
- Default is `true` for CSS/JS content
|
|
1060
|
+
- Example: `?_minify=false`
|
|
1061
|
+
|
|
1062
|
+
- #### `_no_minify` [boolean]
|
|
1063
|
+
- Alternative to disable minification
|
|
1064
|
+
- Example: `?_no_minify=true`
|
|
1065
|
+
|
|
1066
|
+
- #### `_format` [parameter]
|
|
1067
|
+
- Specify content format
|
|
1068
|
+
- Available: txt, json, html, xml, csv, pdf
|
|
1069
|
+
- Example: `?_format=txt`
|
|
1070
|
+
|
|
1071
|
+
### Content Tokens
|
|
1072
|
+
|
|
1073
|
+
- #### `#{content@ColumnPhysicalName}` [token]
|
|
1074
|
+
- Access content record columns
|
|
1075
|
+
- Example: `#{content@Title}`, `#{content@Path}`
|
|
1076
|
+
|
|
1077
|
+
### Display Modifiers
|
|
1078
|
+
|
|
1079
|
+
```html
|
|
1080
|
+
<!-- User-defined display keys (no underscore) -->
|
|
1081
|
+
<@key:modifier;comment></@key>
|
|
1082
|
+
<@key></@key>
|
|
1083
|
+
```
|
|
1084
|
+
|
|
1085
|
+
**Note**: Display modifiers use `<@key>` syntax where `key` is user-defined (no underscore prefix).
|
|
1086
|
+
|
|
1087
|
+
- #### `_display@key` [parameter]
|
|
1088
|
+
- Control element display
|
|
1089
|
+
- Syntax: `_display@key:modifier=boolean`
|
|
1090
|
+
- Available modifiers: `show` (default), `hide`
|
|
1091
|
+
|
|
1092
|
+
---
|
|
1093
|
+
|
|
1094
|
+
## Media API
|
|
1095
|
+
_______________________________________________________
|
|
1096
|
+
|
|
1097
|
+
### URL
|
|
1098
|
+
```
|
|
1099
|
+
/api/media/{media.UID} (by UID)
|
|
1100
|
+
/api/media/id/{media.MediaID} (by numeric ID)
|
|
1101
|
+
/dir/{*path} (by directory path)
|
|
1102
|
+
/ext/{mediaServer.UID}/{rowId} (external media server)
|
|
1103
|
+
/media/{app.Shortname}/{media.Ownership}/{media.Path}/{media.Filename}
|
|
1104
|
+
```
|
|
1105
|
+
|
|
1106
|
+
Access and upload media files (images, fonts, documents, binaries).
|
|
1107
|
+
|
|
1108
|
+
### Access Parameters
|
|
1109
|
+
|
|
1110
|
+
- #### `_download` [boolean]
|
|
1111
|
+
- When `true`, serves the file as a download attachment instead of inline
|
|
1112
|
+
- Sets `Content-Disposition: attachment` header
|
|
1113
|
+
- Example: `?_download=true`
|
|
1114
|
+
|
|
1115
|
+
### Security
|
|
1116
|
+
|
|
1117
|
+
- Media records with `Public=true` bypass security checks and are accessible without authentication
|
|
1118
|
+
- All other media requires `Execute` permission on the media entity
|
|
1119
|
+
|
|
1120
|
+
### Sample Code (Access)
|
|
1121
|
+
|
|
1122
|
+
```bash
|
|
1123
|
+
# Get media by UID
|
|
1124
|
+
curl -b .cookies \
|
|
1125
|
+
"https://example.dbo.io/api/media/albain3dwkofbhnd1qtd1q"
|
|
1126
|
+
|
|
1127
|
+
# Get media by path
|
|
1128
|
+
curl -b .cookies \
|
|
1129
|
+
"https://example.dbo.io/media/operator/app/assets/gfx/logo.png"
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
### Sample Code (Upload)
|
|
1133
|
+
|
|
1134
|
+
```bash
|
|
1135
|
+
# Upload new media file
|
|
1136
|
+
curl -K config-form.curl \
|
|
1137
|
+
-F file=@local/path/image.jpg \
|
|
1138
|
+
-F "RowID:add1;column:media.BinID=12345" \
|
|
1139
|
+
-F "RowID:add1;column:media.AppID=67890" \
|
|
1140
|
+
-F "RowID:add1;column:media.Ownership=app" \
|
|
1141
|
+
-F "RowID:add1;column:media.Path=assets/images" \
|
|
1142
|
+
-F "_confirm=true" \
|
|
1143
|
+
https://example.dbo.io/api/input/submit
|
|
1144
|
+
|
|
1145
|
+
# Update existing media file
|
|
1146
|
+
curl -K config-form.curl \
|
|
1147
|
+
-F file=@local/path/updated-image.jpg \
|
|
1148
|
+
-F "RowID:19782;column:media.Filename=image.jpg" \
|
|
1149
|
+
-F "_confirm=true" \
|
|
1150
|
+
https://example.dbo.io/api/input/submit
|
|
1151
|
+
```
|
|
1152
|
+
|
|
1153
|
+
### Upload Parameters
|
|
1154
|
+
|
|
1155
|
+
- #### `file` [File]
|
|
1156
|
+
- The actual file being uploaded
|
|
1157
|
+
- Use `-F file=@path` syntax for curl
|
|
1158
|
+
- Example: `-F file=@assets/logo.png`
|
|
1159
|
+
|
|
1160
|
+
- #### Media Columns
|
|
1161
|
+
|
|
1162
|
+
All media uploads should specify these columns:
|
|
1163
|
+
|
|
1164
|
+
- `media.BinID` - Binary container ID (required)
|
|
1165
|
+
- `media.AppID` - Application ID (required)
|
|
1166
|
+
- `media.Ownership` - Ownership type: `'app'`, `'user'`, or `'system'` (required)
|
|
1167
|
+
- `media.Path` - File path within ownership (required)
|
|
1168
|
+
- `media.Filename` - File name (auto-detected from file, optional)
|
|
1169
|
+
- `media.Extension` - File extension (auto-detected, optional)
|
|
1170
|
+
|
|
1171
|
+
### Upload API
|
|
1172
|
+
|
|
1173
|
+
#### URL
|
|
1174
|
+
```
|
|
1175
|
+
/api/upload/submit
|
|
1176
|
+
```
|
|
1177
|
+
|
|
1178
|
+
Dedicated file upload endpoint (POST only). Requires `_confirm=true`.
|
|
1179
|
+
|
|
1180
|
+
```bash
|
|
1181
|
+
# Upload via dedicated endpoint
|
|
1182
|
+
curl -X POST -K config-form.curl \
|
|
1183
|
+
-F file=@local/path/image.jpg \
|
|
1184
|
+
-F "AppID=67890" \
|
|
1185
|
+
-F "Ownership=app" \
|
|
1186
|
+
-F "Name=logo" \
|
|
1187
|
+
-F "Path=assets/images" \
|
|
1188
|
+
-F "_confirm=true" \
|
|
1189
|
+
https://example.dbo.io/api/upload/submit
|
|
1190
|
+
```
|
|
1191
|
+
|
|
1192
|
+
---
|
|
1193
|
+
|
|
1194
|
+
## Message API
|
|
1195
|
+
_______________________________________________________
|
|
1196
|
+
|
|
1197
|
+
### URL
|
|
1198
|
+
```
|
|
1199
|
+
/api/message/content/{content.UID} (send message)
|
|
1200
|
+
/api/m/c/{content.UID} (short form)
|
|
1201
|
+
/api/message/c/{content.UID} (medium form)
|
|
1202
|
+
/api/content/email/{content.UID} (legacy email endpoint)
|
|
1203
|
+
/api/c/email/{content.UID} (legacy email short form)
|
|
1204
|
+
/api/message/receive/{messageServer.UID} (receive inbound messages)
|
|
1205
|
+
/api/m/r/{messageServer.UID} (short form)
|
|
1206
|
+
```
|
|
1207
|
+
|
|
1208
|
+
Send messages (email, SMS/MMS, chatbot) by referencing a content record that contains the message template. Requires `_confirm=true` to execute.
|
|
1209
|
+
|
|
1210
|
+
### Message Types
|
|
1211
|
+
|
|
1212
|
+
- **Email (SMTP)** - Traditional email with To, Cc, Bcc recipients via `ExternalMessage_Email`
|
|
1213
|
+
- **SMS/MMS (Twilio)** - Text messaging via Twilio integration via `ExternalMessage_Twilio`
|
|
1214
|
+
- **ChatBot** - AI chatbot conversations via `ExternalMessage_ChatBot` with OpenAI integration
|
|
1215
|
+
|
|
1216
|
+
### Parameters
|
|
1217
|
+
|
|
1218
|
+
- #### `_confirm` [boolean]
|
|
1219
|
+
- Required. Must be `true` for message to be sent
|
|
1220
|
+
- Without confirmation, message is validated but not sent
|
|
1221
|
+
|
|
1222
|
+
- #### `ThreadID` [string]
|
|
1223
|
+
- For chatbot messages, specifies the conversation thread
|
|
1224
|
+
- Enables multi-turn conversations with history preservation
|
|
1225
|
+
- Stored in `message_log` table
|
|
1226
|
+
|
|
1227
|
+
- #### `security` [string]
|
|
1228
|
+
- Embed attribute to control security checks
|
|
1229
|
+
- Set to `"false"` to bypass security on message embeds
|
|
1230
|
+
- Example: `<#_embed url="/api/message/content/uid" security="false" >`
|
|
1231
|
+
|
|
1232
|
+
### ChatBot Features (v.9.49+)
|
|
1233
|
+
|
|
1234
|
+
- **Function Calling**: Define tools in the message template for the chatbot to invoke. Functions are executed via content includes or output/content API calls.
|
|
1235
|
+
- **Conversation Threading**: Multi-turn conversations tracked by `ThreadID` in `message_log`
|
|
1236
|
+
- **Iteration Limits**: Configurable maximum conversation iterations (default 10)
|
|
1237
|
+
- **Halt Functions**: Functions marked with `chatbot_halt` attribute stop the conversation loop
|
|
1238
|
+
|
|
1239
|
+
### Sample Code
|
|
1240
|
+
|
|
1241
|
+
```bash
|
|
1242
|
+
# Send email message
|
|
1243
|
+
curl -b .cookies \
|
|
1244
|
+
--data-urlencode "_confirm=true" \
|
|
1245
|
+
"https://example.dbo.io/api/message/content/emailTemplateUID"
|
|
1246
|
+
|
|
1247
|
+
# Send chatbot message with thread
|
|
1248
|
+
curl -b .cookies \
|
|
1249
|
+
--data-urlencode "_confirm=true" \
|
|
1250
|
+
--data-urlencode "ThreadID=conversation123" \
|
|
1251
|
+
"https://example.dbo.io/api/m/c/chatbotTemplateUID"
|
|
1252
|
+
```
|
|
1253
|
+
|
|
1254
|
+
### Email Template Syntax
|
|
1255
|
+
|
|
1256
|
+
```html
|
|
1257
|
+
<#_email>
|
|
1258
|
+
<#_from>sender@example.com</#_from>
|
|
1259
|
+
<#_to>recipient@example.com</#_to>
|
|
1260
|
+
<#_cc>cc@example.com</#_cc>
|
|
1261
|
+
<#_bcc>bcc@example.com</#_bcc>
|
|
1262
|
+
<#_subject>Email Subject</#_subject>
|
|
1263
|
+
<#_html>
|
|
1264
|
+
<p>HTML content with #{tokens}</p>
|
|
1265
|
+
</#_html>
|
|
1266
|
+
<#_plain>Plain text version</#_plain>
|
|
1267
|
+
</#_email>
|
|
1268
|
+
```
|
|
1269
|
+
|
|
1270
|
+
### Receiving Messages
|
|
1271
|
+
|
|
1272
|
+
```bash
|
|
1273
|
+
# Receive inbound message (e.g., Twilio webhook)
|
|
1274
|
+
curl -X POST \
|
|
1275
|
+
"https://example.dbo.io/api/message/receive/twilioServerUID"
|
|
1276
|
+
```
|
|
1277
|
+
|
|
1278
|
+
---
|
|
1279
|
+
|
|
1280
|
+
## Cache API
|
|
1281
|
+
_______________________________________________________
|
|
1282
|
+
|
|
1283
|
+
### URL
|
|
1284
|
+
```
|
|
1285
|
+
/api/cache/list (list cached items)
|
|
1286
|
+
/api/cache/refresh (refresh cache by key)
|
|
1287
|
+
```
|
|
1288
|
+
|
|
1289
|
+
Manage the DBO.io cache. Used for debugging and cache invalidation.
|
|
1290
|
+
|
|
1291
|
+
### Parameters
|
|
1292
|
+
|
|
1293
|
+
- #### `_key` [string]
|
|
1294
|
+
- Cache key to refresh (case-insensitive)
|
|
1295
|
+
- Example: `?_key=content:myContentUID`
|
|
1296
|
+
|
|
1297
|
+
- #### `_part` [string]
|
|
1298
|
+
- Target specific cache partition
|
|
1299
|
+
|
|
1300
|
+
- #### `_metadata` [boolean]
|
|
1301
|
+
- When `true`, includes cache provider metadata in response
|
|
1302
|
+
- Example: `?_metadata=true`
|
|
1303
|
+
|
|
1304
|
+
### Sample Code
|
|
1305
|
+
|
|
1306
|
+
```bash
|
|
1307
|
+
# List all cached items
|
|
1308
|
+
curl -b .cookies "https://example.dbo.io/api/cache/list"
|
|
1309
|
+
|
|
1310
|
+
# Refresh a specific content cache
|
|
1311
|
+
curl -b .cookies "https://example.dbo.io/api/cache/refresh?_key=content:myContentUID"
|
|
1312
|
+
```
|
|
1313
|
+
|
|
1314
|
+
---
|
|
1315
|
+
|
|
1316
|
+
## Instance API
|
|
1317
|
+
_______________________________________________________
|
|
1318
|
+
|
|
1319
|
+
### URL
|
|
1320
|
+
```
|
|
1321
|
+
/api/instance/export (export instance)
|
|
1322
|
+
/api/instance/build/{instance.UID} (build instance)
|
|
1323
|
+
/api/instance/build?_instance_uid=UID (alternative form)
|
|
1324
|
+
```
|
|
1325
|
+
|
|
1326
|
+
Manage DBO.io instances. Requires `_confirm=true`. Supports offline/asynchronous execution.
|
|
1327
|
+
|
|
1328
|
+
### Parameters
|
|
1329
|
+
|
|
1330
|
+
- #### `_confirm` [boolean]
|
|
1331
|
+
- Required for execution
|
|
1332
|
+
|
|
1333
|
+
- #### `_instance_uid` [string]
|
|
1334
|
+
- Alternative to URL parameter for specifying instance UID
|
|
1335
|
+
|
|
1336
|
+
- #### `_callback_url` [string]
|
|
1337
|
+
- URL to call when async operation completes
|
|
1338
|
+
|
|
1339
|
+
### Sample Code
|
|
1340
|
+
|
|
1341
|
+
```bash
|
|
1342
|
+
# Export instance
|
|
1343
|
+
curl -b .cookies \
|
|
1344
|
+
--data-urlencode "_confirm=true" \
|
|
1345
|
+
"https://example.dbo.io/api/instance/export"
|
|
1346
|
+
|
|
1347
|
+
# Build instance
|
|
1348
|
+
curl -b .cookies \
|
|
1349
|
+
--data-urlencode "_confirm=true" \
|
|
1350
|
+
"https://example.dbo.io/api/instance/build/instanceUID"
|
|
1351
|
+
```
|
|
1352
|
+
|
|
1353
|
+
---
|
|
1354
|
+
|
|
1355
|
+
## Custom SQL Tokens
|
|
1356
|
+
_______________________________________________________
|
|
1357
|
+
|
|
1358
|
+
For outputs with CustomSQL, special tokens are available:
|
|
1359
|
+
|
|
1360
|
+
### Filter Value Tokens
|
|
1361
|
+
|
|
1362
|
+
- #### `#{filter_value@output_value_filter.UID}` [token]
|
|
1363
|
+
- Access filter values in CustomSQL
|
|
1364
|
+
- Used in `output_value.CustomSQL` field
|
|
1365
|
+
- Example: `#{filter_value@myFilterUID}`
|
|
1366
|
+
|
|
1367
|
+
- #### `#{filter_value@output_value_filter.Shortname}` [token]
|
|
1368
|
+
- Access filter by shortname
|
|
1369
|
+
- Alternative to UID reference
|
|
1370
|
+
- Example: `#{filter_value@userFilter}`
|
|
1371
|
+
|
|
1372
|
+
### Join Tokens
|
|
1373
|
+
|
|
1374
|
+
- #### `#{join@entity_column.UID}` [token]
|
|
1375
|
+
- Define custom joins in SQL
|
|
1376
|
+
- Used in `output_value_entity_column_rel.CustomSQL`
|
|
1377
|
+
- Example: `#{join@userTableUID}`
|
|
1378
|
+
|
|
1379
|
+
---
|
|
1380
|
+
|
|
1381
|
+
## Aggregate Modifiers
|
|
1382
|
+
_______________________________________________________
|
|
1383
|
+
|
|
1384
|
+
Available for token-based aggregation:
|
|
1385
|
+
|
|
1386
|
+
- `Min` - Minimum value
|
|
1387
|
+
- `Max` - Maximum value
|
|
1388
|
+
- `Count` - Count of records
|
|
1389
|
+
- `Average` - Average value
|
|
1390
|
+
- `Sum` - Sum of values
|
|
1391
|
+
- `default` - Default aggregation
|
|
1392
|
+
|
|
1393
|
+
**Example:**
|
|
1394
|
+
```
|
|
1395
|
+
#{value@Price:Sum}
|
|
1396
|
+
#{value@OrderID:Count}
|
|
1397
|
+
```
|
|
1398
|
+
|
|
1399
|
+
---
|
|
1400
|
+
|
|
1401
|
+
## Best Practices
|
|
1402
|
+
|
|
1403
|
+
### For Deployment Scripts
|
|
1404
|
+
|
|
1405
|
+
1. **Always use RowUID with alphanumeric UIDs** for cross-environment stability
|
|
1406
|
+
2. **Include `_confirm=true`** for changes to persist
|
|
1407
|
+
3. **Use `@filepath` syntax** for content uploads (CSS, JS, HTML)
|
|
1408
|
+
4. **Use `-F file=@` syntax** for media/binary uploads
|
|
1409
|
+
5. **Test in development** before deploying to production
|
|
1410
|
+
|
|
1411
|
+
### For API Queries
|
|
1412
|
+
|
|
1413
|
+
1. **Use filters** to limit result sets: `_filter@column=value`
|
|
1414
|
+
2. **Specify format** explicitly: `_format=json`
|
|
1415
|
+
3. **Implement pagination** for large datasets: `_page` and `_RowsPerPage`
|
|
1416
|
+
4. **Cache frequently accessed** content when possible
|
|
1417
|
+
5. **Use debug parameters** during development: `_debug=true`
|
|
1418
|
+
|
|
1419
|
+
### For Templates
|
|
1420
|
+
|
|
1421
|
+
1. **Escape user input** with `:escape_html` modifier
|
|
1422
|
+
2. **Check for null values** with conditional tokens
|
|
1423
|
+
3. **Use token processing order** correctly for nested tokens
|
|
1424
|
+
4. **Cache expensive operations** with `:cached` modifier
|
|
1425
|
+
5. **Provide empty state** templates with `<#empty>` section
|
|
1426
|
+
|
|
1427
|
+
---
|
|
1428
|
+
|
|
1429
|
+
## Error Handling
|
|
1430
|
+
|
|
1431
|
+
### Common Error Responses
|
|
1432
|
+
|
|
1433
|
+
- **401 Unauthorized** - Authentication required or failed
|
|
1434
|
+
- **403 Forbidden** - Insufficient permissions
|
|
1435
|
+
- **404 Not Found** - Record or endpoint not found
|
|
1436
|
+
- **422 Unprocessable Entity** - Validation failed (without `_confirm=true`)
|
|
1437
|
+
- **500 Internal Server Error** - Server-side error
|
|
1438
|
+
|
|
1439
|
+
### Validation vs. Execution
|
|
1440
|
+
|
|
1441
|
+
**Without `_confirm=true`:**
|
|
1442
|
+
- Request is validated only
|
|
1443
|
+
- No changes are made to database
|
|
1444
|
+
- Returns success if validation passes
|
|
1445
|
+
- Returns error details if validation fails
|
|
1446
|
+
|
|
1447
|
+
**With `_confirm=true`:**
|
|
1448
|
+
- Request is validated and executed
|
|
1449
|
+
- Changes are committed to database
|
|
1450
|
+
- Returns success with updated record data
|
|
1451
|
+
- Returns error if execution fails
|
|
1452
|
+
|
|
1453
|
+
---
|
|
1454
|
+
|
|
1455
|
+
## URL Encoding Reference
|
|
1456
|
+
|
|
1457
|
+
When using curl with `--data-urlencode`:
|
|
1458
|
+
|
|
1459
|
+
```
|
|
1460
|
+
: becomes %3A (colon)
|
|
1461
|
+
; becomes %3B (semicolon)
|
|
1462
|
+
= becomes %3D (equals)
|
|
1463
|
+
@ becomes %40 (at symbol)
|
|
1464
|
+
! becomes %21 (exclamation)
|
|
1465
|
+
# becomes %23 (hash)
|
|
1466
|
+
```
|
|
1467
|
+
|
|
1468
|
+
**Example:**
|
|
1469
|
+
```bash
|
|
1470
|
+
# Raw parameter:
|
|
1471
|
+
RowUID:albain3dwkofbhnd1qtd1q;column:content.Content@file.css
|
|
1472
|
+
|
|
1473
|
+
# URL encoded:
|
|
1474
|
+
RowUID%3Aalbain3dwkofbhnd1qtd1q%3Bcolumn%3Acontent.Content%40file.css
|
|
1475
|
+
```
|
|
1476
|
+
|
|
1477
|
+
---
|
|
1478
|
+
|
|
1479
|
+
## Additional Resources
|
|
1480
|
+
|
|
1481
|
+
- **Architecture Guide**: See [CLAUDE.md](../CLAUDE.md) for codebase architecture and development guidance
|
|
1482
|
+
- **Version History**: See [version.txt](../src/webapp-framework/version.txt) for release notes
|
|
1483
|
+
- **Context Migration**: See [README_ContextMigration.md](../src/dboioStandard/Web/README_ContextMigration.md) for .NET Core migration guide
|
|
1484
|
+
|
|
1485
|
+
---
|
|
1486
|
+
|
|
1487
|
+
*Current version: 0.9.51.0*
|