You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**IMPORTANT**: `$Variable` references in authentication (e.g., `USERNAME = $MyConstant`) are serialized as `Rest$ConstantValue` and require the constant to exist in the project. Use literal strings in examples to avoid CE7073.
37
+
38
+
### Operations
39
+
40
+
Each operation defines one HTTP endpoint call:
41
+
42
+
```sql
43
+
OPERATION OperationName
44
+
METHOD GET|POST|PUT|PATCH|DELETE
45
+
PATH'/path/{paramName}'
46
+
[PARAMETER $paramName: Type] -- Path parameters
47
+
[QUERY $queryParam: Type] -- Query parameters
48
+
[HEADER 'Name'='value'] -- HTTP headers
49
+
[BODY JSON FROM $Variable] -- Request body (POST/PUT/PATCH)
50
+
[BODY FILE FROM $Variable] -- File upload
51
+
[TIMEOUT seconds] -- Default: 300
52
+
RESPONSE NONE|JSON AS $var|STRING AS $var|FILE AS $var|STATUS AS $var;
53
+
```
54
+
55
+
### Mendix Validation Rules (mx check)
56
+
57
+
Follow these rules to avoid errors from `mx check`:
58
+
59
+
| Rule | Error | Fix |
60
+
|------|-------|-----|
61
+
| Every operation MUST have an Accept header | CE7062 | Auto-added by serializer (`Accept: */*`) if missing |
62
+
| POST/PUT/PATCH MUST have a body | CE7064 | Auto-added by serializer (empty JSON body) |
63
+
| Dynamic header values (`'Bearer ' + $Token`) are NOT supported | CE7056 | Use static literal values only |
64
+
| Auth with `$Variable` requires the constant to exist | CE7073 | Use literal strings or create constants first |
65
+
| RESPONSE JSON requires entity mapping for full functionality | CE0061 | Configure entity mapping in Studio Pro after creation |
66
+
67
+
### Response Handling
68
+
69
+
The serializer uses `Rest$NoResponseHandling` with ContentType for all response types to avoid CE0061 (entity mapping requirement). This means:
70
+
71
+
-**RESPONSE NONE** → `Rest$NoResponseHandling` (no ContentType)
72
+
-**RESPONSE JSON** → `Rest$NoResponseHandling` with `ContentType: "application/json"`
73
+
-**RESPONSE STRING** → `Rest$NoResponseHandling` with `ContentType: "text/plain"`
74
+
-**RESPONSE FILE** → `Rest$NoResponseHandling` with `ContentType: "application/octet-stream"`
75
+
76
+
For full JSON-to-entity mapping (`Rest$ImplicitMappingResponseHandling`), configure the response mapping in Studio Pro. This requires:
77
+
1. A non-persistent entity to hold the response data
78
+
2. An `ImportMappings$ObjectMappingElement` mapping JSON fields to entity attributes
79
+
80
+
## SEND REST REQUEST (Microflow Activity)
81
+
82
+
Calls a consumed REST service operation from a microflow. This creates a `Microflows$RestOperationCallAction` in the BSON.
### CRITICAL: `$latestHttpResponse` System Variable
97
+
98
+
After every `SEND REST REQUEST`, Mendix automatically populates `$latestHttpResponse` (type `System.HttpResponse`). **Always use this to check call success**:
`REST CALL` is a separate feature for direct HTTP calls without a REST client document. URL, headers, auth, and body are specified inline in the microflow. See the write-microflows skill for full syntax.
123
+
124
+
Do NOT mix up:
125
+
-`SEND REST REQUEST` → calls consumed REST service operation (`Microflows$RestOperationCallAction`)
0 commit comments