LemonFree API 2.0 Documentation - Submitting Leads

Last Updated: June 16, 2014

Overview

If successful, the response will contain a code of 0 and a message containing the internal LemonFree Id for the successful lead; otherwise the response will contain an error code with additional detail messages.

Lead submissions are limited to 100 submissions per 24 hours.

Base URL

http://api.lemonfree.com/v2/lead/

NOTE: A POST request is required when submitting leads. Parameters are passed via POST request in the form PARAMETER_NAME=PARAMETER VALUE.

Parameters

Parameter Type Occurrence Description
key string required your API key
format Result Format optional Sets the format of the result.
If format is not specified the default format is xml.
listing_id string required The LemonFree listing ID
email string required User's e-mail address
fname string required User's first name
lname string required User's last name
zip string required User's zip/postal code
phone int required User's phone number, 10-digit string only (ie. 3872773621)
questions string optional Any User Comments

Result Fields

Field Description
lead_id The LemonFree Lead ID for this lead submission. This should be a 32 character length string. If lead_id is empty then this indicates that the lead submission was not accepted by the seller. See messages for reasons.
messages Any messages associated with this lead submission. If lead submission is successful this field will normally be blank; however if lead submission was not accpeted by the seller then any reasons will be in this field.

Example Request

Using PHP and cURL

$leadData = array(
    'key=[YOUR API KEY]',
    'listing_id=1G4HC5EM9BU118364',
    'email=test@lemonfree.com',
    'fname=Ida',
    'lname=Wallace',
    'zip=19103',
    'phone=5551234567',
    'questions=This is for any comments the user may have',
    'format=json' // or 'format=xml'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://api.lemonfree.com/v2/lead/');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $leadData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$response = curl_exec($ch);
curl_close($ch);

echo $response; // should be similiar to 'Sample Results' section

Sample Results

XML

<?xml version="1.0" encoding="UTF-8"?>
<response xmlns:lf="http://api.lemonfree.com/ns/1.0">
    <lf:request_type>lead</lf:request_type>
    <lf:request_params>
        <lf:attr name = "key">[YOUR API KEY]</lf:attr>
        <lf:attr name = "listing_id">1G4HC5EM9BU118364</lf:attr>
        <lf:attr name = "email">test@lemonfree.com</lf:attr>
        <lf:attr name = "fname">Ida</lf:attr>
        <lf:attr name = "lname">Wallace</lf:attr>
        <lf:attr name = "zip">19103</lf:attr>
        <lf:attr name = "phone">5551234567</lf:attr>
        <lf:attr name = "questions">This is for any comments the user may have</lf:attr>
        <lf:attr name = "format">xml</lf:attr>
    </lf:request_params>
    <lf:response_code>0</lf:response_code>
    <lf:result>
        <lf:item>
            <lf:attr name="lead_id">b326981f35b520ef9bc06f9c00160b3f</lf:attr>
            <lf:attr name="messages"></lf:attr>
        </lf:item>
    </lf:result>
</response>    

JSON

{
    "response":{
        "request_type":"lead",
        "request_params":{
            "key":"[YOUR API KEY]",
            "listing_id":"1G4HC5EM9BU118364",
            "email":"test@lemonfree.com",
            "fname":"Ida",
            "lname":"Wallace",
            "zip":"19103",
            "phone":"5551234567",
            "questions":"This is for any comments the user may have",
            "format":"json"
        },
        "response_code":"0",
        "result":{
            "lead_id":"4309e73124e71e8debd471e101df34b8",
            "messages":[]
        }
    }
}