startSession(String sessionID, 
boolean relyOnExistingSession,
boolean debug,
String interactiveChannel,
NameValuePairImpl[] audienceID,
String audienceLevel,
NameValuePairImpl[] parameters)
The startSession method creates and defines a runtime session. startSession can trigger up to five actions:
load offer suppression data into the session, if the enableOfferSuppressionLookup property is set to true.
load score override data into the session, if the enableScoreOverrideLookup property is set to true.
The startSession method requires the following parameters:
sessionID-a string which identifies the session ID. You must define the session ID. For example, you could use a combination of customer ID and timestamp.
To define what makes a runtime session, a session id has to be specified. This value is managed by the client. All method calls for the same session id has to be synchronized by the client. The behavior for concurrent API calls with the same session id is undefined.
relyOnExistingSession - a boolean which defines whether this session uses a new or an existing session. Valid values are true or false. If true, you must supply an existing session ID with the startSession method. If false, you must supply a new session ID.
If you set relyOnExistingSession to true and a session exists, the runtime environment uses the existing session data and does not reload any data or trigger segmentation. If the session does not exist, the runtime environment creates a new session, including loading data and triggering segmentation. Setting relyOnExistingSession to true and using it with all startSession calls is useful if your touchpoint has a longer session length than the runtime session. For example, a web site session is alive for 2 hours, but the runtime session is only alive for 20 minutes.
If you call startSession twice with the same session ID, all session data from the first startSession call is lost if relyOnExistingSession is false.
debug - a boolean which enables or disables debug information. Valid values are true or false. If true, Interact logs debug information to the runtime server logs. The debug flag is set for each session individually. Therefore, you can trace debug data for an individual session.
interactiveChannel-a string defining the name of the interactive channel this session refers to. This name must match the name of the interactive channel defined in Campaign exactly.
audienceID - an array of NameValuePairImpl objects where the names must match the physical column names of any table containing the audience ID.
audienceLevel - a string defining the audience level.
parameters - NameValuePairImpl objects identifying any parameters that need to be passed with startSession. These values are stored in the session data and can be used for segmentation.
If you have several interactive flowcharts for the same audience level, you must include a superset of all columns in all the tables. If you configure the runtime to load the profile table, and the profile table contains all the columns you require, you do not need to pass any parameters, unless you want to overwrite the data in the profile table. If your profile table contains a subset of the required columns, you must include the missing columns as parameters.
If the audienceID or audienceLevel are invalid and relyOnExistingSession is false, the startSession call fails. If the interactiveChannel is invalid, startSession fails, whether relyOnExistingSession is true or false.
If relyOnExistingSession is true, and you make a second startSession call using the same sessionID, but the first session has expired, Interact creates a new session.
If relyOnExistingSession is true, and you make a second startSession call using the same sessionID but a different audienceID or audienceLevel, the runtime server changes the audience for the existing session.
If relyOnExistingSession is true, and you make a second startSession call using the same sessionID but a different interactiveChannel, the runtime server creates a new session.
Return value
The runtime server responds to startSession with a Response object with the following attributes populated:
The following example shows one way to call startSession.
String sessionId="MySessionID-123";
String audienceLevel="Customer";
NameValuePair custId = new NameValuePairImpl();
NameValuePair[] initialAudienceId = { custId };
boolean relyOnExistingSession=false;
boolean initialDebugFlag=true;
String interactiveChannel="Accounts Website";
NameValuePair parm1 = new NameValuePairImpl();

NameValuePair parm2 = new NameValuePairImpl();
parm2.setValueAsDate(new Date());

NameValuePair parm3 = new NameValuePairImpl();

NameValuePair parm4 = new NameValuePairImpl();

NameValuePair parm5 = new NameValuePairImpl();

NameValuePair parm6 = new NameValuePairImpl();

/** Specifying the parameters (optional) */
NameValuePair[] initialParameters = { parm1,

/** Make the call */
response = api.startSession(sessionId, relyOnExistingSession, initialDebugFlag,
interactiveChannel, initialAudienceId, audienceLevel, initialParameters);

/** Process the response appropriately */
processStartSessionResponse is a method which handles the response object returned by startSession.
public static void processStartSessionResponse(Response response)
// check if response is successful or not
if(response.getStatusCode() == Response.STATUS_SUCCESS)
System.out.println("startSession call processed with no warnings or errors");
else if(response.getStatusCode() == Response.STATUS_WARNING)
System.out.println("startSession call processed with a warning");
System.out.println("startSession call processed with an error");

// For any non-successes, there should be advisory messages explaining why
if(response.getStatusCode() != Response.STATUS_SUCCESS)