setAudience(String sessionID, NameValuePairImpl[] audienceID,
String audienceLevel, NameValuePairImpl[] parameters)
![]() |
sessionID - a string identifying the session ID.
|
![]() |
audienceID - an array of NameValuePairImpl objects that defines the audience ID.
|
![]() |
audienceLevel - a string that defines the audience level.
|
![]() |
parameters - NameValuePairImpl objects identifying any parameters that need to be passed with setAudience. These values are stored in the session data and can be used for segmentation.
|
NameValuePair custId2 = new NameValuePairImpl();
custId2.setName("CustomerId");
custId2.setValueAsNumeric(123.0);
custId2.setValueDataType(NameValuePair.DATA_TYPE_NUMERIC);
NameValuePair[] newAudienceId = { custId2 };
/** Parameters can be passed in as well. For this example, there are no parameters,
* therefore pass in null */
NameValuePair[] noParameters=null;
/** Make the call */
response = api.setAudience(sessionId, newAudienceId, audienceLevel, noParameters);
/** Process the response appropriately */
// check if response is successful or not
if(response.getStatusCode() == Response.STATUS_SUCCESS)
{
System.out.println("setAudience call processed with no warnings or errors");
}
else if(response.getStatusCode() == Response.STATUS_WARNING)
{
System.out.println("setAudience call processed with a warning");
}
else
{
System.out.println("setAudience call processed with an error");
}
// For any non-successes, there should be advisory messages explaining why
if(response.getStatusCode() != Response.STATUS_SUCCESS)
printDetailMessageOfWarningOrError("setAudience",
response.getAdvisoryMessages());
Copyright IBM Corporation 2014. All Rights Reserved.
|