GithubHelp home page GithubHelp logo

Campaigns about mailjet-apiv3-java HOT 12 CLOSED

sicoa avatar sicoa commented on May 24, 2024
Campaigns

from mailjet-apiv3-java.

Comments (12)

WeshGuillaume avatar WeshGuillaume commented on May 24, 2024

Hey @sicoa !

  1. Could you provide your code and a console output with debug mode on like so ?
        client.setDebug(MailjetClient.VERBOSE_DEBUG);

        MailjetRequest request = new MailjetRequest(Campaign.resource)
                    // .filter(..., ...)
                    ;

        MailjetResponse campaign = client.get(request);

my output is :

=== HTTP Request ===
GET https://api.mailjet.com/v3/REST/campaign?
Accept-Charset:UTF-8
user-agent:mailjet-apiv3-java/v3.0.0
Accept:application/json
=== HTTP Response ===
Receive url: https://api.mailjet.com/v3/REST/campaign?
Status: 200
null:HTTP/1.1 200 OK
Date:Thu, 03 Dec 2015 10:52:25 GMT
Content-Length:41
Connection:keep-alive
Content-Type:application/json
Server:nginx
  1. At the moment, filter accepts both String and int . Do you think we should add Long and Dates back ?

when you say: "Also the documentation has remained the same as before the update, stating the previous attributes' types", are you talking about the README.md ?

Best,
Guillaume from Mailjet!

from mailjet-apiv3-java.

sicoa avatar sicoa commented on May 24, 2024

Thank you once more for the quick reply Mr Guillaume!

  1. When i said documentation, i meant the v3 reference
    Regarding filters, as long as it works, i would not change them, I do like more the Int/String only values (i will try the date implementation, as date is a strange format)

My account for testing, the one i use the creds from, has 6 campaigns made.
The response i get is the same as yours but i do not get any Data:
{"Status":200,"Total":0,"Data":[],"Count":0}

Output in the console:
=== HTTP Request ===
GET https://api.mailjet.com/v3/REST/campaign?FromID=0&ContactsList=0
Accept-Charset:UTF-8
Accept:application/json
user-agent:mailjet-apiv3-java/v3.0.0
=== HTTP Response ===
Receive url: https://api.mailjet.com/v3/REST/campaign?FromID=0&ContactsList=0
Status: 200
null:HTTP/1.1 200 OK
Server:nginx
Connection:keep-alive
Content-Length:41
Date:Thu, 03 Dec 2015 11:15:48 GMT
Content-Type:application/json
Content:
{ "Count" : 0, "Data" : [], "Total" : 0 }

from mailjet-apiv3-java.

sicoa avatar sicoa commented on May 24, 2024

Regarding filters, what has happened to the Boolean ones? They recognize only true/false String values?

from mailjet-apiv3-java.

WeshGuillaume avatar WeshGuillaume commented on May 24, 2024

I assume this is your call then (?)

    new MailjetRequest(Campaign.resource)
                    .filter(Campaign.FROMID, 0)
                    .filter(Campaign.CAMPAIGNID, 0);

Can you make sure you've got a sender with ID 0 and a Contact list with id 0 ?

Regarding Boolean in filters, yeah, I am definitly adding them, you are right

from mailjet-apiv3-java.

sicoa avatar sicoa commented on May 24, 2024

Well, i do not use any filter as my response suggests. A plain Campaign.resource call.
:)

FILTERS:
Please can you specify to me if the v3 reference is actual? I mean the filters for example.
When i call "Contact." like "request.filter(Contact.CONTACTSLIST,contlistfilter);" i have the option of filtering with many more attributes than the ones listed at the v3REFERENCE. Does it work? Do i have all those filters that are Contact stats AND filters from the old ones? Example: Contact.CAMPAIGN exists and in the previous version, meant only filter, as it is not a Contact attribute. Now it is there along with the rest of the filters AND the attributes for Contact

from mailjet-apiv3-java.

WeshGuillaume avatar WeshGuillaume commented on May 24, 2024

