Mandrill API... not working?

3,672 views
Skip to first unread message

Brian Mann

unread,
May 24, 2012, 4:07:32 PM5/24/12
to mandrill-a...@googlegroups.com
I posted an issue on the github page here:

https://github.com/terra-firma/mandrill/issues/2

I'm posting it here as well because I'm not sure if its an actual gem issue or related to the actual API, or if I'm missing something.

I tried using Mechanize to POST JSON data to the API as well rather than just use the gem... but once again I can get back a successful response for PING/PONG but get back:

Mechanize::ResponseCodeError: 500 => Net::HTTPInternalServerError for https://mandrillapp.com/api/1.0/messages/send.json -- unhandled response

whenever I try to send an actual message

Loren Norman

unread,
May 24, 2012, 6:02:49 PM5/24/12
to mandrill-a...@googlegroups.com
Hey Brian,

The terra-firma gem seems to have some issues, so we've been suggesting people use the Highgroove gem for now (it has Mandrill support):

As for your Mechanize problem, you would have to show me what you were posting to the API before I could tell you what was happening. Feel free to copy some of the code here if you like. The request is probably malformed in some way, but we'll readily admit that we need some better error messages for this stuff. We're working on it!

Brian Mann

unread,
May 24, 2012, 6:33:56 PM5/24/12
to mandrill-a...@googlegroups.com
Hey there, thanks for the quick response.  I've actually met you at the Highgroove office a few months back, and seen you at the local Ruby meetups.

Anyway, I will give the gem you suggested a shot and let you know if I have any issues.

As for mechanize -- I imagine it's probably something on my end -- I ended up using the Poster Firefox add-on to send a POST to the API, and I do have it working now.

It took me a few tries because the error message that responds is pretty unspecific...

{"status":"error","code":-1,"name":"Avesta_API_Server_Exception","message":"You must specify a key value"}

I will bypass the API wrappers if I have any issues with the mailchimp gem and just send requests directly.

Thanks!

Brian Mann

unread,
May 24, 2012, 8:58:26 PM5/24/12
to mandrill-a...@googlegroups.com
The mailchimp gem you suggested does indeed work.  Thanks!

Loren Norman

unread,
May 25, 2012, 12:07:06 PM5/25/12
to mandrill-a...@googlegroups.com
Hey that's great Brian, love to help people in the immediate Atlanta community!

Glad the Highgroove gem worked out for you, keep us posted if you have any more questions, and I'm sure I'll see you around.

prom

unread,
May 30, 2012, 2:47:42 AM5/30/12
to mandrill-a...@googlegroups.com
I have the same problem;

 

I am integrating our app to Mandrill using API in JSON format;


It gets \"PONG!\";


it gets my user information;

that are all fine.

 

Now I want to send email:

 


and json data in form data using content type "application/json":

 

{"key": "232b548e-e133-418a-xxxx-xxxxxxxxxxxx", "message":{"html":"This is first mail chimp message","text":null,"subject":"First Test Subject","from_email":null,"from_name":"","to":[{"email":"in...@upsputnik.com","name":null}]}};

 

I also try to user https protocol,

or using http://mandrillapp.com/api/1.0//messages/send.json and put json data in querystring as http://mandrillapp.com/api/1.0//messages/send.json?key=232b548e-e133-418a-xxxx-xxxxxxxxxxxxf&message={"html":"This is first mail chimp message","text":null,"subject":"First Test Subject","from_email":null,"from_name":"","to":[{"email":"in...@upsputnik.com","name":null}]}

 

I always get following error: The remote server returned an error: (500) Internal Server Error.

 

I am using .Net 4.0 and webRequest.

Loren Norman

unread,
May 30, 2012, 12:06:50 PM5/30/12
to mandrill-a...@googlegroups.com
Hey prom,

I think we got you sorted out via our private help channel, but I want to make a note of the solution here on the API group.

First of all, our errors strive to be well-behaved HTTP citizens and often carry more information with them, visible in the body of the 500 response. This will often help you troubleshoot things.

The actual problem here is the "null" value for the "from_email" field: as the API states, this is a required field and null will not work.

Thanks!

Kevin Duffey

unread,
Jun 18, 2012, 2:34:44 PM6/18/12
to mandrill-a...@googlegroups.com
Hi,

I wanted to add to this post that I too am having an issue with my code not able to post emails. Using the Eclipse IDE and rest plugin, I was able to copy/paste the above example, using my info instead, and it worked fine. I am writing a Java JAXB wrapper for sending emails via the Jersey Rest client. I am able to post to the info.json and ping.json no problem. When I try to build up an email to send via JAXB classes that encapsulate a message, it fails with a 500.

First, it wasn't immediately apparent to me that not only does the body have to have the {"key":..} info but ALSO a ?key=... was needed. That strikes me as odd.. why have it in the body and on the url query param? Or perhaps it is not needed in both places? Is one or the other preferred for sending emails (or are both required?).

In my code, I built up a string to mimic the above example and I am able to send that out fine. However, ideally I want to build a JAXB wrapper to use class/properties instead of building a string every time. It's possible the JAXB to String conversion that JAXB does is outputting a slightly wrong version of JSON format? I am not entirely sure how to enforce it one way or another, but from some Jersey documentation, there is 4 different types of JSON formatting all with minor differences. Is there a specific json format your service uses when parsing the incoming message json body?

Thanks.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages