Skip to main content
Published: September 22 2005, 2:28:00 PMUpdated: November 28 2020, 1:30:52 PM

How do I set Notififcation Preferences?

In order to sign up your users for notifications, you need to enable notifications for each user. Below is a snippet of Java code that uses the Java SDK to set notification preferences for Outbid and EOA. Note that preferences are set for the user represented by the eBayAuthToken, therefore you must have valid tokens for all users who you wish to subscribe. The generated SOAP request and response are also shown.

// Setup the ApiContext
String baseURL = "https://api.sandbox.ebay.com/wsapi";
String developerCode = "Set your DevCode";
String applicationCode = "Set your AppCode";
String certCode = "Set your CertCode";
String eBayToken = "Set the User's Token Here";
ApiContext apiContext = new ApiContext();
ApiAccount apiAccount = new ApiAccount();
ApiCredential apiCredential = new ApiCredential();

// Set apiAccount params
apiAccount.setDeveloper(developerCode);
apiAccount.setApplication(applicationCode);
apiAccount.setCertificate(certCode);

// Set apiCredential params
apiCredential.seteBayToken(eBayToken);
apiCredential.setApiAccount(apiAccount);

// Set apiContext params
apiContext.setApiCredential(apiCredential);
apiContext.setApiServerUrl(baseURL);

// turn on logging to standard out
ApiLogging logging = new ApiLogging();
logging.setEnableLogging(true);
logging.setLogSOAPMessages(true);
logging.setLogExceptions(true);
apiContext.setApiLogging(logging);

// New SetNotificationPreferences Call
SetNotificationPreferencesCall api = new SetNotificationPreferencesCall(apiContext);

// Create and Set the User Level OutBid Preference
NotificationEnableType OutBidEnable = new NotificationEnableType();
OutBidEnable.setEventEnable(EnableCodeType.Enable);
OutBidEnable.setEventType(NotificationEventTypeCodeType.OutBid);

// Create and Set the User Level EOA Preference
NotificationEnableType EOAEnable = new NotificationEnableType();
EOAEnable.setEventEnable(EnableCodeType.Enable);
EOAEnable.setEventType(NotificationEventTypeCodeType.EndOfAuction);

// Create a NotificationEnableArrayType for the User Deliver Preferences
NotificationEnableArrayType notifyEnableArray = new NotificationEnableArrayType();
api.setUserDeliveryPreferenceArray(notifyEnableArray);
notifyEnableArray.setNotificationEnable(new NotificationEnableType[] {
OutBidEnable,
EOAEnable });

// Make the Call
api.setNotificationPreferences();


SOAP LOG
----------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<ebl:RequesterCredentials soapenv:mustUnderstand="0" xmlns:ebl="urn:ebay:apis:eBLBaseComponents">
<ebl:eBayAuthToken xmlns:ebl="urn:ebay:apis:eBLBaseComponents">***</ebl:eBayAuthToken>
</ebl:RequesterCredentials>
<ebl:RequesterCredentials soapenv:mustUnderstand="0" xmlns:api="urn:ebay:apis:eBLBaseComponents" xmlns:ebl="urn:ebay:apis:eBLBaseComponents">
<ebl:Credentials xmlns:ebl="urn:ebay:apis:eBLBaseComponents">
<ebl:AppId xmlns:ebl="urn:ebay:apis:eBLBaseComponents">***</ebl:AppId>
<ebl:DevId xmlns:ebl="urn:ebay:apis:eBLBaseComponents">***;</ebl:DevId>
<ebl:AuthCert xmlns:ebl="urn:ebay:apis:eBLBaseComponents">***;</ebl:AuthCert>
</ebl:Credentials>
</ebl:RequesterCredentials>
</soapenv:Header>
<soapenv:Body>
<SetNotificationPreferencesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<DetailLevel>ReturnAll</DetailLevel>
<Version>549</Version>
<UserDeliveryPreferenceArray>
<NotificationEnable>
<EventType>OutBid</EventType>
<EventEnable>Enable</EventEnable>
</NotificationEnable>
<NotificationEnable>
<EventType>EndOfAuction</EventType>
<EventEnable>Enable</EventEnable>
</NotificationEnable>
</UserDeliveryPreferenceArray>
</SetNotificationPreferencesRequest>
</soapenv:Body>
</soapenv:Envelope>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<SetNotificationPreferencesResponse xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2008-03-03T20:55:04.789Z</Timestamp>
<Ack>Success</Ack>
<CorrelationID>00000000-00000000-00000000-00000000-00000000-00000000-0000000000</CorrelationID>
<Version>553</Version>
<Build>e553_core_Bundled_6126319_R1</Build>
</SetNotificationPreferencesResponse>
</soapenv:Body>
</soapenv:Envelope>

How well did this answer your question?
Answers others found helpful