title: sending post request to mailchimp 2.0 from grails
body: <p>currently, I am integrating my grails project with mailchimp 2.0 API (we are currently use version 1.2 from grails-mailchimp plugin)
  When I send a post request with json data to mailchimp end point, I always receive this error "HTTP/1.1 302 Moved Temporarily". How can I fix it ?</p>
  
  <p>Here is my code using HTTPBuilder</p>
  
  <pre><code>def twitter = new RESTClient( "https://us4.api.mailchimp.com/2.0/lists/member-info.json")
  def resp = twitter.post(
          path : '/',
          body : body1,
          requestContentType : ContentType.JSON )
  
  assert resp.status == 200
  </code></pre>
  
  <p>my logging:</p>
  
  <pre><code>http.RESTClient POST https://us4.api.mailchimp.com/
  conn.BasicClientConnectionManager Get connection for route {s}-&gt;https://us4.api.mailchimp.com
  conn.DefaultClientConnectionOperator Connecting to us4.api.mailchimp.com:443
  protocol.RequestAddCookies CookieSpec selected: best-match
  protocol.RequestAuthCache Auth cache not set in the context
  protocol.RequestTargetAuthentication Target auth state: UNCHALLENGED
  protocol.RequestProxyAuthentication Proxy auth state: UNCHALLENGED
  client.DefaultHttpClient Attempt 1 to execute request
  conn.DefaultClientConnection Sending request: POST / HTTP/1.1
  http.wire &gt;&gt; "POST / HTTP/1.1[\r][\n]"
  http.wire &gt;&gt; "Accept: */*[\r][\n]"
  http.wire &gt;&gt; "Content-Length: 106[\r][\n]"
  http.wire &gt;&gt; "Content-Type: application/json[\r][\n]"
  http.wire &gt;&gt; "Host: us4.api.mailchimp.com[\r][\n]"
  http.wire &gt;&gt; "Connection: Keep-Alive[\r][\n]"
  http.wire &gt;&gt; "[\r][\n]"
  http.headers &gt;&gt; POST / HTTP/1.1
  http.headers &gt;&gt; Accept: */*
  http.headers &gt;&gt; Content-Length: 106
  http.headers &gt;&gt; Content-Type: application/json
  http.headers &gt;&gt; Host: us4.api.mailchimp.com
  http.headers &gt;&gt; Connection: Keep-Alive
  http.wire &gt;&gt; "{"id":"xxx","emails":[{"email":"xxx"}],"apikey":"xxx-us4"}"
  http.wire &lt;&lt; "HTTP/1.1 302 Moved Temporarily[\r][\n]"
  http.wire &lt;&lt; "Server: nginx[\r][\n]"
  http.wire &lt;&lt; "Content-Type: text/html; charset=UTF-8[\r][\n]"
  http.wire &lt;&lt; "Content-Length: 1[\r][\n]"
  http.wire &lt;&lt; "Location: http://apidocs.mailchimp.com/[\r][\n]"
  http.wire &lt;&lt; "Date: Sun, 10 Aug 2014 09:22:24 GMT[\r][\n]"
  http.wire &lt;&lt; "Connection: keep-alive[\r][\n]"
  http.wire &lt;&lt; "[\r][\n]"
  conn.DefaultClientConnection Receiving response: HTTP/1.1 302 Moved Temporarily
  http.headers &lt;&lt; HTTP/1.1 302 Moved Temporarily
  http.headers &lt;&lt; Server: nginx
  http.headers &lt;&lt; Content-Type: text/html; charset=UTF-8
  http.headers &lt;&lt; Content-Length: 1
  http.headers &lt;&lt; Location: http://apidocs.mailchimp.com/
  http.headers &lt;&lt; Date: Sun, 10 Aug 2014 09:22:24 GMT
  http.headers &lt;&lt; Connection: keep-alive
  client.DefaultHttpClient Connection can be kept alive indefinitely
  http.RESTClient Response code: 302; found handler: org.codehaus.groovy.runtime.MethodClosure@30198ecc
  http.RESTClient Parsing response as: text/html
  http.wire &lt;&lt; "[\n]"
  conn.BasicClientConnectionManager Releasing connection org.apache.http.impl.conn.ManagedClientConnectionImpl@5dee0bbf
  conn.BasicClientConnectionManager Connection can be kept alive indefinitely
  http.RESTClient Parsed data to instance of: class groovy.util.slurpersupport.NodeChild
  </code></pre>
  
  <p>It seems like I am sending http, not https (because the code 302 Moved Temporarily only for HTTP protocol), isn't it ? And if yes, how can I fix it?</p>