🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators RestHead
This page was created by Vale.buyondo on 2026-03-02. Last edited by Wikiadmin on 2026-07-29.

RestHead lets you send an HTTP HEAD request from an EAL action in a ViewModel when you need to contact a REST endpoint without downloading its response body.

What RestHead does

RestHead performs an HTTP HEAD request to a URL. A HEAD request is equivalent to a GET request in that the server processes the request and returns an HTTP response, but the response contains headers and no response body.

Use RestHead when the endpoint supports HEAD and you need to make a lightweight request, for example to:

  • Check whether a resource is available by evaluating the HTTP status code.
  • Request response metadata such as Content-Length, Content-Type, or Last-Modified.
  • Check that an API endpoint is reachable without downloading its data.
  • Test authentication handling before making a request that retrieves a body.

For a request that retrieves the response body, use RestGet instead.

Use RestHead in an EAL action

Use RestHead on the selfVM variable inside an EAL action on a ViewModel.

selfVM.RestHead('https://yourapi.com/endpoint','','','YourNestingName')

In this example, the request is sent to https://yourapi.com/endpoint. The request is a HEAD request, so the server returns response headers rather than the endpoint's normal response body.

Example: request a resource without downloading it

The following EAL expression requests the headers for a user resource:

selfVM.RestHead('https://api.example.com/users/12345','','','')

Use this pattern when the server provides HEAD support and you do not need the user data itself. If you need the user data returned by the endpoint, use RestGet with the same resource URL.

RestHead compared with RestGet

Operator HTTP method Response content Typical use
RestHead HEAD Headers; no response body Check endpoint availability or request metadata without transferring resource data
RestGet GET Response body returned by the server Retrieve data from a REST endpoint

Important considerations

  • The target server must support the HTTP HEAD method for the endpoint you call.
  • A successful network connection does not by itself establish that the requested resource is available or that authentication succeeded; evaluate the HTTP response information made available by your action design.
  • HEAD responses do not contain the resource body. Do not use RestHead when your action needs JSON, text, or other endpoint data.
  • Keep URLs and any authentication values appropriate to the environment in which the ViewModel action runs.

Related operators

RestGet sends a GET request when you need the response body. For other OCL operators, use the OCL editor to inspect the operators available for the current class, as described in OCL General Operators.

See also