I am switching a client's CC signup form on their site (running on WordPress) to the new API. I modified a third-party plugin to do what is required and tested it locally and on the live site. It worked but I found it lacking and started writing one myself; the site will using the modified plugin until I am finished. However, I am now getting a Mashery over-limit error, even with your sample code.
The signup form has been tested under a dozen times total. There is no evidence of hacking, as there are under 1000 contacts in one mailing list being used and 0 in the other. And, while the site probably did have over 10k hits so far this am (from all sources, including bots), this would mean that a) a signup form cannot "getLists()" since that would count towards the limit and/or b) a signup form cannot be on every page, since that would multiply the number of API calls by the number of pages on the site as bots index it.
If the above is correct, it seems the list id(s) must be stored locally, hard coded in the form or at least retrieved with an Ajax call, eliminating the problem of bots. Am I correct in this thinking?
I would just get another API key, but that wouldn't solve the problem.
Also, when getting the API key, I needed to put in the site that is using it. How does that affect local development? I develop on a web server on a lan that only I have access to. Do I need to work on my desktop so the url is "localhost"?
Thank you for reaching out to Constant Contact's API Support.
You will want to GET the list IDs once and store them. Retrieving them all the time is eating up your API calls and is not needed unless you are constantly changing your list names.
The redirect URI is for authorization needs. It does not affect development unless you are not comformtable with where you have it being redirected to during authorization. You are welcome to create one API key for development and one API key for live use.
Well, if the problem is getting the list ids, you should change your sample code, which does exactly that! As do (at least) several of the WP CC plugins I looked at. It might also be good to add this as a "suggestion" somewhere in the developer documentation, as most site owners will want a mailing list signup form to be global on their sites. Something like getListIdByListName() might also be nice to have to make things easier.
No problem changing my application, though, but it looks like I'm done working on it today.