login about faq

I am currently sending json data successfully to a 3rd party API: http://sendgrid.com/docs/API_Reference/Web_API/mail.html using req.AddParam like this:


I am trying to use a different service that uses a struct for the parameters: https://mandrillapp.com/api/docs/messages.JSON.html#method=send

I am having trouble figuring out how to make this work with req.AddParam. Should it work like this?

req.AddParam("message", "{"html": "

Example HTML content

","text": "Example text content","subject": "example subject"}")

asked Aug 30 '13 at 19:12

jamesblake's gravatar image


When using AddParam, you're not actually sending a JSON request. You must be sending either an application/x-www-form-urlencoded or a multipart/form-data request. It must be that for "sendgrid.com", it accepts either JSON HTTP requests in addition to the other standard ways of providing name/value params.

For mandrillapp.com, I suspect it's only accepting JSON requests -- where the Content-Type is either application/jsonrequest or application/json, and the body of the HTTP request is the JSON struct itself. You would achieve this by calling either PostJson or PostJson2.


answered Sep 02 '13 at 10:25

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Aug 30 '13 at 19:12

Seen: 1,188 times

Last updated: Sep 02 '13 at 10:25

powered by OSQA