LEADMASTER API

Introduction:
The LeadMaster API web service allows systems to interact with the LeadMaster databases. With the web service, you can add, update, select, and delete a lead(s). You can also manage lead opportunities, groups, account managers, partners, and partner reps. By passing in LogonID, password, CompanyID, and the relevant data objects, you can manipulate the records. With the corresponding methods prefixed by "LM", you can pass in the API key instead of the LogonID/Password combination to access the API.


Web Service Location:
http://api.leadmaster.com/LMService/LMService.asmx

ADD LEAD
Lead Datatype:
Use the TypeLeadData datatype to add a lead in the AddLead() call.
TypeRECDNO[] AddLead(int logon_id, string password, int company_id, TypeLeadData[] LeadData)
--- Sample C# call to AddLead()

ArrayList arrayLeadData = new ArrayList();

TypeLeadData tld = new TypeLeadData();

tld.Company = "My Company";
tld.FirstName = "Bob";
tld.Address = "123 East Str.";
tld.City = "Detroit";
arrayLeadData.Add(tld);


tld = new TypeLeadData();
tld.Company = "ACME Company";
tld.FirstName = "Joe";
tld.Address = "736 Woodmen Str.";
tld.City = "Houston";
arrayLeadData.Add(tld);


TypeLeadData[] inArray = (TypeLeadData[])arrayLeadData.ToArray(typeof(TypeLeadData));

TypeRECDNO[] myresult = obj.AddLead(LOGONID, "PASSWORD", 3, inArray);
for (int i = 0; i < myresult.Length; i++)
{
Response.Write(myresult[i].RECDNO + "<br>");
}


string Company;
string Salutation;
string FirstName;
string LastName;
string Title;
string Address;
string Address2;
string Address3;
string City;
string State;
string Zip;
string Country;
string Phone;
string Phone_Extension;
string Fax;
string Cell_Phone;
string Email;
string Website;
string Mkt_Program_ID;
string Lead_Source;
int User_Field_4;
int User_Field_6;
string User_Field_7;
string User_Field_23;
string User_Field_24;
string User_Field_25;
string User_Field_26;
string User_Field_27;
string AssignToRepByEmail; --- Use to assign to reps by email of the rep. It is not case sensitive. The partner will automatically be assigned.
string EE_REP; --- Use to assign to account manager. Enter account manager ID here. The regional manager will automatically be assigned.
string Grade;
string RECORD_STATUS;
string Lead_Status;
int Source_Type;
int SIC_CODE;
float PROBLTY;
string Telemarketer;
string HighlightComments;
string GeneralComments;
string SalesRepComments;
string AssignComment;
string FollowUp_Type;
string SalesStage;
string DateFormat;
string CloseDate;
string ForecastDate;
string SHIP;
string SpecialInterest1;
string SpecialInterest2;
string SpecialInterest3;
string SpecialInterest4;
string SpecialInterest5;
string SpecialInterest6;
string SpecialInterest7;
string SpecialInterest8;
string SpecialInterest9;
string SpecialInterest10;
string SpecialInterest11;
string SpecialInterest12;
string SpecialInterest13;
string SpecialInterest14;
string SpecialInterest15;
string SpecialInterest16;
string SpecialInterest17;
string SpecialInterest18;



UPDATE LEAD

Use these fields to update lead record.   Each field has the datatype and maximum length that you can pass.
Updating a record requires the primary key RecordID.

