The REST-style API can be used to POST leads directly to your channelLEADS install, either directly from your website forms (the "Direct Post" mode) or in “API mode” via HTTP POST from a program on your server (the “API client”). The only differences between the 2 modes are
API mode accepts HTTP POST (actually, https since the API endpoint is a secure https url) with form-encoded field data (i.e. the same format a browser uses). All fields are as described in the Direct Post documentation. The response will be an xml document with status info, error codes when needed, and the lead ID which could be used to construct a link to the lead details in the LEADpiper system.
See below for an example.
You can test API mode using the popular Curl command line http client. In this example, we're posting a lead w/ standard fields “email” and “company” and custom fields “company_size” and “industry”
curl -d directPostKey="OSBD NUSS EXBO 96IR&email=frankdunn@gmail.com&x-company_size=33&apiFlag=1&company=roxy&x-industry='civil engineering'" http://[your channelLEADS install URL]/API/Leads/
since we specified apiFlag=1, the response comes back as xml and looks like this:
<response> <result>1</result> <leadId>1636</leadId> </response>
The following are possible return values based on what is submitted:
<response> <result>1</result> <leadId>2133</leadId> </response>
<response> <result>0</result> <message>Authentication failed. Authentication key not set.</message> </response>
<response> <result>0</result> <message>Authentication failed. Incorrect authentication key.</message> </response>
<response> <result>0</result> <message>Contact is a required field.</message> </response>
<response> <result>0</result> <message>Email address is a required field.</message> </response>