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?

 

 

 

Tags (3)
3 REPLIES 3
Highlighted
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

Highlighted
New Member

Re: v3 curl example not working

Hello,

I'm facing the same issue.  I have navigated to the authorization url through the browser, but it just redirects me to my redirection url and I am not getting redirected to constant Contact login page to allow access.  The redirection url I specified can handle post requests too.  Please let me know how can I get the authorization code response.

Highlighted
Moderator

Re: v3 curl example not working

Hello,

 

I would like to know what the authorization URL is you are using, and to try it out on my end here. For privacy, please email my team at webservices@constantcontact.com with the URL you are using.


Regards,
David B.
Tier II API Support Engineer

Developer Portal

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

Visit Page

Register for our "Making Sense of Online Marketing for Retail" Webinar

Join us on Thursday, August 13th at 2pm ET for a free webinar where we'll discuss how to incorporate online marketing into your retail store.

Read More
Featured