cancel
Showing results for 
Search instead for 
Did you mean: 

v3 curl example not working

Highlighted
Occasional Visitor

v3 curl example not working

I'm stumped.  I set up a new trial account and attempted to use api V3. I want a server side way to add contacts from another system.  I make the curl request and it returns 302

 

REQUEST

curl -X GET -i -H "application/x-www-form-urlencoded" "https://api.cc.email/v3/idfed?response_type=code&client_id={my-client-id-here}&scope=contact_data&re..."

 

RESPONSE  - 302

Body:

"https://idfed.constantcontact.com/as//authorization.oauth2?pfidpadapterid=ctctOAuth2IdpAdapter&clien...{my-client-id-here}&redirect_uri=https://localhost&response_type=code&scope=contact_data&

 

So now what?

 

 

 

1 REPLY 1
Moderator

Re: v3 curl example not working

Hello,

 

It looks like you are trying to connect and/or set up OAuth. The authorization URL once visited should redirect you to a Constant Contact login page, so a 302 would be expected response, though it's designed for you to visit it in a web browser rather than using cURL to GET it. Here's the general process that OAuth would follow:

  • The Constant Contact account owner clicks on something in your app/page to connect it to Constant Contact (a link, button, etc.)
  • The link they click sends them in a new tab or window to your authorization URL.
  • The account owner is shown a Constant Contact login page and logs in
  • The account owner is asked to allow your app access and clicks "Allow"
  • Constant Contact directs the account owner back to your application (your redirect URI) and adds a query parameter to the URL with the authorization code.
  • Your application grabs this parameter and then makes a POST call to exchange the authorization code for an access token and refresh token

You then store these fields and use them when making API calls. If you are building this for only use by one Constant Contact account, you can manually authorize using your browser and a REST client. First, go to the authorization URL using a browser, follow the steps to allow access, manually copy the authorization code, and then use your REST client to make the POST call to exchange that code for a refresh and access token.

 

Please have a look and let me know if you have any questions!

 

Regards,
David B.
Tier II API Support Engineer