Skip to content

Commit c97c85b

Browse files
akoclaude
andcommitted
docs: add published REST service to quick reference, feature matrix, help, examples
Addresses review checklist gaps: - MDL_QUICK_REFERENCE.md: full syntax table and example - MDL_FEATURE_MATRIX.md: updated from all N to Y for SHOW/DESCRIBE/CREATE/DROP - rest.txt help topic: CREATE/DROP syntax with example - 22-published-rest-service-examples.mdl: doctype test (16 statements) - docs-site rest-integration.md: publishing section with multi-resource example - CLAUDE.md: updated implementation status Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5d64e28 commit c97c85b

File tree

6 files changed

+253
-1
lines changed

6 files changed

+253
-1
lines changed

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ Full syntax tables for all MDL statements (microflows, pages, security, navigati
443443
- OData contract browsing (SHOW/DESCRIBE CONTRACT ENTITIES/ACTIONS FROM cached $metadata)
444444
- AsyncAPI contract browsing (SHOW/DESCRIBE CONTRACT CHANNELS/MESSAGES FROM cached AsyncAPI)
445445
- SHOW EXTERNAL ACTIONS, SHOW PUBLISHED REST SERVICES
446+
- CREATE/DROP/DESCRIBE PUBLISHED REST SERVICE with resources, operations, path params, CREATE OR REPLACE
446447
- Integration catalog tables (rest_clients, rest_operations, published_rest_services, external_entities, external_actions, business_events)
447448
- Contract catalog tables (contract_entities, contract_actions, contract_messages — parsed from cached $metadata and AsyncAPI)
448449

cmd/mxcli/help_topics/rest.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,30 @@ DESCRIBE COMMANDS
1515
DESCRIBE REST CLIENT MyModule.PetStoreAPI; -- Full MDL definition
1616
DESCRIBE PUBLISHED REST SERVICE MyModule.MyAPI; -- Full MDL definition
1717

18+
CREATE / DROP PUBLISHED REST SERVICE
19+
-------------------------------------
20+
21+
CREATE PUBLISHED REST SERVICE Module.MyAPI (
22+
Path: 'rest/api/v1',
23+
Version: '1.0.0',
24+
ServiceName: 'My API'
25+
)
26+
{
27+
RESOURCE 'orders' {
28+
GET '/' MICROFLOW Module.GetAllOrders;
29+
GET '/{id}' MICROFLOW Module.GetOrderById;
30+
POST '/' MICROFLOW Module.CreateOrder;
31+
DELETE '/{id}' MICROFLOW Module.DeleteOrder;
32+
}
33+
};
34+
35+
CREATE OR REPLACE PUBLISHED REST SERVICE ...; -- Replaces existing
36+
DROP PUBLISHED REST SERVICE Module.MyAPI; -- Delete service
37+
38+
Properties: Path (required), Version, ServiceName, Folder
39+
HTTP methods: GET, POST, PUT, DELETE, PATCH
40+
Modifiers: DEPRECATED, IMPORT MAPPING, EXPORT MAPPING, COMMIT
41+
1842
JSON STRUCTURES & MAPPINGS
1943
--------------------------
2044

docs-site/src/examples/rest-integration.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,59 @@ CREATE IMPORT MAPPING Integration.IMM_Order
179179
}
180180
};
181181
```
182+
183+
## Publishing a REST API
184+
185+
Create a published REST service with CRUD operations backed by microflows.
186+
187+
```sql
188+
CREATE PUBLISHED REST SERVICE Module.OrderAPI (
189+
Path: 'rest/orders/v1',
190+
Version: '1.0.0',
191+
ServiceName: 'Order API'
192+
)
193+
{
194+
RESOURCE 'orders' {
195+
GET '/' MICROFLOW Module.PRS_GetAllOrders;
196+
GET '/{id}' MICROFLOW Module.PRS_GetOrderById;
197+
POST '/' MICROFLOW Module.PRS_CreateOrder;
198+
PUT '/{id}' MICROFLOW Module.PRS_UpdateOrder;
199+
DELETE '/{id}' MICROFLOW Module.PRS_DeleteOrder;
200+
}
201+
};
202+
```
203+
204+
### Multiple Resources
205+
206+
```sql
207+
CREATE PUBLISHED REST SERVICE Module.CrmAPI (
208+
Path: 'rest/crm/v1',
209+
Version: '1.0.0',
210+
ServiceName: 'CRM API'
211+
)
212+
{
213+
RESOURCE 'orders' {
214+
GET '/' MICROFLOW Module.PRS_GetOrders;
215+
}
216+
RESOURCE 'customers' {
217+
GET '/' MICROFLOW Module.PRS_GetCustomers;
218+
}
219+
RESOURCE 'orders/{orderId}/items' {
220+
GET '/' MICROFLOW Module.PRS_GetOrderItems;
221+
}
222+
};
223+
```
224+
225+
### Update or Remove
226+
227+
```sql
228+
-- Replace with new version
229+
CREATE OR REPLACE PUBLISHED REST SERVICE Module.OrderAPI (
230+
Path: 'rest/orders/v2',
231+
Version: '2.0.0',
232+
ServiceName: 'Order API v2'
233+
) { ... };
234+
235+
-- Remove entirely
236+
DROP PUBLISHED REST SERVICE Module.OrderAPI;
237+
```

docs/01-project/MDL_FEATURE_MATRIX.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ Document types that exist in Mendix but have no MDL support:
194194
| **Extensions** | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | Mendix extensions / add-ons |
195195
| **Custom JS actions** | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | JavaScript actions for nanoflows |
196196
| **Custom widgets** | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | Pluggable widget packages |
197-
| **REST publish** | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | Published REST services |
197+
| **REST publish** | Y | Y | Y | N | Y | N | N | N | Y | N | P | N | Y | N | N | Y | N | Published REST services (CREATE/DROP/SHOW/DESCRIBE) |
198198
| **REST consume (v2)** | N | N | N | N | N | N | 06 | N | N | N | N | Y | N | N | N | N | N | Consumed REST services; partial grammar exists |
199199
| **Web service publish** | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | Published SOAP web services |
200200
| **Web service consume** | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | Consumed SOAP web services |

docs/01-project/MDL_QUICK_REFERENCE.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,41 @@ CREATE OR REPLACE NAVIGATION Responsive
436436

437437
**Export levels:** `'Hidden'` (default, internal to module), `'Public'` (accessible from other modules).
438438

439+
## Published REST Services
440+
441+
| Statement | Syntax | Notes |
442+
|-----------|--------|-------|
443+
| Show services | `SHOW PUBLISHED REST SERVICES [IN Module];` | List all or filter by module |
444+
| Describe service | `DESCRIBE PUBLISHED REST SERVICE Module.Name;` | Re-executable CREATE statement |
445+
| Create service | See below | |
446+
| Create or replace | `CREATE OR REPLACE PUBLISHED REST SERVICE ...` | Replaces existing service |
447+
| Drop service | `DROP PUBLISHED REST SERVICE Module.Name;` | |
448+
449+
```sql
450+
CREATE PUBLISHED REST SERVICE Module.MyAPI (
451+
Path: 'rest/api/v1',
452+
Version: '1.0.0',
453+
ServiceName: 'My API',
454+
Folder: 'Integration/REST'
455+
)
456+
{
457+
RESOURCE 'orders' {
458+
GET '/' MICROFLOW Module.GetAllOrders;
459+
GET '/{id}' MICROFLOW Module.GetOrderById;
460+
POST '/' MICROFLOW Module.CreateOrder;
461+
PUT '/{id}' MICROFLOW Module.UpdateOrder;
462+
DELETE '/{id}' MICROFLOW Module.DeleteOrder;
463+
}
464+
RESOURCE 'customers' {
465+
GET '/' MICROFLOW Module.GetAllCustomers;
466+
}
467+
};
468+
```
469+
470+
**Properties:** `Path` (required), `Version`, `ServiceName`, `Folder`
471+
**HTTP methods:** `GET`, `POST`, `PUT`, `DELETE`, `PATCH`
472+
**Operation modifiers:** `DEPRECATED`, `IMPORT MAPPING Module.Name`, `EXPORT MAPPING Module.Name`, `COMMIT Yes|No`
473+
439474
## JSON Structures
440475

441476
| Statement | Syntax | Notes |
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
-- ============================================================================
2+
-- Published REST Service Examples
3+
-- ============================================================================
4+
--
5+
-- Demonstrates creating, describing, and dropping published REST services.
6+
--
7+
-- Prerequisites:
8+
-- - Microflows backing the operations must exist
9+
--
10+
-- ============================================================================
11+
12+
CREATE MODULE PrsTest;
13+
14+
-- ############################################################################
15+
-- PART 1: BACKING MICROFLOWS
16+
-- ############################################################################
17+
18+
CREATE MICROFLOW PrsTest.PRS_GetAllOrders ($httpResponse: System.HttpResponse)
19+
RETURNS String AS $Result
20+
BEGIN
21+
DECLARE $Result String = '[]';
22+
RETURN $Result;
23+
END;
24+
/
25+
26+
CREATE MICROFLOW PrsTest.PRS_GetOrderById ($httpResponse: System.HttpResponse, $Id: String)
27+
RETURNS String AS $Result
28+
BEGIN
29+
DECLARE $Result String = '{}';
30+
RETURN $Result;
31+
END;
32+
/
33+
34+
CREATE MICROFLOW PrsTest.PRS_CreateOrder ($httpResponse: System.HttpResponse)
35+
RETURNS String AS $Result
36+
BEGIN
37+
DECLARE $Result String = '{"status": "created"}';
38+
RETURN $Result;
39+
END;
40+
/
41+
42+
CREATE MICROFLOW PrsTest.PRS_DeleteOrder ($httpResponse: System.HttpResponse, $Id: String)
43+
RETURNS String AS $Result
44+
BEGIN
45+
DECLARE $Result String = '{"status": "deleted"}';
46+
RETURN $Result;
47+
END;
48+
/
49+
50+
CREATE MICROFLOW PrsTest.PRS_GetCustomers ($httpResponse: System.HttpResponse)
51+
RETURNS String AS $Result
52+
BEGIN
53+
DECLARE $Result String = '[]';
54+
RETURN $Result;
55+
END;
56+
/
57+
58+
-- ############################################################################
59+
-- PART 2: SIMPLE PUBLISHED REST SERVICE
60+
-- ############################################################################
61+
62+
CREATE PUBLISHED REST SERVICE PrsTest.OrderAPI (
63+
Path: 'rest/orders/v1',
64+
Version: '1.0.0',
65+
ServiceName: 'Order API'
66+
)
67+
{
68+
RESOURCE 'orders' {
69+
GET '/' MICROFLOW PrsTest.PRS_GetAllOrders;
70+
GET '/{id}' MICROFLOW PrsTest.PRS_GetOrderById;
71+
POST '/' MICROFLOW PrsTest.PRS_CreateOrder;
72+
DELETE '/{id}' MICROFLOW PrsTest.PRS_DeleteOrder;
73+
}
74+
};
75+
76+
DESCRIBE PUBLISHED REST SERVICE PrsTest.OrderAPI;
77+
78+
-- ############################################################################
79+
-- PART 3: MULTI-RESOURCE SERVICE
80+
-- ############################################################################
81+
82+
CREATE PUBLISHED REST SERVICE PrsTest.CrmAPI (
83+
Path: 'rest/crm/v1',
84+
Version: '1.0.0',
85+
ServiceName: 'CRM API'
86+
)
87+
{
88+
RESOURCE 'orders' {
89+
GET '/' MICROFLOW PrsTest.PRS_GetAllOrders;
90+
}
91+
RESOURCE 'customers' {
92+
GET '/' MICROFLOW PrsTest.PRS_GetCustomers;
93+
}
94+
};
95+
96+
DESCRIBE PUBLISHED REST SERVICE PrsTest.CrmAPI;
97+
98+
-- ############################################################################
99+
-- PART 4: CREATE OR REPLACE
100+
-- ############################################################################
101+
102+
CREATE OR REPLACE PUBLISHED REST SERVICE PrsTest.CrmAPI (
103+
Path: 'rest/crm/v2',
104+
Version: '2.0.0',
105+
ServiceName: 'CRM API v2'
106+
)
107+
{
108+
RESOURCE 'orders' {
109+
GET '/' MICROFLOW PrsTest.PRS_GetAllOrders;
110+
GET '/{id}' MICROFLOW PrsTest.PRS_GetOrderById;
111+
}
112+
RESOURCE 'customers' {
113+
GET '/' MICROFLOW PrsTest.PRS_GetCustomers;
114+
}
115+
};
116+
117+
DESCRIBE PUBLISHED REST SERVICE PrsTest.CrmAPI;
118+
119+
-- ############################################################################
120+
-- PART 5: SHOW AND LIST
121+
-- ############################################################################
122+
123+
SHOW PUBLISHED REST SERVICES;
124+
SHOW PUBLISHED REST SERVICES IN PrsTest;
125+
126+
-- ############################################################################
127+
-- PART 6: DROP
128+
-- ############################################################################
129+
130+
DROP PUBLISHED REST SERVICE PrsTest.OrderAPI;
131+
132+
SHOW PUBLISHED REST SERVICES IN PrsTest;
133+
134+
-- ============================================================================
135+
-- END OF PUBLISHED REST SERVICE EXAMPLES
136+
-- ============================================================================

0 commit comments

Comments
 (0)