How To Use RESTClient

The RESTClient offers a convenient way to test your API calls and XML structures because it is a light tool that provides detailed error messages.  It is a Java application that has been developed by Wiztools.org.  If you are having trouble running our API, using RESTClient is a great way to debug the issue.

Initial Setup

First, download and install the RESTClient from the following URL:

http://rest-client.googlecode.com/

Next, we need to set up the authentication information.  On "Auth" tab, check "BASIC" and uncheck "Preemptive".

For "Username", enter {API KEY}%{Constant Contact username}.  For "Password", enter your Constant Contact password.

AuthTab Screen

 

Using RESTClient

You will mostly work with "Method", "Headers" and "Body" tabs.  Choose the appropriate method on "Method" tab.

If you are using a GET method, then you don't need to use "Headers" or "Body" tab.  If you are using a PUT or a POST, then put your XML in "Body" tab and add application/atom+xml as "Content-Type" header on "Headers" tab.  If you are trying to run a GET method followed by PUT or POST, you do not need to delete the contents of "Headers" and "Body" tabs.  They will be promptly ignored.

In URL, enter your API call like the following:

https://api.constantcontact.com/ws/customers/{username}/lists

Don't forget to use "https" instead of "http".

Examples

All examples assume your {username} is testuser.

1. Getting a list of contacts

  • On "Method" tab, choose "GET"
  • In URL, enter https://api.constantcontact.com/ws/customers/testuser/contacts
  • Hit the Go! button with ">>" icon
    • The REST Client will display a response status (which should be 200 OK) in the lower pane
    • If the call was successful, see the BODY tab of the lower pane to inspect the response body.  (The Response Body from your GET is generally very useful in putting together a Request Body for a create (POST) or update (PUT) command)

Get Example Screen

 

2. Creating a new contact list

  • On "Method" tab, choose "POST"
  • Post Example Screen 1

  • On "Headers" tab, enter Content-Type as "Key" and application/atom+xml as "Value" and hit the plus button to add it.

  • Post Example Screen 2 Post Example Screen 3

  • On "Body" tab, enter your XML entry for the new contact list

    <entry xmlns="http://www.w3.org/2005/Atom">
      <id>data:,</id>
      <title/>
      <author/>
      <updated>2008-04-16</updated>
      <content type="application/vnd.ctct+xml">
        <ContactList xmlns="http://ws.constantcontact.com/ns/1.0/">
          <OptInDefault>false</OptInDefault>
          <Name>A New List</Name>
          <SortOrder>99</SortOrder>
        </ContactList>
      </content>
    </entry>
    

    Post Example Screen 4

  • In URL, enter https://api.constantcontact.com/ws/customers/testuser/lists
  • Hit the Go! button with ">>" icon