title: Javascript + MailChimp API subscribe
body: <p>When making this request:</p>
  
  <pre><code>// Subscribe a new account holder to a MailChimp list
  function subscribeSomeoneToMailChimpList()
  {
    var options =
    {
      "apikey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "id": "xxxxxx",
      "email":
      {
        "email": "me@example.com"
      },
      "send_welcome": false
    };
    var mcSubscribeRequest = UrlFetchApp.fetch("https://us4.api.mailchimp.com/2.0/lists/subscribe.json", options);
    var mcListObject = Utilities.jsonParse(mcSubscribeRequest.getContentText());
  }
  </code></pre>
  
  <p>This response is returned:</p>
  
  <blockquote>
    <p>Request failed for <a href="https://us4.api.mailchimp.com/2.0/lists/subscribe.json">https://us4.api.mailchimp.com/2.0/lists/subscribe.json</a> returned code 500. Truncated server response: {"status":"error","code":-100,"name":"ValidationError","error":"You must specify a apikey value"} (use muteHttpExceptions option to examine full response) (line 120, file "v2")</p>
  </blockquote>
  
  <p>Line 120 is the line on which <code>UrlFetchApp.fetch</code> is called.</p>
  
  <p>The API key is valid (I have tested with simpler API calls that don't include associative arrays). When I append the API key directly to the base URL and remove it from the <code>options</code>, I get an error saying that the list ID is invalid. When I then append the list ID directly to the base URL and remove it from <code>options</code>, I get an error saying that the email address must be in associative array form.</p>
  
  <p>My question is: Using the above format, how does one send requests that contain associative arrays?</p>
  
  <p>The relevant API documentation can be found <a href="http://apidocs.mailchimp.com/api/2.0/lists/subscribe.php">here</a>.</p>