REST prerequisites

One method of calling the Unica Interact API is by using JSON (JavaScript Object Notation) format calls over HTTP, referred to here as the REST API. The REST API has the advantage of having better performance than SOAP, although the Java serialization adapter is still the fastest method for Unica Interact API calls.

Before you begin using the REST API, be aware of the following:

  • The URL that supports REST calls to the Unica Interact API is:

    http://Unica Interact_Runtime_Server:PORT/interact/servlet/RestServlet, substituting the actual host name or IP address of the Unica Interact runtime server and the port on which Unica Interact is deployed.

  • There are two Unica Interact classes specific to the REST API: RestClientConnector, which serves as a helper to connect to an Unica Interact run time instance via REST with the format of JSON, and RestFieldConstants, which describes the underlying format of the JSON message that is used for API requests and responses.

  • A sample REST client is provided at Unica Interact _Home/samples/javaApi/InteractRestClient.java. Although the sample code is a simple example, it should provide a good starting point for demonstrating how the REST API is used.

  • For a complete description of the REST API classes along with all other Unica Interact API information, see the Javadoc installed on the runtime server at Unica Interact_Home/docs/apiJavaDoc.

  • The REST API returns SessionIDs and messages in the HTML-escaped format and not in the Unicode format.
  • If API Authentication is enabled, then need to pass credentials or token in the request header.
    • Input Header Parameters
      • Credentials
        • m_user_name
        • Header Parameter — Platform username
        • m_user_password
        • Header Parameter — Platform user password
      • Token
        • m_tokenId
        • Header Parameter — token
    • Output Header Parameters
      • m_tokenId
      • Header Parameter — token

Other than the information mentioned here, the REST API supports all of the methods that are supported by the other protocols for using the Unica Interact API.