Developer Documentation Library > Interviewer - Server > UNICOM Intelligence Interviewer architecture > Web Service tier > Interview Web Service > Calling functions
 
Calling functions
The Interview Web Service also allows function to be called within the interview routing script. The Interview Object Model (IOM) must first be informed of the functions that are callable. For example, to inform IOM that IsValidResponse is a valid function:
IOM.PublicFunctions.Add(“IsValidResponse”)

Function IsValidResponse(QuestionFullName, Response)
  ' Some calculations
  IsValidResponse = True
End Function
All arguments are assumed to be Text. The routing script function must convert the argument to the expected type (for example, Result = CLong(ParameterA)/CLong(ParameterB)).
The function parameters need to be POSTed to the URL. For example:
{
  "Arguments": {
    " Argument": [
      {
        "Name": "QuestionFullName",
        "Value": "PhoneNumber"
      },
      {
        "Name": "Response",
        "Value": "555-443-2234"
      }
    ]
  }
}
The POST response contains the function call results. For example:
{
  "true"
}
Using format=xml as a query parameter can be used to retrieve the response as XML instead of JSON.
See also
Interview Web Service