Function

Calls a context function. The response contains the function execution result.

Request

POST /{contextPath}/functions/{function}

Replace {contextPath} with a full context path.

Replace {function} with a function name.

To call a function of the root context, use server as {contextPath}.

Request Header Fields

  • Authorization — Authentication token. For more information about authentication, see Authenticating.

Request Body

A JSON object with function parameters.

If a function has an empty input format (i.e. with no fields in it), pass an empty JSON document ({}) in the request body.

Response Body Fields

  • result — Function result.

Example Request

Request:

   POST https://localhost:8443/rest/v1/contexts/users.admin.devices.virtual/functions/calculate

Example request body JSON:

[
       {
           "leftOperand": 10.0,
           "rightOperand": 20.0,
           "operation": "+"
       }
]

Example response body JSON:

[
       {
           "result": 30
       }
   ]

Was this page helpful?