getOffers(String sessionID, String interactionPoint, int numberOfOffers)
|   | 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. | 
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());
| Copyright IBM Corporation 2014. All Rights Reserved. |