2

I have successfully been able to create Subscribers using the Java API which fall under 'All subscribers'. What I would like to be able to do is create a subscriber and add the subscriber to a specific list at the same time.

According to the documentation it is possible by using SubscriberList and the setID() method.
Therefore, I am attempting to use the suggested method e.g. subscriberList.setID(12345).

However, it doesn't appear in the SOAP call and therefore I am getting an error code: 13000 - list could not be found. The SubscriberList class doesn't have an ID property and I'm not sure whether this may be the cause.

Below is the relevant part of my code:

SubscriberList subscriberList = new SubscriberList();
subscriberList.setID(354417);
subscriberList.setStatus(SubscriberStatus.ACTIVE);
subscriber.getLists().add(subscriberList);

The SOAP request generated is:

<ns2:Objects xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:Subscriber">
<ns2:EmailAddress>example@example.com</ns2:EmailAddress>
<ns2:Attributes>
<ns2:Name>Full Name</ns2:Name>
<ns2:Value>Test Name</ns2:Value>
</ns2:Attributes>
<ns2:SubscriberKey>example@example.com</ns2:SubscriberKey>
<ns2:Status>Active</ns2:Status>
<ns2:Lists>
<ns2:Status>Active</ns2:Status>
</ns2:Lists>
</ns2:Objects>
</ns2:CreateRequest>
</SOAP-ENV:Body>
Action: "Create"
Response :::Error13000

Notice the ID element is missing in Lists even though I am using the setID() method.

I would appreciate any help on this.

Thanks

0

I had a very similar issue and resolved it by modifying the generated classes Subscriber and SubscriberList.

The problem being that for the element, , found in Subscriber, the type used in the generated code was java.util.List when it should have been "SubscriberList". Also, to get the ID value to appear in the resulting XML, I had to override the getID method in "SubscriberList" as well as annotate that override with @XmlElement and then add the field to the "propOrder" attribute of the @XmlType annotation on the class.

Hope this helps.

  • I had actually attempted to add a getID method to the SubscriberList class and everything else. It didn't work at first but now that I have added it as an override method as you suggested, it seems to be working. Thank you for your help :) – Marco Nov 19 '14 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.