cancel
Showing results for 
Search instead for 
Did you mean: 
Tomorrow morning (8/26) from 07:00 AM - 08:00 AM ET we need to make a few updates to our site. During this time, no emails will be sent and some customers will not be able to access their contacts. We recommend finishing up your work before 07:00 AM and logging in after 08:00 AM ET. Thank you for your patience while we make these updates.

v2 API & header names

SOLVED
Highlighted
Advisor

v2 API & header names

Hello -

 

My app is in coldfusion so there aren't any wrappers to use.  I generate a token from the I/O docs and have my api key, but what are you expecting to be passed in the http header?  Or am I doing this incorrectly?

 

For example...

 

<cfhttp
url="https://api.constantcontact.com/v2/account/info?api_key=adhrawqfpbgpucj78qdg6d7e"
result="objGet">

<cfhttpparam
type="header"
name="username"
value="MY CC USERNAME"
/>

<cfhttpparam
type="header"
name="token"
value="GENERATED TOKEN"
/>

</cfhttp>

2 REPLIES 2
Advisor

Re: v2 API & header names

After a bunch of trial and error, I figured it out...for those who might still be using coldfusion (My app is still in the stone age, on coldfusion 8.01)..here's what you need.

 

name = Authorization

value = Bearer [TOKEN]

 

*Note:  You need a mashery account, API key, and token generated...also replace [APIKEY] with your api_key and [TOKEN] with your token (without square brackets)

 

<!--- Creatr a variable for the URL --->

<!---
API Key for CC, given by CC
--->
<cfset api_key = "api_key=[APIKEY]">

<!---
URL for API GET, without API Key
--->
<cfset uri = "https://api.constantcontact.com/v2/account/info?">

<!---
Full URI for GET
--->
<cfset fullURI= uri & api_key>


<!--- Make the Get Request --->
<cfhttp
url="#fullURI#"
method="GET"
charset="utf-8">

<cfhttpparam
name="Authorization"
type="header"
value="Bearer [TOKEN]"
/>

</cfhttp>

Moderator

Re: v2 API & header names

Hi @imru,

 

Thank you for posting your work on this. We've had a few other Coldfusion users and I'm sure they will also be grateful.


Regards,
Jimmy D.
Tier II API Support Engineer