mailjet / mailjet-apiv3-java

[API v3] Mailjet Java API Wrapper
https://dev.mailjet.com
MIT License
66 stars 36 forks source link

How to add contact to existing list ? #8

Closed changuelsami closed 9 years ago

changuelsami commented 9 years ago

Hi, I can't figure out how to get contact (email) ID and add it to an existing list (with given ID) ! I foudn this : https://app.mailjet.com/docs/api/lists/addcontact ... but I don't see how can I do it in Java :( Regards :)

arnaudbreton commented 9 years ago

Hi @iset2012,

The documentation you're referring to is for a deprecated version of our API. The current version is here: https://dev.mailjet.com.

The guide which is interesting for you is this one: http://dev.mailjet.com/guides/contact-list-guide/

Hope it helps! Arnaud.

changuelsami commented 9 years ago

Thanks for the answer, but I still can't see how to do it with the java API, I tried the code below but I can't run it :

        ListRecipient c;
        c = client.createCall(ListRecipient.Update)
                .property(ContactProperty.ID, "foo@bar.com")
                .property(ListRecipient.ListID, 1)
                .execute();

There are errors in property method !

arnaudbreton commented 9 years ago

Hey,

Sorry for the delay in my answer. You need to first GET the ListRecipient entity matching your criterias, using the filters ContactEmail and ContactsList. Then, you can update it using the ID you got.

Hope it helps. Arnaud.

arnaudbreton commented 9 years ago

@iset2012, I'm closing this issue for the moment. Don't hesitate to re-open it or open another one if you're still experiencing issues.

Best.