endSession

The endSession method marks the end of the runtime session. When the runtime server receives this method, the runtime server logs to history, clears memory, and so on.

endSession(String sessionID, NameValuePair[] parameters)
  • sessionID - Unique string identifying the session.
  • parameters - NameValuePair objects identifying any parameters that are required to be passed with the API request.

If the endSession method is not called, runtime sessions timeout. The timeout period is configurable with the sessionTimeout property.

Return value

The runtime server responds to the endSession method with the Response object with the following attributes populated:

  • SessionID
  • ApiVersion
  • StatusCode
  • AdvisoryMessages

Example

The following example shows the endSession method and how you can parse the response. sessionId is the same string to identify the session used by the startSession call which started this session.

response = api.endSession(sessionId);
    // check if response is successful or not
    if(response.getStatusCode() == Response.STATUS_SUCCESS)
    {
        System.out.println("endSession call processed with no warnings or errors");
    }
    else if(response.getStatusCode() == Response.STATUS_WARNING)
    {
        System.out.println("endSession call processed with a warning");
    }
    else
    {
        System.out.println("endSession call processed with an error");
    }
    // For any non-successes, there should be advisory messages explaining why
    if(response.getStatusCode() != Response.STATUS_SUCCESS)
        printDetailMessageOfWarningOrError("endSession",
			response.getAdvisoryMessages());