Having troubles with username and signin

Occasional Participant

Having troubles with username and signin

I'm using javascript xmlhttprequest to connect to the server, but i'm not getting access. I am using my constant contact login, not my developer login. I have checked the key for accuracy multiple times. I continue to get the same error every time:

Error: uncaught exception:

here's a code snippet:
==================================================
var myDeveloperAPIKey='66f**87d\-e**1\-4**9\-9**c\-76****cd**2';
var user = 'sumarchitecture';
var password = '********';

//construct the URI referencing the input user
var ctctServiceBaseURI='http://api.constantcontact.com/ws/customers';
var URI=ctctServiceBaseURI+'/'+user+'/contacts';

//construct the HTTP username as a concatenation of the API key and the user

var digestUserName= myDeveloperAPIKey+'%25'+user;
alert('uri: ' + URI);
alert('digestUserName: ' + digestUserName);
alert('password: ' + password);
//Invoke the request

line 125 >> xmlHttp.open('GET', URI, true, digestUserName, password);
============================================

the alerts are coming back with the correct values, but i'm not sure why i'm not getting in...

Any help?

Thanks in advance. This one has been troubling me non-stop for about 12 hrs...
4 REPLIES 4
Occasional Participant

Ok, so i just tried taking the URI out of the file and pasting it into the web browser. It immediately asks for user and pass. When I enter {apiKey}%{user} and {pass} it works!
So I know I've got the right key, user, and pass, but my code still is getting a bad url! help!
Occasional Participant

This security error is showing up on my error console for firefox. Check out the place that it is trying to load from. It looks like its trying to reference my URI as an extension of a location on my hard drive! Any ideas on what's going on here?
>>
Security Error: Content at file:///C:/My%20Documents/Webs/Sum%20Architecture/index.html may not load data from file:///C:/My%20Documents/Webs/Sum%20Architecture/http%3A%2F%2Fapi.constantcontact.com%2Fws%2Fcustomers%2Fsumarchitecture%2Fcontacts.
Participant

I got the same problem also, anyone could help to solve this???? Thanks!


Or else the API is not suitable for javascript because javascript can not cross site?

Moderator

The JavaScript XMLHttpRequest object is not able to access the Constant Contact API when used on a website due to the security restrictions placed on it by the Standard.  It is able to be used when creating widgets or applications in some common languages such as Adobe AIR and Yahoo Widgets.  In order to accomplish the same type of behavior on a website, you will need to use some form of Server Scripting or advanced JSON/IFrame manipulation.  Constant Contact does not recommend using JSON or IFrames as it can expose secure information such as Username and Password to the users of your website.  We strongly recommend doing all of your API requests and parsing on the server side to increase performance for your users and to also keep all private information secure.

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

View API documentation, code samples, get your API key.

Visit Page