🚀 Welcome to MDriven Learn –  Don’t miss the latest Release Notes.
OCLOperators RestDownload


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 a Blob rather than a string, as this may be important if the file received is not representable as a 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.
Error creating thumbnail: File missing






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.

This example uses RestDownload in a ViewModel.

For this example, we use it to download an image and display it in a view model.

Error creating thumbnail: File missing

This is how the above webpage is set up in the view model.

Error creating thumbnail: File missing

In the above view model, we have a variable named 'filedownloaded' that is of type blob. We use the Download button in the view model to trigger an HTTP download request. The ocl used to trigger this download is

filedownloaded:=selfVM.RestDownload('https://techcrunch.com/wp-content/uploads/2026/02/apple-ios-26-beta.jpg?', '', '','')
Error creating thumbnail: File missing

To display the downloaded image, we set the expression to the filedownloaded variable. The ImageTest column on the view model has tagged values of blob type image.