GithubHelp home page GithubHelp logo

Comments (12)

WeshGuillaume avatar WeshGuillaume commented on June 7, 2024

Hey ! ✈️

I indeed need to implement a distinction between Filters and properties in the wrapper. You cannot POST/PUT with filters. You can see the props/filters here at the moment: http://dev.mailjet.com/email-api/v3/listrecipient/

Could you try to see the PUT results with cUrl ? I think when you make a PUT without changing anything, it sends a non-json 304 response, and the Wrapper does not support non-json response yet. Its actually a bug

from mailjet-apiv3-java.

sicoa avatar sicoa commented on June 7, 2024

Hi there sir
thank you once more for the reply

  1. Attribute issue
  2. Create issue
  3. Update issue
  4. Delete issue
    I did not use filters.

from mailjet-apiv3-java.

WeshGuillaume avatar WeshGuillaume commented on June 7, 2024

Hey there!
Contactslist is not a valid property: http://dev.mailjet.com/email-api/v3/listrecipient/

You can simply create a list via different endpoints:

http://dev.mailjet.com/email-api/v3/contact-managecontactslists/
http://dev.mailjet.com/email-api/v3/contact-managemanycontacts/
http://dev.mailjet.com/email-api/v3/contactslist-managecontact/
http://dev.mailjet.com/email-api/v3/contactslist-managemanycontacts/

Listrecipient is not a stable way of doing the job. We didn't even featured it in the API guide

The update is I guess a 304 error that don't send any JSON back (I need to fix that): it means that the content has not been changed because the payload was not changing anything. Can you make sure with debug logging ?

from mailjet-apiv3-java.

sicoa avatar sicoa commented on June 7, 2024

Greetings
some comments:
I did not understand your last reply to be honest. I was talking about Listrecipients, not ContactsList.
Although for some reason when trying to list the Listrecipients, the request shows a JSON with Contactslist for resource (issue in here no2).

Secondly, i did not understand why Listrecipientis not valid. http://dev.mailjet.com/email-api/v3/listrecipient/ : it is very clearly stated what it does. If it does not work then maybe the Reference is wrong.

Finally, in general is "delete" stated correctly as shown above?
For example when i try to delete a Contactslist :

request = new MailjetRequest(Contactslist.resource).filter(Contact.ID, id);
response=cl.delete(request);

i get the following response JSON with IsDeleted:false:

{"Status":200,"Total":1,"Data":[{"IsDeleted":false,"Address":"_____","SubscriberCount":0,"CreatedAt":"2015-12-07T10:03:29Z","ID":15___49,"Name":"test"}],"Count":1}

Thank you in advance for your reply

from mailjet-apiv3-java.

WeshGuillaume avatar WeshGuillaume commented on June 7, 2024

Hey @sicoa ! Sorry for the delay! :)

I have created a new branch @sicoa-fixes that contains a fix for the delete that now works and a fix for the JSONExceptions. The delete was actually performing a get..

So inside that branch this works for me:

public class Main {
    public static void main(String[] args) throws MailjetException {
        MailjetClient client = new MailjetClient("", "");
        client.setDebug(MailjetClient.VERBOSE_DEBUG);

        System.out.println("POST REQUEST");
        MailjetRequest postRequest = new MailjetRequest(Listrecipient.resource)
                                .property(Listrecipient.ISACTIVE, true)
                                .property(Listrecipient.ISUNSUBSCRIBED, false)
                                .property(Listrecipient.LISTID, 2)
                                .property(Listrecipient.CONTACTID, 3);

        MailjetResponse postResponse = client.post(postRequest);
        System.out.println(postResponse);

        Long ID = postResponse.getData().getJSONObject(0).getLong("ID");
        System.out.println(ID);

        System.out.println("PUT REQUEST");
        MailjetRequest putRequest = new MailjetRequest(Listrecipient.resource, ID)
                                .property(Listrecipient.ISACTIVE, false);

        MailjetResponse putResponse = client.put(putRequest);
        System.out.println(putResponse);

        System.out.println("DELETE REQUEST");
        MailjetRequest deleteRequest = new MailjetRequest(Listrecipient.resource, ID);

        MailjetResponse deleteResponse = client.delete(deleteRequest);
        System.out.println(deleteResponse);
    }
}

Let me know if you think about anything before I push this on master :)

Best,
Guillaume

from mailjet-apiv3-java.

sicoa avatar sicoa commented on June 7, 2024

Good afternoon Mr Guillaume
i am very glad to tell you that delete works fine indeed. Thank you for the efforts!
How about the rest of the questions?

Remaining yours
sicoaDev

from mailjet-apiv3-java.

WeshGuillaume avatar WeshGuillaume commented on June 7, 2024

What is your goal when dealing with listrecipient ?

Do you want to add a contact to a contactslist ?

from mailjet-apiv3-java.

sicoa avatar sicoa commented on June 7, 2024

I am trying to create one, as i described in the first question, no2 issue

from mailjet-apiv3-java.

WeshGuillaume avatar WeshGuillaume commented on June 7, 2024

If you use: ContactManagecontactslists, it will create the listrecipient automatically

request = new MailjetRequest(ContactManagecontactslists.resource, ID)
           .property(ContactManagecontactslists.CONTACTSLISTS, new JSONArray()
                                   .put(new JSONObject()
                                         .put("ListID", "$ListID_1")
                                         .put("Action", "addnoforce"))
                                    .put(new JSONObject()
                                          .put("ListID", "$ListID_2")
                                          .put("Action", "addforce")));

from mailjet-apiv3-java.

sicoa avatar sicoa commented on June 7, 2024

I see, so ListRecipient is a part being deprecated and is almost of no use right now, is that right?

from mailjet-apiv3-java.

WeshGuillaume avatar WeshGuillaume commented on June 7, 2024

Actually no but we wouldn't recommend our users to use it because it is
complex so we created the contactManagecontactlist wrapper around the listrecipient to make it easier

from mailjet-apiv3-java.

sicoa avatar sicoa commented on June 7, 2024

Ok!
Thank you once more Guillaume!
Best wishes
sicoaDev

from mailjet-apiv3-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.