This page was created by Stephanie on 2025-01-09. Last edited by 62.169.16.147 on 2026-09-12.
RestPatch allows you to update fields on an existing object via a REST API call in MDriven. It maps to the HTTP PATCH method and is enabled on a ViewModel when Eco.RestAllowed is set to True.
Send the fields you want to update as key value pairs in the request body. Only the fields you include will be updated other fields are left unchanged.
Example using form-data in Postman:
Key
Value
title
Updated Title
Multiple fields can be updated in a single request by adding more key-value pairs.
The response will reflect thecomputed value, not the raw stored value. In the example above, patching title with "Updated Title" would return "Updated Title" in the response. This is expected behavior the underlying data is updated correctly, the display expression is just applied on top.
Before creating a ViewModel, you need a domain class in the MDriven Designer that represents the data you want to expose. In this example that is the Articles1 class, which has attributes like author, title, content, publishedAt, and urlToImage.
You can see the full model in the designer Articles1 sits at the center, connected to Source1 via a source association, and to APIResult via an articles association.
Step 2: Create a ViewModel and Root It to Your Class[edit source]
In the ViewModel Editor, create a new ViewModel and set its Class to the domain class you want to expose in this case Articles1. This is done in the Properties panel on the right side of the ViewModel Editor.
<Name: ArticleViewModel
Class: Articles1
This "roots" the ViewModel to Articles1, meaning the REST endpoint will operate on instances of that class.
Note: If a field uses a computed OCL expression like 'By ' + self.author, the REST response will return the computed value, not the raw stored value. Keep fields as direct mappings like self.title if you want clean PATCH behaviour.
Step 4: Enable Eco.RestAllowed via Tagged Values[edit source]
This is the key step that exposes the ViewModel as a REST endpoint.
Click Tagged values in the top-right of the ViewModel Editor
In the Tagged Values dialog, you will see a Value Store at the bottom listing all available tags
Setting Eco.RestAllowed to True is what registers the ViewModel as a REST endpoint. Without this, no REST operations (GET, PATCH, POST, DELETE) will be available on the ViewModel.