Skip to content

Instantly share code, notes, and snippets.

@dominicsayers
Last active April 20, 2016 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dominicsayers/6fcec1253d7a07d470e6 to your computer and use it in GitHub Desktop.
Save dominicsayers/6fcec1253d7a07d470e6 to your computer and use it in GitHub Desktop.
Mailchimp API v3 - problem creating an interest in an interest_category using API v3

Firstly, we'll GET the interest_category to demonstrate the api_key is OK:

  • Method: GET
  • URL: https://us11.api.mailchimp.com/3.0/lists/e73f5910ca/interest-categories/bc914b7356/interests
  • Request headers: Authorization: apikey df8658fb18403e29ef4a8437a8eb3705-us11

Response:

{
  "interests": [
    {
      "category_id": "bc914b7356",
      "list_id": "e73f5910ca",
      "id": "ca7ab24b53",
      "name": "Monday",
      "display_order": 1,
      "_links": [
        {
          "rel": "self",
          "href": "https://us11.api.mailchimp.com/3.0/lists/e73f5910ca/interest-categories/bc914b7356/interests/ca7ab24b53",
          "method": "GET",
          "targetSchema": "https://us11.api.mailchimp.com/schema/3.0/Lists/Interests/Instance.json"
        },
        {
          "rel": "parent",
          "href": "https://us11.api.mailchimp.com/3.0/lists/e73f5910ca/interest-categories/bc914b7356/interests",
          "method": "GET",
          "targetSchema": "https://us11.api.mailchimp.com/schema/3.0/Lists/Interests/Collection.json"
        },
        {
          "rel": "update",
          "href": "https://us11.api.mailchimp.com/3.0/lists/e73f5910ca/interest-categories/bc914b7356/interests/ca7ab24b53",
          "method": "PATCH",
          "targetSchema": "https://us11.api.mailchimp.com/schema/3.0/Lists/Interests/Instance.json",
          "schema": "https://us11.api.mailchimp.com/schema/3.0/Lists/Interests/Instance.json"
        },
        {
          "rel": "delete",
          "href": "https://us11.api.mailchimp.com/3.0/lists/e73f5910ca/interest-categories/bc914b7356/interests/ca7ab24b53",
          "method": "DELETE"
        }
      ]
    }
  ],
  "list_id": "e73f5910ca",
  "category_id": "bc914b7356",
  "_links": [
    {
      "rel": "self",
      "href": "https://us11.api.mailchimp.com/3.0/lists/e73f5910ca/interest-categories/bc914b7356/interests",
      "method": "GET",
      "targetSchema": "https://us11.api.mailchimp.com/schema/3.0/Lists/Interests/Collection.json"
    },
    {
      "rel": "parent",
      "href": "https://us11.api.mailchimp.com/3.0/lists/e73f5910ca/interest-categories/bc914b7356",
      "method": "GET",
      "targetSchema": "https://us11.api.mailchimp.com/schema/3.0/Lists/InterestCategories/Instance.json"
    },
    {
      "rel": "create",
      "href": "https://us11.api.mailchimp.com/3.0/lists/e73f5910ca/interest-categories/bc914b7356/interests",
      "method": "POST",
      "targetSchema": "https://us11.api.mailchimp.com/schema/3.0/Lists/Interests/Instance.json",
      "schema": "https://us11.api.mailchimp.com/schema/3.0/Lists/Interests/Instance.json"
    }
  ],
  "total_items": 1
}

Now we POST a new interest:

  • Method: POST
  • URL: https://us11.api.mailchimp.com/3.0/lists/e73f5910ca/interest-categories/bc914b7356/interests
  • Request headers: See below for full request headers
  • Payload: {"name":"Tuesday"}

Response:

{
  "type": "about:blank",
  "title": "Internal Server Error",
  "status": 500,
  "detail": "A deep, internal error has occurred during the processing of your request. Please contact support.",
  "exception": "7eb9e7fff8921402f2de993d54f08b7c",
  "instance": "91636f40-3d01-476e-aadf-cb200cb9bf92"
}

Request headers:

CSP: active
Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36
Authorization: apikey df8658fb18403e29ef4a8437a8eb3705-us11
Content-Type: application/json 
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Cookie: _ga=GA1.4.288284156.1435236720; _AVESTA_ENVIRONMENT=prod; MC_PREACCT_REFERRER=http%3A%2F%2Fmailchimp.com%2Fcontact%2Fsupport%2F; MC_USER_INFO=%7B%22time%22%3A1436777543%2C%22val%22%3A%7B%22user_level%22%3A166%2C%22user_id%22%3A27293687%2C%22login_id%22%3A19610555%2C%22ptp%22%3A0%2C%22activated%22%3A%222014-03-11+13%3A00%3A39%22%2C%22dc%22%3A%22340%22%2C%22gm%22%3Afalse%7D%2C%22sig%22%3A%22b7708f00af64de6ecae30ade7163fdea3bae18289a60473f1f5ba793398e648c%22%7D; _ga=GA1.2.288284156.1435236720; __utma=35488766.288284156.1435236720.1436777535.1436804384.9; __utmc=35488766; __utmz=35488766.1436804384.9.4.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided)

Response headers:

Server: nginx 
Content-Type: text/html; charset=UTF-8 
Content-Length: 235 
X-Request-Id: 91636f40-3d01-476e-aadf-cb200cb9bf92
Content-Encoding: gzip 
Vary: Accept-Encoding 
Date: Mon, 13 Jul 2015 16:56:33 GMT 
Connection: close
Set-Cookie: _AVESTA_ENVIRONMENT=prod; path=/
@ivanacorovic
Copy link

Hello,

I am having the same problem creating new interest with V3. Did you end up solving this? Could you share the solution?

@tabana
Copy link

tabana commented Apr 20, 2016

I got this from a MailChimp support agent: "What you are seeing with that POST is related to some unexpected behavior that we are aware of on our end at this time. This is something that our developers are aware of and are working toward a fix for. This should only be an error in messaging though and it sounds like you were able to confirm that group was created."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment