### Get Operating System Visit Data (JavaScript) Source: https://leadforensics-api.readme.io/reference/operating-systems This snippet demonstrates how to fetch operating system visit data using an AJAX GET request. It requires 'ClientID' and 'Authorization-Token' for authentication. The response contains a list of operating systems with their visit counts and percentages. ```javascript $.ajax({ type: 'GET', dataType: 'json', url: 'https://interact.leadforensics.com/WebApi_v2/KPI/OperatingSystem?dateid=14', headers: { 'Authorization-Token': 'Zax4qjY5w3tmAlqJUajROgW', 'ClientID':'45656' }, success: function (data) { if (data.OperatingSystemList.length > 0) { //we have an operating system record } else { //we do not have an operating system record } }, error: function (err) { //ajax error trap } }); ``` -------------------------------- ### Get Industry List - JavaScript AJAX Example Source: https://leadforensics-api.readme.io/reference/getindustrylist This snippet demonstrates how to retrieve a list of industries using an AJAX GET request in JavaScript. It requires a ClientID and Authorization-Token for authentication. The function handles successful responses by checking for industry records and includes error trapping for AJAX failures. ```javascript $.ajax({ type: 'GET', dataType: 'json', url: 'https://interact.leadforensics.com/WebApi_v2/Reference/GetIndustryList?pagesize=5&pageno=1', headers: { 'Authorization-Token': 'Zax4qjY5w3tmAlqJUajROgW', 'ClientID':'45656' }, success: function (data) { if (data.List.length > 0) { //we have a industry record } else { //we do not have a industry record } }, error: function (err) { //ajax error trap } }); ``` -------------------------------- ### GetVisit API Endpoint Details (OpenAPI) Source: https://leadforensics-api.readme.io/reference/getvisit The OpenAPI 3.1.0 definition for the GetVisit endpoint. It details the HTTP GET method, expected query parameters (visitid), request headers for authentication (ClientID, Authorization-Token), and the structure of successful (200) and error (400) responses, including example visit data. ```json { "openapi": "3.1.0", "info": { "title": "API Settings", "version": "1.0" }, "servers": [ { "url": "https://interact.leadforensics.com/WebApi_v2" } ], "components": { "securitySchemes": { "sec0": { "type": "apiKey", "in": "header", "name": "ClientID", "x-default": "45656" }, "sec1": { "type": "apiKey", "in": "header", "name": "Authorization-Token", "x-default": "Zax4qjY5w3tmAlqJUajROgW" } } }, "security": [ { "sec0": [], "sec1": [] } ], "paths": { "/Visit/GetVisit": { "get": { "summary": "GetVisit", "description": "", "operationId": "getvisit", "parameters": [ { "name": "visitid", "in": "query", "description": "The unique identifier for the visit to be returned", "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "200", "content": { "application/json": { "examples": { "Result": { "value": "{\n \"BusinessID\": 2745096,\n \"VisitID\": 1632401172,\n \"StartDateTime\": \"2016-04-24T02:06:31\",\n \"EndDateTime\": \"2016-04-24T02:06:34\",\n \"Keywords\": \"\",\n \"Pages\": 3,\n \"Multi\": 0,\n \"ReferrerName\": \"Direct\",\n \"ReferrerLink\": \"" } }, "schema": { "type": "object", "properties": { "BusinessID": { "type": "integer", "example": 2745096, "default": 0 }, "VisitID": { "type": "integer", "example": 1632401172, "default": 0 }, "StartDateTime": { "type": "string", "example": "2016-04-24T02:06:31" }, "EndDateTime": { "type": "string", "example": "2016-04-24T02:06:34" }, "Keywords": { "type": "string", "example": "" }, "Pages": { "type": "integer", "example": 3, "default": 0 }, "Multi": { "type": "integer", "example": 0, "default": 0 }, "ReferrerName": { "type": "string", "example": "Direct" }, "ReferrerLink": { "type": "string", "example": "" } } } } } }, "400": { "description": "400", "content": { "application/json": { "examples": { "Result": { "value": "{}" } }, "schema": { "type": "object", "properties": {} } } } } }, "deprecated": false, "x-readme": { "code-samples": [ { "language": "javascript", "code": "$.ajax({ type: 'GET', dataType: 'json', url: 'https://interact.leadforensics.com/WebApi_v2/Visit/GetVisit?visitid=1258759738', headers: { 'Authorization-Token': 'Zax4qjY5w3tmAlqJUajROgW', 'ClientID':'45656' }, success: function (data) { if (data != undefined) { //we have a visit record } else { //we do not have a visit record } }, error: function (err) { //ajax error trap } });" } ], "samples-languages": [ "javascript" ] } } } }, "x-readme": { "headers": [], "explorer-enabled": false, "proxy-enabled": false }, "x-readme-fauxas": true, "_id": "59970b303013510019572b1e:573f2069dbf53019002fab8e" } ``` -------------------------------- ### Retrieve Businesses by Category (JavaScript) Source: https://leadforensics-api.readme.io/reference/getbusinessesbycategory This JavaScript snippet demonstrates how to make a GET request to the Lead Forensics API to retrieve a list of businesses by category. It includes example API endpoint, parameters for date range and pagination, and necessary headers for authorization and client identification. The success callback handles cases where business records are found or not found, and an error callback is provided for AJAX errors. ```javascript $.ajax({ type: 'GET', dataType: 'json', url: 'https://interact.leadforensics.com/WebApi_v2/Business/GetBusinessesByCategory?categoryid=173863&datefrom=18-11-2015 00:00:00&dateto=19/11/2016 23:59:59&pagesize=5&pageno=1', headers: { 'Authorization-Token': 'Zax4qjY5w3tmAlqJUajROgW', 'ClientID':'45656' }, success: function (data) { if (data.BusinessList.length > 0) { //we have a business record } else { //we do not have a business record } }, error: function (err) { //ajax error trap } }); ``` -------------------------------- ### Retrieve Company Data (JavaScript) Source: https://leadforensics-api.readme.io/reference/watch-list Example of fetching company data from the Lead Forensics API using JavaScript's Fetch API. This snippet shows how to make a GET request and handle the JSON response. It requires a valid API key. ```javascript async function getCompanies(apiKey) { const url = `https://api.leadforensics.com/v2/companies?api_key=${apiKey}`; try { const response = await fetch(url); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log(data); return data; } catch (error) { console.error('Error fetching companies:', error); } } const apiKey = 'YOUR_API_KEY'; getCompanies(apiKey); ``` -------------------------------- ### Get Visits by Conversion - JavaScript Source: https://leadforensics-api.readme.io/reference/getvisitsbyconversion Retrieves visit data based on conversion criteria using an AJAX GET request. It requires authentication headers and handles both successful responses and errors. The response includes a SiteVisitList which can be iterated to check for visit records. ```javascript $.ajax({ type: 'GET', dataType: 'json', url: 'https://interact.leadforensics.com/WebApi_v2/Visit/GetVisitsByConversion?businessid=1101279&datefrom=10-05-2016 00:00:00&dateto=19-06-2016 23:59:59&pagesize=5&pageno=1', headers:{ 'Authorization-Token': 'Zax4qjY5w3tmAlqJUajROgW', 'ClientID':'45656' }, success: function (data) { if (data.SiteVisitList.length > 0) { //we have a visit record } else { //we do not have a visit record } }, error: function (err) { //ajax error trap } }); ``` -------------------------------- ### GET /Business/GetBusiness Source: https://leadforensics-api.readme.io/reference/testinput-1 Retrieves detailed information about a specific business using its unique identifier. ```APIDOC ## GET /Business/GetBusiness ### Description Retrieves detailed information about a specific business using its unique identifier. ### Method GET ### Endpoint https://interact.leadforensics.com/WebApi_v2/Business/GetBusiness ### Parameters #### Query Parameters - **businessid** (integer) - Required - The Lead Forensics unique business identifier ### Request Example ```json { "businessid": 1234567 } ``` ### Response #### Success Response (200) - **BusinessID** (integer) - The Lead Forensics unique business identifier - **Name** (string) - The name of the business - **AddressLine1** (string) - The first line of the business address - **AddressLine2** (string) - The second line of the business address - **AddressLine3** (string) - The third line of the business address - **Locality** (string) - The locality of the business - **Town** (string) - The town of the business - **County** (string) - The county of the business - **PostCode** (string) - The postal code of the business - **Country** (string) - The country of the business - **Telephone** (string) - The telephone number of the business - **Website** (string) - The website of the business - **Industry** (string) - The industry the business operates in - **SICCode** (string) - The Standard Industrial Classification (SIC) code - **Turnover** (string) - The business's turnover - **RegistrationNumber** (string) - The business registration number - **EmployeeNumber** (string) - The number of employees in the business #### Response Example ```json { "BusinessID": 1101281, "Name": "Bonafide Bones The Butcher", "AddressLine1": "Landsdown Road", "AddressLine2": "Willesborough", "AddressLine3": "", "Locality": "", "Town": "Ashford", "County": "Kent", "PostCode": "TN7 0PZ", "Country": "United Kingdom", "Telephone": "01233 2349 234", "Website": "http://www.bonafide-bones-the-butcher.co.uk", "Industry": "Butcher", "SICCode": "1123", "Turnover": "12231", "RegistrationNumber": "1341", "EmployeeNumber": "1-20" } ``` ``` -------------------------------- ### GET /Visit/GetVisitsByBusiness Source: https://leadforensics-api.readme.io/reference/getvisitsbybusiness Retrieves a list of website visits for a specific business, with options for date filtering and pagination. ```APIDOC ## GET /Visit/GetVisitsByBusiness ### Description Retrieves a list of website visits for a specific business. You can filter the results by date range and control the pagination of the returned data. ### Method GET ### Endpoint https://interact.leadforensics.com/WebApi_v2/Visit/GetVisitsByBusiness ### Parameters #### Query Parameters - **businessid** (integer) - Required - The unique identifier for the business to return the visits for. - **datefrom** (string) - Optional - The date from which the businesses have visited (YYYY-MM-DD). - **dateto** (string) - Optional - The date to which the businesses have visited (YYYY-MM-DD). - **pagesize** (string) - Optional - Number of records to return in a page of results. - **pageno** (string) - Optional - The particular page of results to return. ### Request Example ```json { "query": { "businessid": 1101279, "datefrom": "2016-05-01", "dateto": "2016-05-31", "pagesize": "10", "pageno": "1" } } ``` ### Response #### Success Response (200) - **SiteVisitList** (array) - A list of site visit objects. - **BusinessID** (integer) - The ID of the business. - **VisitID** (integer) - The unique ID of the visit. - **StartDateTime** (string) - The start date and time of the visit (YYYY-MM-DDTHH:MM:SS). - **EndDateTime** (string) - The end date and time of the visit (YYYY-MM-DDTHH:MM:SS). - **Keywords** (string) - Keywords associated with the visit. - **Pages** (integer) - The number of pages visited. - **Multi** (integer) - Indicates if it was a multi-page visit. - **ReferrerName** (string) - The name of the referrer. - **ReferrerLink** (string) - The URL of the referrer. - **PageSize** (integer) - The number of records per page. - **PageCount** (integer) - The total number of pages. - **RecordCount** (integer) - The total number of records. - **CurrentPage** (integer) - The current page number. #### Response Example ```json { "SiteVisitList": [ { "BusinessID": 1101279, "VisitID": 1258759732, "StartDateTime": "2016-05-30T15:58:35", "EndDateTime": "2016-05-30T15:58:35", "Keywords": "", "Pages": 1, "Multi": 1, "ReferrerName": "Google", "ReferrerLink": "http://www.google.co.uk" } ], "PageSize": 2, "PageCount": 1, "RecordCount": 1, "CurrentPage": 1 } ``` ``` -------------------------------- ### Get Pages by Visit - JavaScript AJAX Example Source: https://leadforensics-api.readme.io/reference/getpagesbyvisit This JavaScript code snippet demonstrates how to retrieve page visit information using an AJAX GET request to the Lead Forensics WebApi_v2. It requires a visit ID, page size, and page number as parameters. The function handles both successful responses and errors. ```javascript $.ajax({ type: 'GET', dataType: 'json', url: 'https://interact.leadforensics.com/WebApi_v2/Page/GetPagesByVisit?visitid=1258759738&pagesize=10&pageno=1', headers: { 'Authorization-Token': 'Zax4qjY5w3tmAlqJUajROgW', 'ClientID':'45656' }, success: function (data) { if (data.PageVisitList.length > 0) { //we have a page record } else { //we do not have a page record } }, error: function (err) { //ajax error trap } }); ``` -------------------------------- ### API Authentication Example (cURL) Source: https://leadforensics-api.readme.io/reference/watch-list Demonstrates how to authenticate with the Lead Forensics API using an API key via cURL. This is a common method for server-to-server communication. Ensure your API key is kept secure. ```shell curl -X GET "https://api.leadforensics.com/v2/companies?api_key=YOUR_API_KEY" ``` -------------------------------- ### Get Date List OpenAPI Definition Source: https://leadforensics-api.readme.io/reference/getdatelist This is the OpenAPI 3.1.0 definition for the GetDateList endpoint. It specifies the request method (GET), server URL, security schemes (ClientID and Authorization-Token), and the structure of the successful (200) and error (400) responses. It also includes an example of the expected JSON response for the 'Result' case. ```json { "openapi": "3.1.0", "info": { "title": "API Settings", "version": "1.0" }, "servers": [ { "url": "https://interact.leadforensics.com/WebApi_v2" } ], "components": { "securitySchemes": { "sec0": { "type": "apiKey", "in": "header", "name": "ClientID", "x-default": "45656" }, "sec1": { "type": "apiKey", "in": "header", "name": "Authorization-Token", "x-default": "Zax4qjY5w3tmAlqJUajROgW" } } }, "security": [ { "sec0": [], "sec1": [] } ], "paths": { "/Reference/GetDateList": { "get": { "summary": "GetDateList", "description": "", "operationId": "getdatelist", "responses": { "200": { "description": "200", "content": { "application/json": { "examples": { "Result": { "value": "{\n \"List\": [\n {\n \"ID\": 1,\n \"Name\": \"Today\"\n },\n {\n \"ID\": 2,\n \"Name\": \"Last 2 Days\"\n },\n {\n \"ID\": 3,\n \"Name\": \"Last 3 Days\"\n },\n {\n \"ID\": 4,\n \"Name\": \"Last 4 Days\"\n },\n {\n \"ID\": 5,\n \"Name\": \"Last 5 Days\"\n },\n {\n \"ID\": 6,\n \"Name\": \"Last 6 Days\"\n },\n {\n \"ID\": 7,\n \"Name\": \"Last 7 Days\"\n },\n {\n \"ID\": 14,\n \"Name\": \"Last 14 Days\"\n }\n ],\n \"PageSize\": 100,\n \"PageCount\": 1,\n \"RecordCount\": 8,\n \"CurrentPage\": 1\n}" } }, "schema": { "type": "object", "properties": { "List": { "type": "array", "items": { "type": "object", "properties": { "ID": { "type": "integer", "example": 1, "default": 0 }, "Name": { "type": "string", "example": "Today" } } } }, "PageSize": { "type": "integer", "example": 100, "default": 0 }, "PageCount": { "type": "integer", "example": 1, "default": 0 }, "RecordCount": { "type": "integer", "example": 8, "default": 0 }, "CurrentPage": { "type": "integer", "example": 1, "default": 0 } } } } } }, "400": { "description": "400", "content": { "application/json": { "examples": { "Result": { "value": "{}" } }, "schema": { "type": "object", "properties": {} } } } } }, "deprecated": false, "security": [], "x-readme": { "code-samples": [ { "language": "javascript", "code": "$.ajax({ \n type: 'GET', \n dataType: 'json', \n url: 'https://interact.leadforensics.com/WebApi_v2/Reference/GetDateList', \n headers:{\n 'Authorization-Token': 'Zax4qjY5w3tmAlqJUajROgW',\n 'ClientID':'45656'\n },\n success: function (data) { \n if (data.List.length > 0) {\n //we have a date record \n }\n else {\n //we do not have a date record \n }\n }, \n error: function (err) { \n //ajax error trap \n } \n});" } ], "samples-languages": [ "javascript" ] } } } }, "x-readme": { "headers": [], "explorer-enabled": false, "proxy-enabled": false }, "x-readme-fauxas": true, "_id": "59970b303013510019572b1e:573f1f73176bea2b000e96e0" } ``` -------------------------------- ### GET /Visit/GetVisitDetails Source: https://leadforensics-api.readme.io/reference/getvisitdetails Retrieves detailed information about a specific website visit, including conversion data, assignees, duration, browser, operating system, and device. ```APIDOC ## GET /Visit/GetVisitDetails ### Description Retrieves detailed information about a specific website visit. ### Method GET ### Endpoint https://interact.leadforensics.com/WebApi_v2/Visit/GetVisitDetails ### Parameters #### Query Parameters - **visitid** (integer) - Required - The unique identifier for the visit details to be returned ### Request Example ```json { "visitid": 1234567890 } ``` ### Response #### Success Response (200) - **Conversions** (array) - A list of conversions associated with the visit. - **Name** (string) - The name of the conversion. - **Assignees** (array) - A list of users assigned to the visit. - **ClientUserID** (string) - The unique identifier for the assignee. - **Name** (string) - The name of the assignee. - **Duration** (string) - The duration of the visit (e.g., "HH:MM:SS"). - **Browser** (string) - The browser used during the visit. - **OperatingSystem** (string) - The operating system used during the visit. - **Device** (string) - The type of device used during the visit. #### Response Example ```json { "Conversions": [ { "Name": "Example Conversion 1" }, { "Name": "Example Conversion 2" } ], "Assignees": [ { "ClientUserID": "123456", "Name": "User Name 1" }, { "ClientUserID": "654321", "Name": "User Name 2" }, { "ClientUserID": "615243", "Name": "User Name 3" } ], "Duration": "00:01:13", "Browser": "Firefox", "OperatingSystem": "Windows", "Device": "PC" } ``` ``` -------------------------------- ### Get Assigned To List - JavaScript Example Source: https://leadforensics-api.readme.io/reference/getassignedtolist This JavaScript code snippet demonstrates how to call the GetAssignedToList endpoint using jQuery's AJAX method. It retrieves a paginated list of assigned to records and includes error handling. The call requires ClientID and Authorization-Token headers for authentication. ```javascript $.ajax({ type: 'GET', dataType: 'json', url: 'https://interact.leadforensics.com/WebApi_v2/Reference/GetAssignedToList?pagesize=5&pageno=1', headers: { 'Authorization-Token': 'Zax4qjY5w3tmAlqJUajROgW', 'ClientID':'45656' }, success: function (data) { if (data.List.length > 0) { //we have an assigned to record } else { //we do not have an assigned to record } }, error: function (err) { //ajax error trap } }); ``` -------------------------------- ### GET /KPI/OperatingSystem Source: https://leadforensics-api.readme.io/reference/operating-systems Returns the number of visits made by operating system for the date range supplied. Requires ClientID and Authorization-Token headers. ```APIDOC ## GET /KPI/OperatingSystem ### Description Returns the number of visits made by operating system for the date range supplied. ### Method GET ### Endpoint https://interact.leadforensics.com/WebApi_v2/KPI/OperatingSystem ### Parameters #### Query Parameters - **dateid** (integer) - Optional - The date range to return the results for (detailed in the GetDateList reference call). Defaults to 1. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **Description** (string) - A description of the data returned. - **OperatingSystemList** (array) - A list of operating systems and their visit counts. - **OS** (string) - The name of the operating system. - **Count** (integer) - The number of visits from this operating system. - **Percentage** (integer) - The percentage of total visits from this operating system. #### Response Example ```json { "Description": "The number of visits made by operating system for the date range supplied", "OperatingSystemList": [ { "OS": "Windows Vista", "Count": 5, "Percentage": 100 } ] } ``` #### Error Response (400) - **(object)** - An empty object indicating a bad request. #### Error Response Example ```json { "example": "{}" } ``` ``` -------------------------------- ### Retrieve Business Data with JavaScript Source: https://leadforensics-api.readme.io/reference/getbusinessesbyassignedto This JavaScript snippet demonstrates how to make a GET request to the Lead Forensics API to retrieve business data. It includes setting up the AJAX call, specifying the URL, headers for authentication and client identification, and handling success or error responses. Ensure you replace placeholder values with your actual credentials and desired date ranges. ```javascript $.ajax({ type: 'GET', dataType: 'json', url: 'https://interact.leadforensics.com/WebApi_v2/Business/GetBusinessesByAssignedTo?clientuserid=192301&datefrom=18-11-2015 00:00:00&dateto=19/11/2016 23:59:59&pagesize=5&pageno=1', headers: { 'Authorization-Token': 'Zax4qjY5w3tmAlqJUajROgW', 'ClientID':'45656' }, success: function (data) { if (data.BusinessList.length > 0) { //we have a business record } else { //we do not have a business record } }, error: function (err) { //ajax error trap } }); ``` -------------------------------- ### GET /KPI/ReferringSites Source: https://leadforensics-api.readme.io/reference/referring-sites Fetches a list of referring sites for a given date range. Requires ClientID and Authorization-Token headers. ```APIDOC ## GET /KPI/ReferringSites ### Description Returns the referring sites for a client site in a particular date range supplied. ### Method GET ### Endpoint https://interact.leadforensics.com/WebApi_v2/KPI/ReferringSites ### Parameters #### Query Parameters - **dateid** (integer) - Optional - The date range to return the results for (detailed in the GetDateList reference call). Defaults to 1. ### Request Headers - **ClientID** (apiKey) - Required - **Authorization-Token** (apiKey) - Required ### Request Example ```javascript $.ajax({ type: 'GET', dataType: 'json', url: 'https://interact.leadforensics.com/WebApi_v2/KPI/ReferringSites?dateid=2', headers: { 'Authorization-Token': 'Zax4qjY5w3tmAlqJUajROgW', 'ClientID':'45656' }, success: function (data) { if (data.ReferringSiteList.length > 0) { //we have a referring site record } else { //we do not have a referring site record } }, error: function (err) { //ajax error trap } }); ``` ### Response #### Success Response (200) - **Description** (string) - A description of the returned data. - **ReferringSiteList** (array) - A list of referring sites. - **Name** (string) - The name of the referring site. - **Hits** (integer) - The number of hits from this referring site. - **Image** (string) - The image associated with the referring site. - **Percentage** (integer) - The percentage of traffic from this referring site. #### Response Example ```json { "Description": "The referring sites for a client site in a particular date range", "ReferringSiteList": [ { "Name": "Google (Other)", "Hits": 5, "Image": "Google.png", "Percentage": 100 }, { "Name": "Google (PPC)", "Hits": 0, "Image": "GooglePPC.png", "Percentage": 0 } ] } ``` #### Error Response (400) An empty JSON object is returned in case of a bad request. ```json {} ``` ``` -------------------------------- ### GetAllBusinesses Source: https://leadforensics-api.readme.io/reference/testinput Retrieves all businesses that have visited the client site within a given date range. ```APIDOC ## GET /businesses ### Description Returns all of the businesses who have visited the client site between the date range provided. ### Method GET ### Endpoint /businesses ### Parameters #### Query Parameters - **startDate** (string) - Required - The start date for the date range (e.g., YYYY-MM-DD). - **endDate** (string) - Required - The end date for the date range (e.g., YYYY-MM-DD). ### Request Example ``` GET /businesses?startDate=2023-01-01&endDate=2023-01-31 ``` ### Response #### Success Response (200) - **businesses** (array) - A list of business objects. - **name** (string) - The name of the business. - **visitCount** (integer) - The number of times the business visited. - **lastVisit** (string) - The date of the last visit. #### Response Example ```json { "businesses": [ { "name": "Example Corp", "visitCount": 5, "lastVisit": "2023-01-15" } ] } ``` ``` -------------------------------- ### GET /WebApi_v2/Business/GetAllBusinesses Source: https://leadforensics-api.readme.io/reference/index Retrieves a list of businesses that have visited the client's site within a specified date range. Supports pagination and sorting. ```APIDOC ## GET /WebApi_v2/Business/GetAllBusinesses ### Description Returns all of the businesses who have visited the client site between the date range provided. ### Method GET ### Endpoint https://interact.leadforensics.com/WebApi_v2/Business/GetAllBusinesses ### Parameters #### Query Parameters - **datefrom** (date) - Required - Defaults to 2016-03-12 00:00:00. The date from which the businesses have visited. - **dateto** (date) - Required - Defaults to 2016-03-13 00:00:00. The date to which the businesses have visited. - **pagesize** (int32) - Required - Defaults to 5. Number of records to return in a page of results. - **pageno** (int32) - Required - Defaults to 1. The particular page of results to return. ### Request Example ```javascript $.ajax({ type: 'GET', dataType: 'json', url: 'https://interact.leadforensics.com/WebApi_v2/Business/GetAllBusinesses?datefrom=10-05-2016 00:00:00&dateto=12-06-2016 23:59:59&pagesize=5&pageno=1', headers: { 'Authorization-Token': 'Zax4qjY5w3tmAlqJUajROgW', 'ClientID':'45656' }, success: function (data) { if (data.BusinessList.length > 0) { //we have a business record } else { //we do not have a business record } }, error: function (err) { //ajax error trap } }); ``` ### Response #### Success Response (200) - **BusinessList** (array of objects) - Contains a list of business objects. - **BusinessID** (integer) - Defaults to 0. - **Name** (string) - **AddressLine1** (string) - **AddressLine2** (string) - **AddressLine3** (string) - **Locality** (string) - **Town** (string) - **County** (string) - **PostCode** (string) - **Country** (string) - **Telephone** (string) - **Website** (string) - **Industry** (string) - **SICCode** (string) - **Turnover** (string) - **RegistrationNumber** (string) - **EmployeeNumber** (string) - **PageSize** (integer) - Defaults to 0. - **PageCount** (integer) - Defaults to 0. - **RecordCount** (integer) - Defaults to 0. - **CurrentPage** (integer) - Defaults to 0. #### Response Example ```json { "BusinessList": [ { "BusinessID": 12345, "Name": "Example Corp", "AddressLine1": "123 Main St", "AddressLine2": null, "AddressLine3": null, "Locality": "Anytown", "Town": "Anytown", "County": "Anycounty", "PostCode": "AB1 2CD", "Country": "United Kingdom", "Telephone": "01234567890", "Website": "https://www.example.com", "Industry": "Technology", "SICCode": "6201", "Turnover": "£1M - £5M", "RegistrationNumber": "1234567", "EmployeeNumber": "50-100", "PageSize": 5, "PageCount": 10, "RecordCount": 50, "CurrentPage": 1 } ], "PageSize": 5, "PageCount": 10, "RecordCount": 50, "CurrentPage": 1 } ``` #### Error Response (400) - **Error** (object) - Contains error details. #### Error Response Example ```json { "Error": { "Message": "Invalid date format provided." } } ``` ``` -------------------------------- ### Get Most Active Companies via AJAX (JavaScript) Source: https://leadforensics-api.readme.io/reference/most-active-companies This snippet demonstrates how to retrieve a list of the most active companies using an AJAX GET request. It requires the 'Authorization-Token' and 'ClientID' headers for authentication. The success callback processes the 'MostActiveCompaniesList', while the error callback handles potential request failures. ```javascript $.ajax({ type: 'GET', dataType: 'json', url: 'https://interact.leadforensics.com/WebApi_v2/KPI/MostActiveCompanies?dateid=14&numberOfResults=2', headers: { 'Authorization-Token': 'Zax4qjY5w3tmAlqJUajROgW', 'ClientID':'45656' }, success: function (data) { if (data.MostActiveCompaniesList.length > 0) { //we have an active company record } else { //we do not have an active company record } }, error: function (err) { //ajax error trap } }); ``` -------------------------------- ### Get Keywords Data (JavaScript) Source: https://leadforensics-api.readme.io/reference/keywords This snippet demonstrates how to retrieve keyword visit data using an AJAX GET request. It requires 'ClientID' and 'Authorization-Token' headers for authentication. The response contains a 'KeywordList' array, which can be processed to check for records. ```javascript $.ajax({ type: 'GET', dataType: 'json', url: 'https://interact.leadforensics.com/WebApi_v2/KPI/Keywords?dateid=14&numberOfResults=10', headers: { 'Authorization-Token': 'Zax4qjY5w3tmAlqJUajROgW', 'ClientID':'45656' }, success: function (data) { if (data.KeywordList.length > 0) { //we have a Keyword record } else { //we do not have a Keyword record } }, error: function (err) { //ajax error trap } }); ``` -------------------------------- ### OpenAPI 3.1.0 Definition for Lead Forensics API Source: https://leadforensics-api.readme.io/reference/getbusinessesbyassignedto This snippet defines the OpenAPI 3.1.0 specification for the Lead Forensics API. It includes server information, security schemes for API key authentication, and details for the 'GetBusinessesByAssignedTo' endpoint, specifying its parameters and response structure. ```json { "openapi": "3.1.0", "info": { "title": "API Settings", "version": "1.0" }, "servers": [ { "url": "https://interact.leadforensics.com/WebApi_v2" } ], "components": { "securitySchemes": { "sec0": { "type": "apiKey", "in": "header", "name": "ClientID", "x-default": "45656" }, "sec1": { "type": "apiKey", "in": "header", "name": "Authorization-Token", "x-default": "Zax4qjY5w3tmAlqJUajROgW" } } }, "security": [ { "sec0": [], "sec1": [] } ], "paths": { "/Business/GetBusinessesByAssignedTo": { "get": { "summary": "GetBusinessesByAssignedTo", "description": "", "operationId": "getbusinessesbyassignedto", "parameters": [ { "name": "clientuserid", "in": "query", "description": "The unique identifier for the user that the businesses are assigned to", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "datefrom", "in": "query", "description": "The date from which the businesses have visited", "required": true, "schema": { "type": "string" } }, { "name": "dateto", "in": "query", "description": "The date to which the businesses have visited", "required": true, "schema": { "type": "string" } }, { "name": "pagesize", "in": "query", "description": "Number of records to return in a page of results", "required": true, "schema": { "type": "string" } }, { "name": "pageno", "in": "query", "description": "The particular page of results to return", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "200", "content": { "application/json": { "examples": { "Result": { "value": "{\n \"BusinessList\": [\n {\n \"BusinessID\": 1101275,\n \"Name\": \"Ferret Acupuncture\",\n \"AddressLine1\": \"1400 King Street\",\n \"AddressLine2\": \"\",\n \"AddressLine3\": \"\",\n \"Locality\": \"\",\n \"Town\": \"Thretford\",\n \"County\": \"Lincolnshire\",\n \"PostCode\": \"IP24 2ZP\",\n \"Country\": \"United Kingdom\",\n \"Telephone\": \"01842 2323346\",\n \"Website\": \"http://www.Ferret-Acupuncture.org\",\n \"Industry\": \"Pricking Fettets\",\n \"SICCode\": \"67845\",\n \"Turnover\": \"67865\",\n \"RegistrationNumber\": \"8645666\",\n \"EmployeeNumber\": \"\"\n }\n ],\n \"PageSize\": 5,\n \"PageCount\": 1,\n \"RecordCount\": 1,\n \"CurrentPage\": 1\n}" } }, "schema": { "type": "object", "properties": { "BusinessList": { "type": "array", "items": { "type": "object", "properties": { "BusinessID": { "type": "integer", "example": 1101275, "default": 0 }, "Name": { "type": "string", "example": "Ferret Acupuncture" }, "AddressLine1": { "type": "string", "example": "1400 King Street" }, "AddressLine2": { "type": "string", "example": "" }, "AddressLine3": { "type": "string", "example": "" }, "Locality": { "type": "string", "example": "" }, "Town": { "type": "string", "example": "Thretford" }, "County": { "type": "string", "example": "Lincolnshire" }, "PostCode": { "type": "string" } } } }, "PageSize": { "type": "integer" }, "PageCount": { "type": "integer" }, "RecordCount": { "type": "integer" }, "CurrentPage": { "type": "integer" } } } } } } } } } } } ```