Won't log in.

Highlighted
Occasional Participant

Won't log in.

I type in to the browser the following:

 

https://api.constantcontact.com/ws/customers/{api-key}%{userid}/

 

where the api-key is the displayed api key on the appropriate page.

 

where the userid is the userid used to sign into the site.

 

It comes back with "Cannot find ....."

 

What is wrong?

 

PS I also tried without the curly brackets.  It does not work.

 

6 REPLIES 6
Highlighted
CTCT Employee

Re: Won't log in.

Hey Chris,

 

If you want to see your results in your browser you can go to :

 

https://api.constantcontact.com/ws/custoemrs/your-username/contacts

 

 

Replace your-username with your username and contacts would be the particular area that you want to query. You can also replace contacts with campaigns or any other area of the account that you can find under the api documentation.

 

When you put this in the URL it will prompt with a username and password.  The username is your API key and % then your username.

 

APIkey%username

 Your password would be that of the account.

 

Please let me know if you need any more help.

Ryan Davis
Quality Engineer
Highlighted
Occasional Participant

Re: Won't log in.

What I am really trying to do is get set up for adding contacts with php.  I was just trying to see if the key and userid combination would work.  I do not need help with the php, just the exact url to use to post the data.  Thanks!

Highlighted
Moderator

Re: Won't log in.

Since our API features are not as simple as just POSTing data to a URI and everything just works (you need to handle existing contact conflicts, unsubscribed contact conflicts and other error messages), I would recommend using our PHP wrapper library.  It already has all the code to handle the XML parsing and error handling.  You can find that code here: http://community.constantcontact.com/t5/Documentation/Code-Samples/ba-p/25019

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Occasional Participant

Re: Won't log in.

I understand that.  What I need is the exact url to use with the ctctwrapper.php.  I need the EXACT url to use there with you telling me how to construct the username portion.  eg does one include the curly brackets when constructing the username to be inserted in the url.

Highlighted
Moderator

Re: Won't log in.

I am not sure I understand what you mean by URL to insert into ctctWrapper.php.  There is only one thing that needs to be configured in the wrapper and it's the __construct() method:

 

  /**
   * Public Function __construct of Utility Object
   *
   * Sets variables for username, password, and API key, as well as
   * constructs the login request string: APIKey%Username:Password
   *
   * Also sets ActionBy settings:
   * - ACTION_BY_CUSTOMER will add contacts as if they were being added by Site Owner.
   * - ACTION_BY_CONTACT will add contacts as if they were added by themselves
   *
   */
  public function __construct()
  {
   $this->setActionBy('ACTION_BY_CUSTOMER');
   $this->setApiKey('API KEY HERE');
   $this->setApiPath('https://api.constantcontact.com');
   $this->setLogin('username');
   $this->setPassword('password');
   $this->setRequestLogin($this->getApiKey() . "%" . $this->getLogin() . ":" . $this->getPassword());
                }

 

The only thing that needs to be set is:

 

API Key - the API key that is provided to you when you create one

Username - username exactly as you would enter it when logging in at http://www.constantcontact.com/login.jsp

Password - password exactly as you would enter it when logging in at http://www.constantcontact.com/login.jsp

 

The curly braces we use when putting examples into the forums are used to identify request specific information and it is just a standard way when doing that throughout most API forums and internet code forums.  There is no need to ever use curly braces at any time in any of the ctctWrapper.php code.  There is also no need to ever enter a URI manually into the ctctWrapper.php code since all of hte URI work is done by the wrapper so you don't have to.

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Occasional Participant

Re: Won't log in.

Thank you.  I appreciate your time. 

Developer Portal

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

Visit Page

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