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.
|