startSession(String sessionID,
boolean relyOnExistingSession,
boolean debug,
String interactiveChannel,
NameValuePairImpl[] audienceID,
String audienceLevel,
NameValuePairImpl[] parameters)
![]() |
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.
|
![]() |
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.
|
![]() |
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.
|
![]() |
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.
|
String sessionId="MySessionID-123";
String audienceLevel="Customer";
NameValuePair custId = new NameValuePairImpl();
custId.setName("CustomerId");
custId.setValueAsNumeric(1.0);
custId.setValueDataType(NameValuePair.DATA_TYPE_NUMERIC);
NameValuePair[] initialAudienceId = { custId };
boolean relyOnExistingSession=false;
boolean initialDebugFlag=true;
String interactiveChannel="Accounts Website";
NameValuePair parm1 = new NameValuePairImpl();
parm1.setName("SearchString");
parm1.setValueAsString("");
parm1.setValueDataType(NameValuePair.DATA_TYPE_STRING);
NameValuePair parm2 = new NameValuePairImpl();
parm2.setName("TimeStamp");
parm2.setValueAsDate(new Date());
parm2.setValueDataType(NameValuePair.DATA_TYPE_DATETIME);
NameValuePair parm3 = new NameValuePairImpl();
parm3.setName("Browser");
parm3.setValueAsString("IE6");
parm3.setValueDataType(NameValuePair.DATA_TYPE_STRING);
NameValuePair parm4 = new NameValuePairImpl();
parm4.setName("FlashEnabled");
parm4.setValueAsNumeric(1.0);
parm4.setValueDataType(NameValuePair.DATA_TYPE_NUMERIC);
NameValuePair parm5 = new NameValuePairImpl();
parm5.setName("TxAcctValueChange");
parm5.setValueAsNumeric(0.0);
parm5.setValueDataType(NameValuePair.DATA_TYPE_NUMERIC);
NameValuePair parm6 = new NameValuePairImpl();
parm6.setName("PageTopic");
parm6.setValueAsString("");
parm6.setValueDataType(NameValuePair.DATA_TYPE_STRING);
/** Specifying the parameters (optional) */
NameValuePair[] initialParameters = { parm1,
parm2,
parm3,
parm4,
parm5,
parm6
};
/** Make the call */
response = api.startSession(sessionId, relyOnExistingSession, initialDebugFlag,
interactiveChannel, initialAudienceId, audienceLevel, initialParameters);
/** Process the response appropriately */
processStartSessionResponse(response);
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");
}
else
{
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)
printDetailMessageOfWarningOrError("StartSession",
response.getAdvisoryMessages());
}
Copyright IBM Corporation 2014. All Rights Reserved.
|