RecordID numeric --- (is required for update)
Grade text(100)
RECORD_STATUS text(100)
Lead_Status text(100)
Source_Type tinyint (1)
Company text(150)
Address text(150)
Address2 text(150)
Address3 text(150)
City text(100)
State text(50)
Zip text(25)
Country text(50)
PRI_PHONE text(50)
PRI_PHONE_EXT text(50)
PRI_PHONE2 text(50)
PRI_PHONE3 text(300)
FAX_PHONE text(50)
FAX_PHONE_EXT text(50)
MOBILE_PHONE text(50)
Internet_Address text(200)
CONTACT_PREFIX text(50)
CONTACT_FIRST_NAME text(75)
CONTACT_LAST_NAME text(75)
TITLE1 text(150)
SIC_CODE numeric
SHIP date
PROBLTY real (4)
Mkt_Program_ID text(50)
Lead_Source text(100)
Telemarketer text(100)
HighlightComments text (16)
GeneralComments text (16)
FollowUpDate date
SalesRepComments text (16)
AssignComment text (16)
FollowUp_Type text(100)
ForecastDate date
SalesStage text(100)
CloseDate date
User_Field_1 text(300)  Special Interest 1
User_Field_2 text(300)  Special Interest 2
User_Field_3 text(300)  Special Interest 3
User_Field_14 text(300)  Special Interest 4
User_Field_15 text(300)  Special Interest 5
User_Field_16 text(300)  Special Interest 6
User_Field_41 text(300)  Special Interest 7
User_Field_42 text(300)  Special Interest 8
User_Field_43 text(300)  Special Interest 9
User_Field_44 text(300)  Special Interest 10
User_Field_45 text(300)  Special Interest 11
User_Field_46 text(300)  Special Interest 12
User_Field_17 text(300)  Special Interest 13
User_Field_18 text(300)  Special Interest 14
User_Field_19 text(300)  Special Interest 15
User_Field_20 text(300)  Special Interest 16
User_Field_21 text(300)  Special Interest 17
User_Field_22 text(300)  Special Interest 18


Sample ASP.NET call:
TypeLeadData updateObj = new TypeLeadData();
updateObj.RecordID = 143419;
updateObj.City = "Oskaloosa";
updateObj.Phone = "719-345-4444";
string result = objService.LMUpdateLead("ak36718886241893772216153743",3,updateObj);




SEARCH LEAD

Use these fields to search lead record.   Each field has the datatype that you can use to return a comma separated list of RecordIDs that fit your criteria.

Sample ASP.NET call:
TypeSearchCriteria itemSearchCriteria = new TypeSearchCriteria();

ArrayList rayInput = new ArrayList();

itemSearchCriteria.Field = "Company";
itemSearchCriteria.Operator = "LIKE";
itemSearchCriteria.FieldValue = "Sam%";
rayInput.Add(itemSearchCriteria);

itemSearchCriteria.Field = "PROBLTY";
itemSearchCriteria.Operator = ">";
itemSearchCriteria.FieldValue = ".4";
rayInput.Add(itemSearchCriteria);

TypeSearchCriteria[] inArray = (TypeSearchCriteria[])rayInput.ToArray(typeof(TypeSearchCriteria));

string listRecordID = objService.LMSearchLead("ak36718886241893772216153743", 3, inArray);

Response.Write("List of RecordIDs: " + listRecordID);


RecordID numeric --- (is required for update)
Grade text(100)
RECORD_STATUS text(100)
Lead_Status text(100)
Source_Type tinyint (1)
Company text(150)
Address text(150)
Address2 text(150)
Address3 text(150)
City text(100)
State text(50)
Zip text(25)
Country text(50)
PRI_PHONE text(50)
PRI_PHONE_EXT text(50)
PRI_PHONE2 text(50)
PRI_PHONE3 text(300)
FAX_PHONE text(50)
FAX_PHONE_EXT text(50)
MOBILE_PHONE text(50)
Internet_Address text(200)
CONTACT_PREFIX text(50)
CONTACT_FIRST_NAME text(75)
CONTACT_LAST_NAME text(75)
TITLE1 text(150)
SIC_CODE numeric
SHIP date
PROBLTY real (4)
Mkt_Program_ID text(50)
Lead_Source text(100)
Telemarketer text(100)
HighlightComments text (16)
GeneralComments text (16)
FollowUpDate date
SalesRepComments text (16)
AssignComment text (16)
FollowUp_Type text(100)
ForecastDate date
SalesStage text(100)
CloseDate date
User_Field_1 text(300)  Special Interest 1
User_Field_2 text(300)  Special Interest 2
User_Field_3 text(300)  Special Interest 3
User_Field_14 text(300)  Special Interest 4
User_Field_15 text(300)  Special Interest 5
User_Field_16 text(300)  Special Interest 6
User_Field_41 text(300)  Special Interest 7
User_Field_42 text(300)  Special Interest 8
User_Field_43 text(300)  Special Interest 9
User_Field_44 text(300)  Special Interest 10
User_Field_45 text(300)  Special Interest 11
User_Field_46 text(300)  Special Interest 12
User_Field_17 text(300)  Special Interest 13
User_Field_18 text(300)  Special Interest 14
User_Field_19 text(300)  Special Interest 15
User_Field_20 text(300)  Special Interest 16
User_Field_21 text(300)  Special Interest 17
User_Field_22 text(300)  Special Interest 18


