The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

401 error

Highlighted
New Member

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 />

<cfhttp
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?
1 REPLY 1
Highlighted
Solution Provider

RE: 401 Error

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

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured