RestDownload is an operator that instructs the client (typically a web browser) to navigate to a specific REST endpoint and treat the response as a file download.
RestDownload returns as a Blob and not a string as this may be important if the file received is not representable as string.
The RestDownload uses a Get-request.
If you need to download binary data as RestPost, use the nesting param base64ReturnStream column name with a value of true, then use RestPost(...).Bas64ToBlob
Syntax
selfVM.RestDownload(Url: String)
Example
To ensure a successful file download, the following two-step verification process was used:
1. Data Modeling & Storage
A Resources class was designed to store binary files using the Blob data type.
- Attributes:
Image: Blob?,Image_ContentType: String?, andImage_FileName: String?. - Logic: This structure allows the MDriven Server to serve the correct file type and name during a request
2. API Verification (Postman Phase)
Before implementing the UI button, the endpoint was verified in Postman to ensure the server correctly streams the binary data.
- Test URL:
http://localhost:8182/GetExpectedImg/[GUID]/download. - Verification: Postman returned a
200 OKand rendered a preview of the "MDriven Staff Meeting" image, proving the binary stream is accessible via the unique GUID.
See also: OCLOperators RestPost
Example2.
Using RestDownload in a ViewModel.
For this example We use it to download an image and display it in a view model.
This is how the above webpage is setup in the view model.
In the above view model We have are variable named 'filedownloaded' that is of type blob. We use the Download button in the view model to trigger an http download reguest. The ocl used to trigger this download is
filedownloaded:=selfVM.RestDownload('https://techcrunch.com/wp-content/uploads/2026/02/apple-ios-26-beta.jpg?', '', '','')To display the downloaded image we set the expression to filedownloaded variable. The ImageTest column on the view model has tagged values of blob type image.
