Client-side JSONP API

322 views
Skip to first unread message

Dan Fabulich

unread,
Apr 6, 2012, 12:08:19 PM4/6/12
to mailchimp-...@googlegroups.com
I'm interested in implementing something very similar to the MailChimp embedded sign-up form: I want to send a subscription request to MailChimp via AJAX, without using any of my server-side code. The transaction should be directly between the user's browser and MailChimp's servers.

Looking at the API documentation, I see how to use the server-side API, but that requires me to use my API key, and to keep it a secret, so it won't allow my users to submit a subscription request directly to MailChimp.

When I examine the JavaScript code of the embedded sign-up form, I see that it's not using the same server-side API I am. It's submitting a GET request to <dc>.list-manage.com/subscribe/post-json

It appears to be a JSONP API, which doesn't use my secret key. That's exactly what I want!

But I don't see any documentation about how to use this API. What kind of responses does the JSONP API return? What errors should I look for? What are its parameters? The embed code includes a parameter "u" ... what does that parameter stand for? It also passes an "id" parameter, but that doesn't seem to match the unique list ID I see in the MailChimp dashboard.

I guess I can just reverse engineer the embed code, but I'm really hoping there's some documentation I can use instead.

Thanks!

jesse

unread,
Apr 6, 2012, 1:40:19 PM4/6/12
to mailchimp-...@googlegroups.com
It's not currently a documented, supported API.


jesse

Dan Fabulich

unread,
Apr 6, 2012, 2:02:09 PM4/6/12
to mailchimp-...@googlegroups.com
OK, well, I've investigated it and it looks pretty simple. I'll just hack it up myself (understanding that it's not supported to do this) and post some documentation on my blog.

I'm going to assume that it has to at least remain backwards compatible, to support all of the embed codes copied and pasted out on the Internet.

-Dan
Reply all
Reply to author
Forward
0 new messages