A 101 Look Into Our Rest Based API

This article will provide you with an overview and the knowledge you will need to get started. My goal is to provide specifics, as well as to walk you through a practical example.

First things first, Authenticating via Basic Authentication.

Basic Authentication, as you might have expected, requires credentials. A Username, Password, and an APIKey to be specific!

While the Username and Password should not need an introduction, you might not know exactly what our APIKey represents. Simply put, the ApiKey is a unique identifier assigned to a partner and allows access to the API. Every APIKey is unique and has its own data associated with it. (see sample record below)

APIKey Record

<APIKey>G5555F31-56Z2-62X7-9PSG-553E0MCD8ATG2</APIKey>

<Name>Redtail Technology</Name>

<URL>http://www.redtailtechnology.com</URL>

<Institution>0</Institution>

Ok, so now you should be wondering, How do I supply the credentials?

Below, you can see that the credentials are supplied in the request header as a string, with each credential separated by a single colon. Don't worry! The credentials are secured via SSL.

When supplying the credentials, you will want to use base64 encoding to alleviate any woes related to incompatible characters, as well as specify the Basic authentication type. See bolded string in request header example below.(C#)

While we do provide credentials specific to our partners, for the sake of this example I am providing a working set of credentials for our production server. If your team does not already have a set of credentials for both environments(development and production), please contact our Sales team at 800-206-5030.

You might ask, where do I find the URI for the specific method? (Fair enough, the services are REST based after all.)

Browsing through our /help page, we will come across the URI we are looking for. Now bare with me here, as the help page will be easier to navigate in the future. However, the listed URI to the left should give you some direction. We are looking for a GET method to obtain CONTACT details for a specific contact. Might /contacts/{contactid} return what you are looking for? (see graphic below)

For production, our base service address is https://api2.redtailtechnology.com/crm/v1/rest.

So wait, you want a simple tool to test our methods with or to nail the concept down?

Fiddler is a great FREE tool for testing. If you are not at all familiar with Fiddler, I will provide brief tutorial for our purposes below.

Just like the example before it, you need to provide the request URI, credentials(base64 encoded) and method type. Content type can be specified optionally.

Using Fiddler, select the Composer tab and enter information similar to the following image below. Remember, the credentials need to be base64 encoded!

You will want to navigate to the Inspectors tab to view the results.

The Raw section is great for giving you a string of the results. However, for the sake of readability, it is also nice to select the content type that you may or may not have provided in the Request Header.

For a GET method, its as simple as that!

So, great...you can retrieve a record, but what if you want to input information?

Well, that's where PUT methods become involved.

Put methods are more complex, as a request body is required in the call. You will have to use the appropriate data types for each of the fields. I would suggest first performing a GET method to retrieve a record similar to the one you would like to input, as this should prove useful in constructing the PUT's request body.

Below is the request header. Be sure to spot the differences between the GET and PUT requests. In the request header, you should also notice that the URI's {ContactID}= 0. When using PUT methods via our API, supplying 0 as a Record Identifier in the URI will result in the Method creating a NEW record. However, if we specified the ContactID as 384843, we would be updating the record where ContactID = 384843, aka Mary Investor.