Basic API v3 request in Python / Postman

Occasional Participant

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.

 

4 REPLIES 4
Moderator

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
Occasional Participant

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

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
Occasional Participant

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

Developer Portal

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

Visit Page