Sample ASP.NET call:
TypeLeadData updateObj = new TypeLeadData();
updateObj.RecordID = 143419;
updateObj.City = "Oskaloosa";
updateObj.Phone = "719-345-4444";
string result = objService.LMUpdateLead("ak36718886241893772216153743",3,updateObj);



GET A LEAD RECORD

Use RecordID to get information for one lead record.  It will return a class called TypeLeadData.

Sample ASP.NET call:
TypeLeadData item = new TypeLeadData();

item = objService.LMGetLead("ak36718886241893772216153743", 3, 123435);

Response.Write("First Name: " + item.FirstName);
Response.Write("City: " + item.City);




ADD SALES MANAGER
Sales Manager Datatype:
Use the TypeSalesMgrData field to add a sales manager in the AddSalesMgr() call.

string SalesMgrFullName
string SalesMgrFirstName
string SalesMgrLastName
string SalesMgrTitle
string SalesMgrPhone
string SalesMgrFax
string SalesMgrMobile
string SalesMgrE_Mail
string SalesMgrAddress
string SalesMgrAddress2
string SalesMgrCity
string SalesMgrState
string SalesMgrZip
string SalesMgrCountry


UPDATE SALES MANAGER

Use these fields to update sales manager record.   Each field has the datatype and maximum length that you can pass.
Updating a record requires the primary key RecordID.

RecordID numeric --- (is required for update)
SalesMgrFullName text (75)
SalesMgrFirstName text (100)
SalesMgrLastName text (100)
SalesMgrTitle text (100)
SalesMgrPhone text (50)
SalesMgrFax text (50)
SalesMgrMobile text (50)
SalesMgrE_Mail text (75)
SalesMgrAddress text (75)
SalesMgrAddress2 text (75)
SalesMgrCity text (50)
SalesMgrState text (20)
SalesMgrZip text (50)
SalesMgrCountry text (20)


ADD SALES REP
SalesRep Datatype:
Use the TypeSalesRepData datatype to add a Sales Rep in the AddSalesRep() call.

string SalesRepFullName
string SalesReprFirstName
string SalesRepLastName
string SalesRepTitle
string SalesRepPhone
string SalesRepFax
string SalesRepMobile
string SalesRepE_Mail
string SalesRepAddress
string SalesRepAddress2
string SalesRepCity
string SalesRepState
string SalesRepZip
string SalesRepCountry


UPDATE SALES REP

Use these fields to update sales rep record.   Each field has the datatype and maximum length that you can pass.
Updating a record requires the primary key RecordID.

RecordID numeric --- (is required for update)
SalesRepFullName text (75)
SalesReprFirstName text (100)
SalesRepLastName text (100)
SalesRepTitle text (100)
SalesRepPhone text (50)
SalesRepFax text (50)
SalesRepMobile text (50)
SalesRepE_Mail text (75)
SalesRepAddress text (75)
SalesRepAddress2 text (75)
SalesRepCity text (50)
SalesRepState text (20)
SalesRepZIP text (50)
SalesRepCountry text (20)


ADD PARTNER
Partner Datatype:
Use the TypePartnerData datatype to add a Partner in the AddPartner() call.

string Partner_Name
string Partner_Main_Phone
string Partner_Main_Fax
string Partner_Main_E_Mail
string Partner_Main_Internet
string Partner_Address
string Partner_Address2
string Partner_City
string Partner_State
string Partner_Zip
string Partner_Country


UPDATE PARTNER

