Lead API Updates

Important Note: Coding the submissions from your website AND/OR systems to the Lead API should be undertaken by your website developers. It is NOT the responsibility of AdminBase to do this for you. We do not recommend you attempt to make these changes yourself unless you are familiar with web development and calling API’s. We will answer questions and offer guidance to assist your website developers where we can.

Data Updates

Changes can be submitted to a previously submitted lead or even to a lead in AdminBase that hasn’t come through the Lead API.

Submit a Change

To submit a change you POST the data (form-urlencoded/json) to

https://webleads.abinitiosoftware.co.uk/api/LeadDetailsUpdate

or

https://webleads.abinitiosoftware.co.uk/api/LeadDetailsUpdateBatch

The reason for the choice here is that LeadDetailsUpdate takes an object, whereas LeadDetailsUpdateBatch takes an array of objects. If you don’t know what this means use LeadDetailsUpdateBatch.

Fields

The fields that can be updated are any of the fields available to the Lead API (List here) and the following:-

Leads Field Name

Type

Info

RESULT

Text(50)

Must be one of the specified results in AdminBase.

If result date is not submitted RESULTDATE will be set to the date of the update.

RESULTDATE

Text(10)

Must have a RESULT entry - if not specified result date will be ignored.

NEXTACTIONDATE

Text(10)

(NB. Must be in the format DD/MM/YYYY)

SHOWROOMVISITED

Text(5)

 (NB. Must be in the format 'True' or 'False') Alternatively, 1 or 0 can be passed

FRAMESPITCHED

Integer

 

DEMODATE

Text(10)

If not specified but Quote Value is updated the demo date will be assumed to be the date of the update. (NB. If entered then must be in the format DD/MM/YYYY)

VALUE

 Real

If demo date is submitted with no value £0 will be written

Payload

There are five key fields that need to be provided.

API Parameter

Value

Example

Token

The token returned from the main submission call

“8548d5e0-9d47-4d08-b9ec-2e0d8689c712“

AB_CUSTID

Identifier provided by us

98765

AB_PWORD

Password provided by us

“password”

Leadnumber

AdminBase Lead number

12345

ChangeAction

Either “UPD” or “INS”

“UPD“

ChangeTarget

“LEADS“

“LEADS“

ChangeField

The field to adjust

“RESULT“

ChangeValue

What to change the field to

“Dead“

ChangeAuthor

String to identify the person making the change

“Tom“

You can either provide the Token, or provide all three of the following:- AB_CUSTID, AB_PWORD, Leadnumber

The ChangeTarget is always “LEADS”

INS Fields

Although most fields can be updated there are two that cannot. For these fields the ChangeAction must be specified as “INS”. This will ensure there is no ambiguity about the desired action.

The two fields are NOTES and EMAIL. Providing these will either create a new note on the Lead within AdminBase or create a new email address and set it as the default.

UPD Fields

This is the ChangeAction you will want most of the time.

JSON Structure

Mentioned previously the LeadDetailsUpdateBatch endpoint takes an array of objects, this means the JSON has to follow the following structure for 1 or more objects:-

[
    {
        "AB_CUSTID": 98765,
        "AB_PWORD": "password",
        "leadnumber": 12345,
        "ChangeAction": "UPD",
        "ChangeTarget": "LEADS",
        "ChangeField": "POSTCODE",
        "ChangeValue": "GU3 1JH",
        "ChangeAuthor": "TOM"
    }
]

For one object - Using the credential collection

[
    {
        "token": "8548d5e0-9d47-4d08-b9ec-2e0d8689c712",
        "ChangeAction": "UPD",
        "ChangeTarget": "LEADS",
        "ChangeField": "RESULT",
        "ChangeValue": "Dead",
        "ChangeAuthor": "TOM"
    },
    {
        "token": "8548d5e0-9d47-4d08-b9ec-2e0d8689c712",
        "ChangeAction": "UPD",
        "ChangeTarget": "LEADS",
        "ChangeField": "RESULTDATE",
        "ChangeValue": "02/10/2024",
        "ChangeAuthor": "TOM"
    }
]

For two related objects - Using the token

