Closed AndrewJMiller closed 9 years ago
I was able to add a subscriber to a list in this manner based on https://help.exacttarget.com/en-US/technical_library/web_service_guide/technical_articles/adding_subscribers_to_a_list/
ETResponse
SubscriberList list = new SubscriberList(); list.setList((com.exacttarget.fuelsdk.internal.List) testList.toInternal()); list.setStatus(SubscriberStatus.ACTIVE); list.setId(Integer.parseInt(testList.getId()));
Subscriber subscriber = new com.exacttarget.fuelsdk.internal.Subscriber(); subscriber.setEmailAddress("foo@bar.com"); subscriber.setSubscriberKey("foo@bar.com"); subscriber.getLists().add(list);
Soap soap = client.getSoapConnection().getSoap(); CreateOptions createOptions = new CreateOptions(); SaveOption saveOption = new SaveOption(); saveOption.setSaveAction(SaveAction.UPDATE_ADD); saveOption.setPropertyName("*"); SaveOptions saveOptions = new SaveOptions(); saveOptions.getSaveOption().add(saveOption); createOptions.setSaveOptions(saveOptions);
CreateRequest createRequest = new CreateRequest(); createRequest.getObjects().add(subscriber); createRequest.setOptions(createOptions);
CreateResponse createResponse = soap.create(createRequest);
for(CreateResult result : createResponse.getResults()) { System.out.println("Subscriber Status ::: " + result.getStatusCode() + " " + result.getStatusMessage() ); }
System.out.println("Overall Status ::: " + createResponse.getOverallStatus() );
How do I go about adding a subscriber to a list? I am able to create an ETList and create an ETSubscriber but I don't see how to add the subscriber to a list. I noticed that setList and setAttributes had been commented out on the ETSubscriber class.