RestAllowed lets you enable REST access to a ViewModel for clients that call the MDriven REST endpoint.
What RestAllowed controls
Span.Eco.RestAllowed is a setting on a ViewModel. Set it to true when that ViewModel must be accessed through the REST API.
The default value is false. A ViewModel whose RestAllowed setting remains false is not available through the REST API backed by that view.
| Setting | Default | Effect |
|---|---|---|
RestAllowed
|
false
|
Allows the ViewModel to be accessed through REST when set to true.
|
| UIAllowed | true
|
Allows a user to reach the ViewModel through the UI when set to true.
|
Enable REST access for a ViewModel
- Open the ViewModel that will provide the REST operation.
- Select the ViewModel and find its
Span.Eco.RestAllowedsetting. - Set
RestAllowedtotrue. - Save the model and deploy or run the application with the updated model.
- Call the REST endpoint using the ViewModel command name.
For example, if the REST-enabled ViewModel command is ViewOneThing, these URL forms access its Get operation:
http://localhost:5052/TurnkeyRest/Get?command=ViewOneThing&id=11!1
http://localhost:5052/Rest/ViewOneThing/Get?id=11!1
http://localhost:5052/Rest/ViewOneThing/Get/11!1
In this example, ViewOneThing is the ViewModel command and 11!1 is the supplied id value.
Use RestAllowed with UIAllowed
RestAllowed and UIAllowed control different access paths. Enabling REST does not mean that the ViewModel must be visible in the UI.
A common REST-only pattern is:
- Set
RestAllowedtotrueso REST clients can call the ViewModel. - Set
UIAllowedtofalseso users cannot reach that page through the UI.
For example, use this pattern for a ViewModel intended to return data to an integration client rather than present a screen to a user.
If the same ViewModel must be available both as a Turnkey Web UI page and as a REST endpoint, set both RestAllowed and UIAllowed to true.
Troubleshooting
| Symptom | Check |
|---|---|
| A REST call cannot access a ViewModel. | Confirm that Span.Eco.RestAllowed is set to true on that ViewModel.
|
| A ViewModel is reachable through REST but should not be opened by users. | Set UIAllowed to false.
|
| A ViewModel should appear in Turnkey Web UI but does not. | Confirm that UIAllowed is explicitly enabled for the ViewModel. |
