🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators RestDelete
This page was created by Stephanie on 2024-06-04. Last edited by Wikiadmin on 2026-07-29.

You can use RestDelete in a ViewModel action to send an HTTP DELETE request to an external REST service and capture the service response.

Availability

RestDelete is an OCL/EAL REST operator on selfVM. It is available only in the ViewModel context.

Use it when the external service expects an HTTP DELETE request for a resource URL. For example, a service may expose an item at https://service.example/items/123; your action sends DELETE to that URL to request removal of item 123.

For an overview of calling external services from MDriven, see Documentation:Rest Services In MDriven.

Syntax

selfVM.RestDelete(targeturl, user, pwd, optionalnestingwithheaders)
Argument Description
targeturl The URL of the REST resource to delete. Include any required path segments or query parameters in the URL.
user The user argument supplied to the REST call. Use an empty string when the service does not require a value here.
pwd The password argument supplied to the REST call. Use an empty string when the service does not require a value here.
optionalnestingwithheaders The name, as an OCL string, of a blue ViewModel nesting that provides request headers. Use an empty string when no headers are needed.

Delete a resource

  1. In MDriven Designer, open the ViewModel that performs the integration.
  2. Add or open the action that will issue the DELETE request.
  3. Call RestDelete on selfVM and assign the returned response body to a variable.
  4. Use the target URL for the specific resource that the external service should delete.
vResult := selfVM.RestDelete('https://mdriven.free.beeceptor.com/api/dummy-data', '', '', '')

In this example, vResult receives the body returned by the server. Both credential arguments and the header-nesting argument are empty because the call does not provide them.

Send request headers

If the service requires request headers, create a blue ViewModel nesting and pass its name as the fourth argument. Header columns follow the REST header conventions documented on RestPost. For example, a column named DEFAULTREQUESTHEADER_xxx adds a request header named xxx; DEFAULTREQUESTHEADERMINUS_xxx converts underscores in the header name to dashes.

Pass the nesting name as a string:

vResult := selfVM.RestDelete('https://service.example/items/123', '', '', 'RequestHeaders')

Here, RequestHeaders is the name of the ViewModel nesting that contains the header values. Keep the header configuration in that nesting rather than trying to add headers to the URL.

Request content

DELETE is used to request deletion of a resource. The REST content conventions such as STRINGCONTENT, BYTEARRAYCONTENT, multipart fields, and URL-encoded content apply to REST POST and PUT requests; content can only be sent with POST and PUT. Do not use those content columns to expect a DELETE request body.

Related REST operators

Use the operator that matches the HTTP operation required by the external service:

Need Operator
Retrieve information RestGet
Send information to a service RestPost
Delete a resource RestDelete

See also