Use these fields to update partner record.   Each field has the datatype and maximum length that you can pass.
Updating a record requires the primary key RecordID.

RecordID numeric --- (is required for update)
Partner_Name text (100)
Partner_Main_Phone text (50)
Partner_Main_Fax text (50)
Partner_Mail_800 text (50)
Partner_Main_E_Mail text (75)
Partner_Main_Internet text (75)
Partner_Address text (75)
Partner_Address2 text (75)
Partner_City text (50)
Partner_State text (20)
Partner_ZIP text (50)
Partner_Country text (20)


ADD PARTNER REP
PartnerRep Datatype:
Use the TypePartnerRepData datatype to add a Partner Rep in the AddPartnerRep() call.



UPDATE PARTNER REP

Use these fields to update partner rep record.   Each field has the datatype and maximum length that you can pass.
Updating a record requires the primary key RecordID.

RecordID numeric --- (is required for update)
RepFirstName text (50)
RepLastName text (75)
RepFullName text (100)
RepTitle text (100)
RepPhone text (50)
RepFax text (50)
RepMobile text (50)
RepE_Mail text (75)
RepAddress text (75)
RepAddress2 text (75)
RepCity text (50)
RepState text (20)
RepZIP text (50)
RepCountry text (20)


ADD OPPORTUNITY
Opportunity Datatype:
Use the TypeOpportunityData datatype to add a Opportunity in the AddOpportunity() call.

int RECDNO --- (is required to attach to lead record.)
string OppName
string OppDesc
string SalesStatus
string ForecastDate
float WinProbability
int NumOfHourWork
int NumOfHourTravel
string OppSource
string OppType
string SalesStage


UPDATE OPPORTUNITY

Use these fields to update opportunity record.   Each field has the datatype and maximum length that you can pass.
Updating a record requires the primary key RecordID.

RecordID numeric --- (is required for update)
OppName text (150)
OppDesc text (500)
SalesStatus text (150)
ForecastDate date
WinProbability real
NumOfHourWork real
NumOfHourTravel real
OppSource text (250)
OppType text (60)
CloseDate date
SalesStage text (150)
CloseReason text (150)


ADD OPPORTUNITY PRODUCT - AddOpportunityProduct

Add one opportunity product and returns the new ProductID.
A return of greater than 0 means success, otherwise failure.
-2 return code -- the OppID does not exist.
OppID is used to assign the opportunity product to the opportunity record.
int ProductID = AddOpportunityProduct(string api_key, int OppID, string ProductDesc, string ProductCode, string ProductNumber, double UnitPrice, int Quantity, double ProductTotal, double Discount, string CustomC1, string CustomD1, int CustomI1, double CustomM1, double CustomN1)


UPDATE OPPORTUNITY PRODUCT - UpdateOpportunityProduct

Update one opportunity product based on the ProductID.
Returns the ProductID if successful, otherwise failure.
All fields will be updated.
int ProductID = UpdateOpportunityProduct(string api_key, int ProductID, string ProductDesc, string ProductCode, string ProductNumber, double UnitPrice, int Quantity, double ProductTotal, double Discount, string CustomC1, string CustomD1, int CustomI1, double CustomM1, double CustomN1)


DELETE OPPORTUNITY PRODUCT - DeleteOpportunity

Delete one opportunity product based on the ProductID.
Returns a 1 if successful, otherwise failure.
int returnCode = DeleteOpportunityProduct(string api_key, int ProductID)


GET OPPORTUNITY PRODUCT BY ID - GetOpportunityProductByID

Get one opportunity product information based on the ProductID.
Returns complex type TypeOpportunityProduct with the following properties:
ProductID, OppID, ProductDesc, ProductCode, ProductNumber, UnitPrice, Quantity, ProductTotal, Discount, CustomC1, CustomD1, CustomI1, CustomM1, CustomN1
TypeOpportunityProduct returnOppProduct = GetOpportunityProductByID(string api_key, int ProductID)


SEARCH OPPORTUNITY PRODUCT BY ID - SearchOpportunityProduct

