Add subscriber problems - JAVA

Hi all,

I'm using the wrapper and I recive the clients list without problems. Now, I´m trying to use the API to add subscribers one by one and the API returns 401 error (Unauthorized)

My code:

public static void main(String[] args) throws CreateSendException {
    SubscriberToAdd subscriber = new SubscriberToAdd();
    subscriber.ListID = /* the list code */;
        subscriber.EmailAddress = "";
        subscriber.Name = "Pepe";
        subscriber.Date = new Date();
        subscriber.State = false;
        subscriber.CustomFields = null;
        subscriber.ReadsEmailWith = "";
        subscriber.Resubscribe = false;
        subscriber.RestartSubscriptionBasedAutoresponders = false;

        JerseyClient jerseyClient = new JerseyClientImpl( /* the api key*/ );
        Subscribers subscribers = new Subscribers(/* the list code */, jerseyClient);

I appreciate any help, regards

Phil Phil, 4 years ago


Without having an ApiKey so i can look through your logs, my most likely guess is that you're taking your listID from the URL on the web application, rather than the "change name/type" link from the list detail page..

Check out the documentation, if that rather weak explanation doesn't make sense.

If that isn't your issue, you might have to contact support with enough information so we can identify your account and search the logs.

1q2w3e4r, 4 years ago

Thanks, it was the problem

See why 200,000 companies worldwide love Campaign Monitor.

From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that boost the bottom line.

Get started for free