🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators RestDownload
Created by Hans.karlsen on 2017-09-29 · Last edited by Peter.byaruhanga on 2026-02-22.


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?, and Image_FileName: String?.
  • Logic: This structure allows the MDriven Server to serve the correct file type and name during a request
Documentation OCLOperators RestDownload 1771685761410.png









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 OK and 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.

restdownloadwebpage.png

This is how the above webpage is setup in the view model.

restdownloadviewmodel.png

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?', '', '','')
filedownloadimage.png

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.