Use the TypeSearchCriteria class to search for opportunity product information.
Returns one or multiple complex type TypeOpportunityProduct with the following properties:
ProductID, OppID, ProductDesc, ProductCode, ProductNumber, UnitPrice, Quantity, ProductTotal, Discount, CustomC1, CustomD1, CustomI1, CustomM1, CustomN1
The WhereClause is a WHERE SQL statement used to query the opportunity products table.
The property fields can be used in the query string, for example:
ProductDesc = 'Web Opportunity' AND ProductNumber LIKE '672736%'
CustomD1 > '5/6/2001' OR Quantity > 76
TypeOpportunityProduct[] returnOppProducts = SearchOpportunityProduct(string api_key, string WhereClause)
Sample ASP.NET call:
TypeSearchCriteria itemSearchCriteria = new TypeSearchCriteria();

ArrayList rayInput = new ArrayList();

itemSearchCriteria.Field = "ProductCode";
itemSearchCriteria.Operator = "=";
itemSearchCriteria.FieldValue = "1234";
rayInput.Add(itemSearchCriteria);

itemSearchCriteria.Field = "CustomC1";
itemSearchCriteria.Operator = "LIKE";
itemSearchCriteria.FieldValue = "MyText%";
rayInput.Add(itemSearchCriteria);

TypeSearchCriteria[] inArray = (TypeSearchCriteria[])rayInput.ToArray(typeof(TypeSearchCriteria));

TypeOpportunityProduct[] OpportunityProduct = objService.SearchOpportunityProduct("ak36718886241893772216153743", inArray);

foreach (var item in OpportunityProduct)
{
Response.Write("ProductNumber: " + item.ProductNumber);
Response.Write("ProductID: " + item.ProductID);
Response.Write("ProductDesc: " + item.ProductDesc);
}


GET OPPORTUNITY CUSTOM FORM INFORMATION - GetCustomFormInfo

https://api.leadmaster.com/API/GetCustomFormInfo?APIKey=ak36718886241893772216153743&FormID=273

* AddOppFormRecord requires FormID.
* FormID is the ID for the custom opportunity form.  This ID can be obtained from the LeadMaster application.
* This url will list all available fields to add/update.  It will list the corresponding field names to the questions.
    It will also list the values for certain questions that have a set of options....  for example, a single dropdown.  Use those numeric values to set the field.



ADD OPPORTUNITY CUSTOM FORM RECORD - LMAddOppFormRecord

* LMAddOppFormRecord(APIKey, FormID, OppID, InsertStatement)
* The InsertStatement contains fieldnames prefixed by the letter Q and their values separated by the ^ character.
For example, Q5353=Hello World^Q5342=2673^Q5342=This is a text entry
* LMAddOppFormRecord requires FormID and OppID.
* OppID is the opportunity record that you want to attach the custom opportunity form to.
* FormID is the ID for the custom opportunity form.  This ID can be obtained from the LeadMaster application.
* Each custom form field name is referenced by a unique name which can be obtained from the GetCustomFormInfo url above.

Sample C# call:
ProdLMService.LMService obj = new ProdLMService.LMService();
string returnMe = obj.LMAddOppFormRecord("ak1873346926041984638126222052", 800, 2679, "Q12448=testing2^Q12449=52424");


UPDATE OPPORTUNITY CUSTOM FORM RECORD - LMUpdateOppFormRecord

* LMUpdateOppFormRecord(APIKey, FormID, OppID, UpdateStatement)
* The UpdateStatement contains fieldnames prefixed by the letter Q and their values separated by the ^ character.
For example, Q5353=Hello World^Q5342=2673^Q5342=This is a text entry
* LMAddOppFormRecord requires FormID and OppID.
* OppID is the opportunity record that you want to update the custom opportunity form.
* FormID is the ID for the custom opportunity form.  This ID can be obtained from the LeadMaster application.
* Each custom form field name is referenced by a unique name which can be obtained from the GetCustomFormInfo url above.

Sample C# call:
ProdLMService.LMService obj = new ProdLMService.LMService();
string returnMe = obj.LMUpdateOppFormRecord("ak1873346926041984638126222052", 800, 2679, "Q12448=testing2^Q12449=52424");