This shows two important points.

  1. That the token/credential collection must be present in each object in the array.

  2. That some updates are reliant on other objects sent in the same batch. Setting Result here to ‘Dead’ requires that we also pass in the ‘Result Date’; so calling the LeadDetailsUpdate will not work for all updates. As such it may be easier for you to always call the LeadDetailsUpdateBatch endpoint.

Send with Token

It is possible to send an update to a lead already submitted through the Lead API by using the token. To do this you must supply the token provided to you by the API on submission of the lead originally.

Postman Example

image-20241104-151857.png
An example of sending an update via Postman using the token from a previous lead submission

Send With Lead Number

It is also possible to send an update to a lead in AdminBase even if that lead didn’t arrive through the Lead API. To do this you must supply the lead number along with your Lead API credentials.

Postman Example

image-20241104-152136.png
An example of sending an update via Postman using the Lead number and credentials

Files

Files can be attached to a previously submitted lead or even to a lead in AdminBase that hasn’t come through the Lead API. Files can be added at any time.

To Submit a Lead and Documents

A Lead is submitted in the usual fashion but with the added parameter TOKENREQ set to 1. This returns json like the following:

{
    "token": "8548d5e0-9d47-4d08-b9ec-2e0d8689c712"
}

This token value uniquely identifies the just submitted lead and can be used in a subsequent call to add a file to the lead.

You will need to send the following multipart form-data to https://webleads.abinitiosoftware.co.uk/api/Upload

API Parameter

Value

Example

Filename

The files name.

“Front porch.jpg”

Description

The files description, this will show in AdminBase

“Front porch“

Token

The token returned from the main submission call

“8548d5e0-9d47-4d08-b9ec-2e0d8689c712“

File

The file data

This is the files binary data

Postman Example

image-20241104-145032.png
An example of sending a file via Postman using the token from a previous lead submission

To Submit a Lead and Documents - JavaScript

Here is a simplified example of how to do this in JavaScript:

var handleSubmit = (event) => {
  //event.preventDefault();
  const form = document.getElementById("form");
  const inputFile = document.getElementById("file");
  const inputNote = document.getElementById("note");
  var formData = new FormData();
  //set values of formdata - these are the fields of the form i.e.
  formData.append("NOTES", inputNote.value);
  // ...
  formData.append("TOKENREQ", 1);
  formData.append("AB_CUSTID", "Your credentials");
  formData.append("AB_PWORD", "Your credentials"); 
  //send form data
  fetch("https://webleads.abinitiosoftware.co.uk/api/LeadDetails", {
    method: "post",
    body: formData,
  }).then((data) => { //if successful send file(s)
    for (const file of inputFile.files) {
      formData = new FormData();
      formData.append("file", file);
      formData.append("token", data.token);
      formData.append("description", file.name);
      formData.append("filename", file.name);
      fetch("https://webleads.abinitiosoftware.co.uk/api/Upload", {
        method: "post",
        body: formData,
      }).catch((error) => ("Something went wrong!", error));
    }
  }).catch((error) => ("Something went wrong!", error));
};

Where the html may look like:

<form id="form">
 <input type="text" id="note" />
 ...
 <input type="file" id="file" multiple />
 <button onclick="handleSubmit()">Submit</button>
</form> 

This is just an example, you are free to use any language you like to send the data across.

It is possible add multiple files by sending multiple requests to this endpoint. Do not put multiple files in the “File” field as only the first file will get processed.

If you need to submit a document to an existing lead but you don’t have a token for that submission it also possible to submit the lead number along with your credentials as follows:-

To Submit a Document to an Existing Lead

You will need to send the following multipart form-data to https://webleads.abinitiosoftware.co.uk/api/Upload

API Parameter

Value

Example

Filename

The files name. i.e. “File.pdf”

“Front porch.jpg”

Description

The files description, this will show in AdminBase i.e.

“Front porch“

Leadnumber

The lead number to attach the document to

12345

AB_CUSTID

The identifier provided to you by ourselves

98765

AB_PWORD

The password provided to you by ourselves

“password”

File

The file data

This is the files binary data

Postman Example

image-20241104-144818.png
An example of sending a file via Postman using the Lead number and credentials

It is possible to add multiple files by sending multiple requests to this endpoint. Do not put multiple files in the “File” field as only the first file will get processed.

Return Status Codes

The status codes returned from the API are the standard HTTP status codes. For example:-

Status code

Meaning

200

Success

400

Bad Request

500

Error