Basic API v3 request in Python / Postman

PaulK4625
Rookie
0 Votes

Dear Sir or Madame,

I am able to get the access token, but unable to write the proper code to retrieve the endpoint info. First using Postman (without quotes) I've entered:

Headers:

Key 'Authorization', Value 'Bearer the_authorization_code'

Key 'Content-Type', Value 'application/json'

then under Body

Key 'token', Value 'the_authorization_code'

But this results in a 400 Bad Request, and

"error_key": "token.invalid",
"error_message": "Invalid access token"

If I can get this working I will translate to Python/Django. Help for either Postman or Python is appreciated.  Thank you.

 

6 REPLIES 6
Jimmy_D
Employee
0 Votes

Hi @PaulK4625,

 

Here is a screenshot of how I have my POSTman setup.

 

POSTman v3 auth.png

 

curl --location --request POST 'https://idfed.constantcontact.com/as/token.oauth2?code=code&redirect_uri=https%3A%2F%2Flocalhost&gra...' \
--header 'Authorization: Basic {base64encoded clientID:clientsecret}'


Regards,
Jimmy D.
Tier II API Support Engineer
PaulK4625
Rookie
0 Votes

Jimmy thank you so much for your quick response. My problem happens actually after successfully getting the access token. In particular, sending a POST request to .../contacts/sign_up_form. The contact is created or updated, but the address information is never included. Even when I copy the exact JSON contact information directly from your API docs [Example POST Create or Update Contact Request, PHP (and changed the list number)] and then use it in your API Reference engine, the contact is created in my list, but the address info is nowhere to be found. Is there a way you can help me debug this issue? I would so appreciate your help on this. Thank you.

Paul

Jimmy_D
Employee
0 Votes

Hi @PaulK4625,

 

I believe you also sent us an email. It appears there is a difference in our documentation/schema. One endpoint uses street_address and the other uses street_addresses. For the /sign_up endpoint you will want to use street_address and this should work. I've already reached out to our engineers to see how we can best address this.


Regards,
Jimmy D.
Tier II API Support Engineer
PaulK4625
Rookie
0 Votes

Thanks Jimmy! What about the phone info?! Paul

 

Oh- just tried and and still doesn't work. If I change to street_address, I get this (400)- street_address is invalid. If I add the 'es' like before, street_addresses gives a valid response (201) with no data created just like before. Mind you, this is with the body taken directly from your documentation and using your engine to make the POST request. Mind blowing. My own code fails also. Any help is appreciated as my client is waiting. Thank you. Paul

GregoryT38
Rookie
0 Votes

Were you able to get this working using python?

Courtney_E
Employee
0 Votes

Hello GregoryT38,

 

Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.

 

Please let us know a little bit more about the issue that you are experiencing so that we can better assist.  

 

Are you having issues with authentication, or with making calls that are not returning address data? Any example or response errors that you are receiving would also be helpful.

 

You can also reach our team directly via email at webservices@constantcontact.com


Regards,

Courtney E.
Tier II API Support Engineer

Did I answer your question?
If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.
Resources
Developer Portal

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

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up