🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Span.Eco.RestAllowed
This page was created by Stephanie on 2023-05-18. Last edited by Wikiadmin on 2026-07-29.

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

  1. Open the ViewModel that will provide the REST operation.
  2. Select the ViewModel and find its Span.Eco.RestAllowed setting.
  3. Set RestAllowed to true.
  4. Save the model and deploy or run the application with the updated model.
  5. 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 RestAllowed to true so REST clients can call the ViewModel.
  • Set UIAllowed to false so 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.

See also