Lead

  • 15.5
This article is may not be up to date with the latest stable release of M4.

Description

The Lead endpoint provides the API consumer with access to methods pertaining to leads and related data objects. The endpoint allows consumers to load lead data, add new leads, and update leads.

Methods

URL base/CRM/Lead/Specification
Action GET
Description Returns a data dictionary that details the available web service methods related to the Lead endpoint.
Parameters None
 Returns  A JSON object with method descriptions
Sample Return Object
[
    {
        "HttpAction": "Get",
        "MethodName": "GetLead",
        "Description": "Returns the record for a single 'Lead' given the passed in ID value (see Path).",
        "Path": "/Lead/GetLead/25032"
    },
    {
        "HttpAction": "Get",
        "MethodName": "GetLeadByEstimate",
        "Description": "Returns the record for a single 'Lead' given the passed in Estimate ID value (see Path).",
        "Path": "/Lead/GetLeadByEstimate/25032"
    },
    {
        "HttpAction": "Get",
        "MethodName": "GetLeadByOpportunity",
        "Description": "Returns the record for a single 'Lead' given the passed in Opportunity ID value (see Path).",
        "Path": "/Lead/GetLeadByOpportunity/25032"
    },
    {
        "HttpAction": "Post",
        "MethodName": "AddLead",
        "Description": "Creates the record for a single 'Lead' and returns the Lead object",
        "Format": {
            "Name": "John Smith",
            "Phone": "8047431860",
            "Email": "email@mapcom.com",
            "AddressID": 505,
            "CreatedOn": "2018-06-11T15:35:17.7640291-04:00",
            "CreatedBy": "Mapcom",
            "StructureID": 616,
            "AssignedTo": 579
        }
    },
    {
        "HttpAction": "Post",
        "MethodName": "UpdateLead",
        "Description": "Updates the record for a single 'Lead' and returns the Lead object",
        "Format": {
            "ID": 146,
            "Name": "John Smith",
            "Phone": "8047431860",
            "Email": "email@mapcom.com",
            "AddressID": 573,
            "CreatedOn": "2018-06-11T15:35:17.7640291-04:00",
            "CreatedBy": "Mapcom",
            "StructureID": 998,
            "AssignedTo": 36
        }
    },
    {
        "HttpAction": "Get",
        "MethodName": "DeleteLead",
        "Description": "Deletes the record for a single 'Lead' given the passed in ID value (see Path).",
        "Path": "/Lead/DeleteLead/25032"
    }
]
URL base/CRM/Lead/GetLead/ID
Action GET
Description Returns a Lead object when given an ID of a valid lead in the M4 database.
Parameters
Name Required? Type Description
ID Yes Integer An integer value representing the ID of a lead in the M4 database.
Returns A JSON Lead data object
Sample Return Object
{
     "ID": 146,
     "Name": "John Smith",
     "Phone": "8047431860",
     "Email": "email@mapcom.com",
     "AddressID": 573,
     "CreatedOn": "2018-06-11T15:35:17.7640291-04:00",
     "CreatedBy": "Mapcom",
     "StructureID": 998,
     "AssignedTo": 36
}
URL base/CRM/Lead/GetLeadByEstimate/ID
Action GET
Description Returns a Lead object when given an ID of a valid Estimate in the M4 database.
Parameters
Name Required? Type Description
ID Yes Integer An integer value representing the ID of a estimate in the M4 database.
Returns A JSON Lead data object
Sample Return Object
{
     "ID": 146,
     "Name": "John Smith",
     "Phone": "8047431860",
     "Email": "email@mapcom.com",
     "AddressID": 573,
     "CreatedOn": "2018-06-11T15:35:17.7640291-04:00",
     "CreatedBy": "Mapcom",
     "StructureID": 998,
     "AssignedTo": 36
}
URL base/CRM/Lead/GetLeadByOpportunity/ID
Action GET
Description Returns a Lead object when given an ID of a valid Opportunity in the M4 database.
Parameters
Name Required? Type Description
ID Yes Integer An integer value representing the ID of a opportunity in the M4 database.
Returns A JSON Lead data object
Sample Return Object
{
     "ID": 146,
     "Name": "John Smith",
     "Phone": "8047431860",
     "Email": "email@mapcom.com",
     "AddressID": 573,
     "CreatedOn": "2018-06-11T15:35:17.7640291-04:00",
     "CreatedBy": "Mapcom",
     "StructureID": 998,
     "AssignedTo": 36
}
URL base/CRM/Lead/AddLead
Action POST
Description Adds the specified lead object and returns a the newly created lead object.
Parameters
Name Required? Type Description
Name Yes String The full name of the lead.
Phone No String The phone number of the lead.
Email No String The email of the lead.
AddressID No Integer The address ID of the lead.
CreatedOn Yes DateTime The time the lead was created.
CreatedBy Yes String The user who created the lead.
StructureID No Integer The structure ID of the lead.
AssignedTo Yes Integer The user ID that the lead is assigned to.
Sample JSON Package
{
     "Name": "John Smith",
     "Phone": "8047431860",
     "Email": "email@mapcom.com",
     "AddressID": 573,
     "CreatedOn": "2018-06-11T15:35:17.7640291-04:00",
     "CreatedBy": "Mapcom",
     "StructureID": 998,
     "AssignedTo": 36
}
Returns A JSON Lead data object
Sample Return Object
{
     "ID": 146,
     "Name": "John Smith",
     "Phone": "8047431860",
     "Email": "email@mapcom.com",
     "AddressID": 573,
     "CreatedOn": "2018-06-11T15:35:17.7640291-04:00",
     "CreatedBy": "Mapcom",
     "StructureID": 998,
     "AssignedTo": 36
}
Business Rules
Any violations of these business rules result in an appropriate error message being returned to the API consumer.
  • Name: must not be null
URL base/CRM/Lead/UpdateLead
Action POST
Description Updatesthe specified lead object and returns a the newly updated lead object.
Parameters
Name Required? Type Description
ID Yes Integer The ID of the lead.
Name Yes String The full name of the lead.
Phone No String The phone number of the lead.
Email No String The email of the lead.
AddressID No Integer The address ID of the lead.
CreatedOn Yes DateTime The time the lead was created.
CreatedBy Yes String The user who created the lead.
StructureID No Integer The structure ID of the lead.
AssignedTo Yes Integer The user ID that the lead is assigned to.
Sample JSON Package
{
     "ID": 146,
     "Name": "John Smith",
     "Phone": "8047431860",
     "Email": "email@mapcom.com",
     "AddressID": 573,
     "CreatedOn": "2018-06-11T15:35:17.7640291-04:00",
     "CreatedBy": "Mapcom",
     "StructureID": 998,
     "AssignedTo": 36
}
Returns A JSON Lead data object
Sample Return Object
{
     "ID": 146,
     "Name": "John Smith",
     "Phone": "8047431860",
     "Email": "email@mapcom.com",
     "AddressID": 573,
     "CreatedOn": "2018-06-11T15:35:17.7640291-04:00",
     "CreatedBy": "Mapcom",
     "StructureID": 998,
     "AssignedTo": 36
}
Business Rules
Any violations of these business rules result in an appropriate error message being returned to the API consumer.
  • Name: must not be null
URL base/CRM/Lead/DeleteLead/ID
Action GET
Description Deletes a Lead object when given an ID of a valid lead in the M4 database.
Parameters
Name Required? Type Description
ID Yes Integer An integer value representing the ID of a lead in the M4 database.
Returns A JSON data object
Sample Return Object
{
  "Message": "The Lead with ID [55] was deleted successfully."
}

Was this article helpful?

Related Articles