Basic API v3 request in Python / Postman

Highlighted
Member

Basic API v3 request in Python / Postman

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.

 

2 REPLIES 2
Highlighted
Moderator

Re: Basic API v3 request in Python / Postman

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
Highlighted
Member

Re: Basic API v3 request in Python / Postman

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

Developer Portal

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

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More
Featured