You are on page 1of 5

Infusionsoft API Overview

The Infusionsoft API is a way to programmatically access and modify data directly in your application. It will allow you to have more flexibility and control over what happens with your data, and will give you the power to integrate Infusionsoft technologies with other systems that you may already have. Through the API you will be able to do things like Add/Update/Edit contact and other records, start or stop campaigns, run action sequences, or view invoices and payments.

Example
Let's say that you have a form on your website where a user can enter in their email address. You want to detect if they are already in your Infusionsoft application (as a previous lead). If they are there, you want to take them to a page where they have a Members Only Offer, and if they are not in your application, you want to take them to a new customer screen. Let's say that you want all of this to reside on your system so it can also interact with your local database as well.

Now, let's take this example one step further: Upon response from the API, if the email address doesn't exist in Infusionsoft, you want to: 1. Add the record into your application 2. Apply a tag (Email Address Only) 3. Start a follow-up sequence (Email Only Sequence)

This is how the flow will look:

Form Handler

Handle API Reply

Infusionsoft

Query Infusionsoft for Email

Add Record to Infusionsoft

Apply tag

Add Record to Infusionsoft

Because the API can allow you granular control over the flow, you can have a powerful interaction with Infusionsoft and your website or membership site.

Technology
In deciding what technology to use for our API, we researched and played around with a lot of different technologies; ie. XML-RPC, SOAP, REST, RMI, Hessian, our own custom protocol. We wanted to follow an industry standard but also wanted something that was easy for our users to implement. We finally settled on XML-RPC. It's not quite as powerful as SOAP, but is MUCH easier, and will handle all Infusionsoft transactions that we could foresee. Also, there is support for it in almost every platform and language. Because the API implements the XML-RPC standard, it can be accessed using any platform or programming languages. The easiest (and safest) way to access the API is to locate a client library that works with your platform and programming language. Once you have a client library, most API calls can be made in only a few lines of code. This guide and other API documentation will read on the assumption that you have familiarized yourself with the XML-RPC spec and that you are comfortable with sending and receiving data through it. Examples are provided with this documentation as well.

Installation

To get started using the API, you will need to go through an initial set-up process. The result of the setup process will be an encrypted key that you will need for authentication. 1. Log in to your Infusionsoft application with Admin privileges. 2. Hover over Setup and select Misc Settings. 3. Click Application Settings on the left navigation menu. 4. Scroll down to the bottom of the page, where you will see the API section. 5. Enter a passphrase. 6. Enter your access IPs (this is an additional security parameter that you can use to limit access to the API from certain IP addresses. It is highly recommended that you use this field to help protected your data) 7. Click the Save button at the bottom of the screen. 8. Call Infusionsoft Support to request your Access URL. They will give the URL over the phone. The key will display automatically. 10. Write down this key it will be essential to getting the API to work

Making a call to an API Service


An API Service is an endpoint that our system has exposed that you can access to perform an operation or to request data. Each service can have multiple operations that can be called. To make a call, you will need to know five things: 1. The API service URL Infusionsoft Support will provide you with the URL to access the API 2. The name of the service and the method As defined by the Service Documentation 3. The encrypted API key You should have already gotten this in the previous section 4. What parameters to pass to the service As defined by the Service Documentation 5. What the service will return to you As defined by the Service Documentation The basic idea is that you will invoke some command on our servers and pass all the information necessary to complete that command. We will then formulate a response and send it back to you. Command format A remote command is made up of two parts, the service name and the method name. A service may have multiple methods. For example, the DataService contains (among others) the following methods: DataService.add (this adds a record to the database) DataService.load (this loads a record from the database given an id) Parameter Types There are different types of data that can be passed via XML-RPC. This document will only cover pertinent ones:

Name Int

Description A whole integer, positive or 1 negative A floating point decimal number

Example 1 3 -10 0.3324 11.23 1.233454 Hello, world How are you Infusionsoft 12-22-2006 12-24-2005 11:22 [1, 2, 3.222, Eric Martineau] [1, [Eric, Martineau], 5]

Double

String

Simple text

Date

A date or date/time

Array

A list of data, each item in the list can be any other data type, including an array or struct Key-value pairs

Struct

[FirstName=John, LastName=Doe, Age=13] [a=1,b=3,c=4]

Each programming language will have different ways of representing these XML-RPC types in a native format. The return value of an operation can also be any of the above data types. Example -Python This example will be in python. We have other code examples using other languages included in this documentation bundle. Problem: I want to load a Contact record that has an ID 15. The first step is to get my API Service URL, which is https://api.test.infusionsoft.com:8447/api/xmlrpc Now, I need to identify the service and method. After looking into the Service Documentation, I decided that the DataService service and load method would work for me. I have my encrypted key: 6ae189d497cd486b9db53793ccf98646 The DataService.load method takes in the following parameters: Key (the encrypted key) Table (what table I'm searching on) Id (The ID of the record I'm looking for) Fields (A list of fields to return) The service will return a struct (see XML-RPC spec) to me containing the data for the record. Now, for the python script:
import xmlrpclib

#Set up the api server first server = xmlrpclib.ServerProxy("https://api.test.infusionsoft.com:8447/api/xmlrpc"); #Set up parameters key = 6ae189d497cd486b9db53793ccf98646; table = Contact; id = 15; fields = [Id, FirstName, LastName, Email]; #Make the call put the results into variable called results api_results = server.DataService.load(key, table, id, fields); #The results should be a python 'dictionary', so we can print them #like this: print api_results['FirstName']; print api_results['LastName']; print api_results['Email']; print api_results['Id'];

When I execute this program, the output might look like: John Doe john@doe.com 15

You might also like