401 error


401 error

I'm having trouble getting started. I've constructed a basic Http GET for a list of contacts, but it returns a 401 error. Everything looks good to me. Can anyone point out what I'm doing wrong?

Here's some sample code. ColdFusion is my language of choice:

<cfset Variables.username = "{myUsername}" />
<cfset Variables.password = "{myPassword}" />
<cfset Variables.apiKey = "{myAPIkey}" />
<cfset Variables.httpUsername = Variables.apiKey & "%" & Variables.username />

url = "http://api.constantcontact.com/ws/customers/#Variables.username#/contacts"
method = "GET"
username = "#Variables.httpUsername#"
password = "#Variables.password#"
result = "Variables.response"

My only guess at this point, is that since {myUsername} contains spaces, commas, and other special characters, that it's causing a problem in the http call. Do such special characters need to be HTML encoded?
Regular Participant

Another developer had a problem trying to get CfHttp to work. Click here to see that post. They were unable to get it to work because it doesn't support Digest Authentication. They were able to get it to work with CFX_HTTP5

Mike C Support Engineer, Constant Contact

Developer Portal

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

Visit Page