API V1 is no longer in active development. If you are starting a new integration, it is recommended you use API V2

Companies

Use the Lead Commerce Company API to view, create, and update companies.

NOTE: This API does not map Customers to Companies. To do this, refer to the Customers API

Views

Display information about your Companies including ID, Name, Status, and any Customers that have been associated to each Company.

Example:

<?php  
header("Content-type: text/xml;");  
$credentials = array('identifier' => 'LC350000000',  
                     'key' => 'dynKSr4I7y2K3RrPRsFYFJr03IXUbv');  
$curl = curl_init();  
curl_setopt($curl,CURLOPT_POSTFIELDS, http_build_query($credentials));  
curl_setopt($curl,CURLOPT_POST, 1);  
curl_setopt($curl, CURLOPT_URL, 'http://leadcommercestore.web/api/v1/Companies.xml');  
curl_exec($curl);  
curl_close($curl);  
?>

Example Output:

<message client="192.168.0.1" time="1377535712">  
    <response>  
        <code>200</code>  
        <data>  
            <item>  
                <id>2</id>  
                <name>XYZ Company</name>  
                <created>4/20/2001 10:59PM</created>  
                <last_updated>4/21/2001 11:59AM</last_updated>  
                <status>Active</status>  
            </item>  
            <item>  
                <id>1</id>  
                <name>ABC Company</name>  
                <created>2/16/2001 10:24PM</created>  
                <last_updated>3/27/2001 12:56PM</last_updated>  
                <status>Active</status>  
                <customers>  
                    <customer>  
                        <id>1001</id>  
                        <name>Tom Smith</name>  
                        <status>Active</status>  
                    </customer>  
                    <customer>  
                        <id>1021</id>  
                        <name>David Greene</name>  
                        <status>Active</status>  
                    </customer>  
                </customers>  
            </item>  
        </data>  
    </response>  
</message>

Create

Create allows you to create Companies as if you went through the Lead Commerce Back Office and includes automatic ID creation. Refer to the Data Points table above to learn which data points can be passed when creating Companies.

The sample Create Company code below shows how you would insert a Company called 'Lead Commerce' into the database and set it to 'Active' Status.

Example:

<?php  
$insert = array("name" => "Lead Commerce",  
                "status" => "active");  
$fields = array('identifier' => 'LC350000000',  
                'key' => 'dynKSr4I7y2K3RrPRsFYFJr03IXUbv',  
                'inserts' => array($insert));  
$curl = curl_init();  
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($fields));  
curl_setopt($curl, CURLOPT_POST, 1);  
curl_setopt($curl, CURLOPT_URL, 'http://leadcommercestore.web/api/v1/Companies/create.xml');  
curl_exec($curl);  
curl_close($curl);  
?>

Data Points

Key Data Type Required Example Notes
name string Yes Lead Commerce
status string No Active Active by default

Update

Update allows you to update Companies as if you went through the Lead Commerce Back Office. When updating a Company, you are NOT required to pass all fields; passing a blank will update the field as blank.

Running the sample Update code below for Company ID 44 would change its Name to 'XYZ Company, Inc.' and set its Status to 'Inactive.'

Example:

<?php  
$update = array('id' => '44',  
                'name' => 'XYZ Company, Inc.',  
                'status' => 'inactive');  
$fields = array('identifier' => 'LC350000000',  
                'key' => 'dynKSr4I7y2K3RrPRsFYFJr03IXUbv',  
                'updates' => array($update));  
$curl = curl_init();  
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($fields));  
curl_setopt($curl, CURLOPT_POST, 1);  
curl_setopt($curl, CURLOPT_URL, 'http://leadcommercestore.web/api/v1/Companies/update.xml');  
curl_exec($curl);  
curl_close($curl);  
?>

Refer to the Data Points table above to update your Companies. The only difference is described below:

Key Data Type Required Example Notes
id int Yes 44 ID of the Company

Start your free, no-risk trial today.