ecwid / maleorang Goto Github PK
View Code? Open in Web Editor NEWMailChimp API 3.0 wrapper for Java
License: Apache License 2.0
MailChimp API 3.0 wrapper for Java
License: Apache License 2.0
Is there an option to send an automation email as described here ?
https://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/queue/
Hi, thanks for your great job on this wrapper. Please how do I use this wrapper for batch operations, the implementations seems quite complicated? Any doc for this? Expecting your reply
Hi,
Been trying to use your maven version 3.0-0.9.5 in my Java 8 Spring Boot project but am getting the following error when trying to run it on a AWS Tomcat instance:
java.lang.NoClassDefFoundError: Could not initialize class com.ecwid.maleorang.util.ClassUtil
Any ideas?
I've always encountered this error while running the app
2018-Apr-30 17:07:41 PM [https-jsse-nio-8443-exec-4] ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/ULFWS].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [/ULFWS] threw exception [Handler dispatch failed; nested exception is java.lang.NoSuchFieldError: INSTANCE] with root cause java.lang.NoSuchFieldError: INSTANCE at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:146) ~[httpclient-4.5.3.jar:4.2.3] at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.getDefaultRegistry(PoolingHttpClientConnectionManager.java:115) ~[httpclient-4.5.3.jar:4.2.3] at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:122) ~[httpclient-4.5.3.jar:4.2.3] at com.ecwid.maleorang.connector.HttpClientConnector.<clinit>(HttpClientConnector.kt:66) ~[maleorang-3.0-0.9.6.jar:?] at com.ecwid.maleorang.MailchimpClient.<init>(MailchimpClient.kt:25) ~[maleorang-3.0-0.9.6.jar:?]
I already tried adding httpclient and httpcore in maven dependencies, but the error still appears.
here is a list of my dependencies :
`
org.springframework.boot
spring-boot-starter
org.springframework.boot
spring-boot-starter-logging
org.springframework.boot
spring-boot-starter-aop
org.springframework.boot
spring-boot-starter-security
org.springframework.boot
spring-boot-starter-web
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
<version>1.0.0.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-core</artifactId>
<version>1.5.8</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.6.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>com.ecwid</groupId>
<artifactId>maleorang</artifactId>
<version>3.0-0.9.6</version>
</dependency>
</dependencies>`
DId i miss something here?
Look at those lines:
maleorang/src/main/java/com/ecwid/maleorang/MailchimpClient.kt
Lines 62 to 70 in 2cd7161
Sometime we have "errors" field in the response body here, when we have problems with fields filled in the request (for example, required fields are not set, or set with invalid values).
Could you add this "errors" fields as List<Map<String,Object>> onto MailchimpException object with public getter for this unmodifiable list? This field is optional in the response body (can be NULL for MailchimpException)
Or, should I create PR for it by myself?
Your library is really cool,
I'm wondering how to use this lib to Create a Subscriber List in Java
Thanks,
Simon
Hi all,
I just integrated this library in a Spring MVC project and apparently randomly I'm getting an "ArrayIndexOutOfBoundsException: 1" while executing the POST request to insert a new contact in a list.
This is the code in charge of executing the insertion request:
try (MailchimpClient client = new MailchimpClient(mailChimpApikey)) {
final EditMemberMethod.Create method = new EditMemberMethod.Create(mailChimpListId, email);
method.status = SUBSCRIBED_STATUS;
method.merge_fields = new MailchimpObject();
method.merge_fields.mapping.put(MergeTag.FNAME.name(), firstName);
method.merge_fields.mapping.put(MergeTag.LNAME.name(), lastName);
method.merge_fields.mapping.put(MergeTag.LANGUAGE.name(), iso3language);
method.merge_fields.mapping.put(MergeTag.ISCUSTOMER.name(), isCustomer);
final MemberInfo member = client.execute(method);
}
And this is the stacktrace of the exception - I know, I need to learn Kotlin :)
java.lang.ArrayIndexOutOfBoundsException: 1
at it.service.mailinglist.MailChimpService.insertUserInList(MailChimpService.java:70)
at it.service.UsersService.doActivateAccount(UsersService.java:378)
at it.webservice.webservice.ValidationController.doActivate(ValidationController.java:38) [ValidationController.class:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_74]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_74]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_74]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_74]
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) [spring-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) [spring-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) [spring-webmvc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:781) [spring-webmvc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:721) [spring-webmvc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) [spring-webmvc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) [spring-webmvc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) [spring-webmvc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) [spring-webmvc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863) [spring-webmvc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) [servlet-api.jar:na]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) [spring-webmvc-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) [servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) [catalina.jar:7.0.59]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.59]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat7-websocket.jar:7.0.59]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.59]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.59]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) [spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344) [spring-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) [spring-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.59]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.59]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.59]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.59]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) [catalina.jar:7.0.59]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [catalina.jar:7.0.59]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) [catalina.jar:7.0.59]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) [catalina.jar:7.0.59]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:7.0.59]
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) [catalina.jar:7.0.59]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.59]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) [catalina.jar:7.0.59]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074) [tomcat-coyote.jar:7.0.59]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) [tomcat-coyote.jar:7.0.59]
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) [tomcat-coyote.jar:7.0.59]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_74]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-coyote.jar:7.0.59]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_74]
Any help would be much appreciated!
Thanks
Hi, I'm trying to create a custom method for the "Batch subscribe or unsubscribe" [POST /lists/{list_id}] which needs a members[] body parameter containing max 500 contact objects.
I don't know how to do this, can you help?
Sorry if this is an obvious question - i'm new to Kotlin/IntelliJ.
I have an IntelliJ Kotlin project where I would like to use maleorang. I had tried adding an entry to the pom.xml
file, but it looks like it can't find the dependency:
Any suggestions as to what I need to do to get this imported into my project?
As it stands in the current release, 3.0-0.9.6, the conditions field of SegmentOptsInfo expects a List of Strings. However, it is actually a list of a more detailed object:
https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#read-get_campaigns
{
"id": "f6276207cc",
....
"recipients": {
...
"segment_opts": {
"saved_segment_id": 48501,
"match": "any",
"conditions": [
{
"field": "static_segment",
"op": "static_is",
"value": 48501
}
]
}
}
}
Easy enough to enhance, but I would need to learn Kotlin first. :) Syntax is easy enough, would just need to learn the environment (build tools, etc...)
How can i add tags?
I tried:
1-method.mapping.put(key, value);
2-Customized method
@field
public String tags;
shows correctly on the body, but it doesn't work.
following the documentation https://mailchimp.com/developer/marketing/api/list-members/add-member-to-list/
When using the latest 3.0-0.9.5 from maven central repo. I get this runtime exception. It's seems guava should be a runtime dependency instead of just compile time.
java.lang.NoClassDefFoundError: com/google/common/reflect/TypeToken
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.ecwid.maleorang.MailchimpMethod.<init>(MailchimpMethod.kt:16)
Hi guys, please I a get an error each time I pass a StartBatchOperations object to the client.execute() method in java, but this works well in the kotlin test, can I get a help on why this happens and what I can do? see pictures below:
This is the java error I get
This is the same implementation in Kotlin without errors
I'm trying to figure out how to send campaigns but I don't see any example of this.
Regards
MailchimpClient
currently logs full request and response bodies with INFO
log-level. This is highly verbose; full content should be logged only with DEBUG
level.
Hey,
After some time it started to give me this error.
com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 27.2030651341 at line 1 column 42345 path $.lists[8].stats.open_rate
Hi there - there is a broken link on the main readme: Using an existing method implementation (Kotlin)
I'd love to raise a PR, but I'm not sure where this should be pointing to
Shouldn't this be marked as a field too:
in order to conform to:
?
As we didn't got any responses for issues or for PRs here, we are forking this project and will maintain it here https://github.com/raisin-gmbh/maleorang
if you have any issues, PRs or suggestions, feel free to send it there.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.