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 = "pepe@test.com";
        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);
        subscribers.add(subscriber);
}

I appreciate any help, regards

Phil Phil, 1 year ago

G'day,

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, 1 year ago

Thanks, it was the problem

Sign up for free.
Then send campaigns for as little as $9p/m

Create an account