Support :: API - Old

CRM API

The CRM API endpoint/url is configurable by website. Typically the endpoint is:

http://www.yourdomain.com/crm.php?api

API Keys

Before you can make a call to the API, you must first configure an API key. API keys in the crm can be configured under CRM -> Settings -> API.

Each key can consists of the API key code, a reference name, active state, and lead source assignment. You can configure each key with a different lead source so that you can track which contacts have entered the system from which API key. This is useful when you have multiple sites/applications feeding contacts into the CRM and would like to see the CRM contact source.

All Requests

All requests should contain the following post parameters:

ParameterRequiredDescription
key Y The appropriate CRM API Key
ip Y source ip address of the user submitting, configurable for pass through
action Y The specific action/call you are using on the api. See below sections for each action

Contacts

 Using this api call will allow you to create contacts on the remote CRM.

Request Parameters ( include params from "all requests" section )

ParameterRequiredDescription
action Y always use value contact_create for this call
email Y Email to be used on the CRM contact record
company N The account name to associate this new contact with.
Will link to existing by name or create a new account if it does not exist.
If not provided the company will be completed based on the first and last name
sent to the API. If first and last name are not sent, company will be "unknown"
first N first name
last N last name
phone N phone number
fax N fax number
address N address first line ( street address )
address2 N second line of address ( apartment/building number )
city N city
state N state or province
zip N zip/postal code
skills N content to be completed for the skills field on the crm contact
comment N will be used to create the first contact note attached to this new crm contact

Request Examples

CURL

curl -XPOST http://www.yourdomain.com/crm.php?api \
     -d "key=testkey" \
     -d "ip=127.0.0.1" \
     -d "action=contact_create" \
     -d "email=test@test.com" \
     -d "company=test.com" \
     -d "first=John" \
     -d "last=Doe" \
     -d "phone=801-555-5555"

PHP

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.yourdomain.com/crm.php?api');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
	'key' => 'testkey',
	'ip' => '127.0.0.1',
	'action' => 'contact_create',
	'email' => 'test@test.com',
	'company' => 'test.com',
	'first' => 'John',
	'last' => 'Doe',
	'phone' => '801-555-5555',
));

$result = curl_exec($ch);
curl_close($ch);

Response

The CRM API will return a text based result with a HTTP status code of 200.

The text result can be interpreted for either a pass or fail. Successful contact creation will yield an integer result with the contact id. If there was an error string "false" will be outputted. If there is an error message available, there will be a newline character after "false" where the second line will contain the error message/detail.

If a fail message is generated with no verbose error message/detail to the API call, an email with the error details will be generated to the site_email address for the website ( configurable under Settings ). Situations that will yield an error email to site_email address will typically be an incorrect API key.

Contact Log/Note

The contact log api call will allow you to create a log on a known contact by id.

Request Parameters ( include params from "all requests" section )

ParameterRequiredDescription
action Y always use value contact_log for this call
contact_id Y The id of the contact to add the note to
log Y The text content for the log/note

Request Examples

CURL

curl -XPOST http://www.yourdomain.com/crm.php?api \
     -d "key=testkey" \
     -d "ip=127.0.0.1" \
     -d "action=contact_log" \
     -d "contact_id=123" \
     -d "log=test"

PHP

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.yourdomain.com/crm.php?api');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
	'key' => 'testkey',
	'ip' => '127.0.0.1',
	'action' => 'contact_log',
	'contact_id' => '123',
	'log' => 'test',
));

$result = curl_exec($ch);
curl_close($ch);

Response

The CRM API will return a json result with a HTTP status code of 200.

The response is a json object containing success ( boolean ) and a message ( string ). If success is true, message is typically blank. If success is false, message contains an error message.

{
	"success": true
	,"message": ""
}