getOffers(String sessionID, String interactionPoint, int numberOfOffers)
![]() |
sessionID - 用于标识当前会话的字符串。
|
![]() |
interactionPoint - 字符串,用于标识此方法引用的交互点的名称。
|
![]() |
numberOfOffers - 用于标识请求的商品数量的整数。
|
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 2013. All Rights Reserved.
|