The v3 reference is up to date. The Resource propreties are actually helper for autocompletion. So they are valid for filters AND body (for POST/PUT) fields. They are just strings actually.

I tried to reproduce your error, but I can't, it is weird. This code produces this output for me:

        client.setDebug(MailjetClient.VERBOSE_DEBUG);

        MailjetRequest request;
        MailjetResponse response;

        request = new MailjetRequest(Campaign.resource);
        response = client.get(request);
=== HTTP Request ===
GET https://api.mailjet.com/v3/REST/campaign?
Accept-Charset:UTF-8
Accept:application/json
user-agent:mailjet-apiv3-java/v3.0.0
=== HTTP Response ===
Receive url: https://api.mailjet.com/v3/REST/campaign?
Status: 200
null:HTTP/1.1 200 OK
Server:nginx
Connection:keep-alive
Content-Length:41
Date:Thu, 03 Dec 2015 13:13:53 GMT
Content-Type:application/json

the interesting line is GET https://api.mailjet.com/v3/REST/campaign?
Yours is GET https://api.mailjet.com/v3/REST/campaign?FromID=0&ContactsList=0

It is hard to tell where the bug comes from in the wrapper then..

from mailjet-apiv3-java.

sicoa avatar sicoa commented on May 24, 2024

Mr Guillaume
i am truly sorry for the frustration, i seem to have forgotten initial values at the previous implementation for those two specific stats that used to be non strings (long or int i believe)
Thank you a lot for your effort to solve the issue!
However i still cannot get the content from the campaigns:

=== HTTP Request ===
GET https://api.mailjet.com/v3/REST/campaign?
Accept-Charset:UTF-8
Accept:application/json
user-agent:mailjet-apiv3-java/v3.0.0
=== HTTP Response ===
Receive url: https://api.mailjet.com/v3/REST/campaign?
Status: 200
null:HTTP/1.1 200 OK
Server:nginx
Connection:keep-alive
Content-Length:41
Date:Thu, 03 Dec 2015 14:01:23 GMT
Content-Type:application/json
Content:
{ "Count" : 0, "Data" : [], "Total" : 0 }

from mailjet-apiv3-java.

WeshGuillaume avatar WeshGuillaume commented on May 24, 2024

Don't worry ;)

So the http call is working normally, now it might be related to the server. What do you get when you type in your terminal:

curl -X GET --user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" http://api.mailjet.com/v3/REST/Campaign

with the correct API credentials ?

from mailjet-apiv3-java.

sicoa avatar sicoa commented on May 24, 2024

Calling the url you gave me with the correct credentials, it returns exactly the same response:
{ "Count" : 0, "Data" : [], "Total" : 0 }
However i do have 6 campaigns under the CAMPAIGN tab..
What am i supposed to be looking at as a response?

One comment regarding v3reference. Apart from the change in the types of variables as we discussed before concerning Dates etc, for example i just stumbled upon
Contact Filter: Recipient Only retrieve contacts corresponding to this recipient. [ Type Int64 ] This does not exist in the Contact properties.

from mailjet-apiv3-java.

WeshGuillaume avatar WeshGuillaume commented on May 24, 2024

Ow, my bad, I get it now!
The request made without the FromTS filter will return all the Campaigns made today only.

Try this for all campagins from day 0:

        MailjetRequest request;
        MailjetResponse response;

        request = new MailjetRequest(Campaign.resource)
                    .filter(Campaign.FROMTS, 1);

        response = client.get(request);
        System.out.println(response);

Again, sorry for the inconvenience!

Best,
Guillaume

from mailjet-apiv3-java.

WeshGuillaume avatar WeshGuillaume commented on May 24, 2024

Does it work on your side ?

from mailjet-apiv3-java.

sicoa avatar sicoa commented on May 24, 2024

It worked like charm Mr Guillaume!
Thank you for all your help and immediate responses
Best regards
SicoaDev

ps. Did you check my comment on Contact Filter: Recipient ? Shall i open a new issue maybe for any gaps/controversially documented parts etc that i may find?

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.