getOffers
getOffers(String sessionID, String interactionPoint, int numberOfOffers)
The getOffers method enables you to request offers from the runtime server.
*
sessionID-a string identifying the current session.
*
interactionPoint-a string identifying the name of the interaction point this method references.
*
*
numberOfOffers-an integer identifying the number of offers requested.
The getOffers method waits the number of milliseconds defined in the segmentationMaxWaitTimeInMS property for all re-segmentation to complete before running. Therefore, if you call a postEvent method which triggers a re-segmentation or a setAudience method immediately before a getOffers call, there may be a delay.
Return value
The runtime server responds to getOffers with a Response object with the following attributes populated:
*
*
*
*
*
Example
This example shows requesting a single offer for the Overview Page Banner 1 interaction point and a way to handle the response.
sessionId is the same string to identify the runtime session used by the startSession call which started this session.

String interactionPoint = "Overview Page Banner 1";
int numberRequested=1;

/** Make the call */
response = api.getOffers(sessionId, interactionPoint, numberRequested);

/** Process the response appropriately */
// check if response is successful or not
if(response.getStatusCode() == Response.STATUS_SUCCESS)
{
System.out.println("getOffers call processed with no warnings or errors");

/** Check to see if there are any offers */
OfferList offerList=response.getOfferList();

if(offerList.getRecommendedOffers() != null)
{
for(Offer offer : offerList.getRecommendedOffers())
{
// print offer
System.out.println("Offer Name:"+offer.getOfferName());
}
}
else // count on the default Offer String
System.out.println("Default offer:"+offerList.getDefaultString());
}
else if(response.getStatusCode() == Response.STATUS_WARNING)
{
System.out.println("getOffers call processed with a warning");
}
else
{
System.out.println("getOffers call processed with an error");
}
// For any non-successes, there should be advisory messages explaining why
if(response.getStatusCode() != Response.STATUS_SUCCESS)
printDetailMessageOfWarningOrError("getOffers",
response.getAdvisoryMessages());