Click or drag to resize

LeadsInbox Search

SDK provides functionality to get the leads for a particular tenant. This exposes similar functionality as clicking the LeadsInbox section in Epic UI.
Post /api/leadsinbox_search

This method is used to retrieve summary of all leads based on a specified search criteria.

Leads Inbox Search Home
Leads Inbox Search Detail

Can be accessed via the URI [Your_SDK_Service]/api/leadsinbox_search.

Request Body

Response

  • Status Code: 200

    Type: LeadsInboxGetResult

    A list of lead summaries that match search criteria.

Examples

Get all leads.

VB
 1' Dim SDK_SERVICE_URI As New Uri("https://Fully_Qualified_Service_Computer_Name/SDK_Service")
 2' Constant DATABASE preset to current database name
 3' Constant AUTHENTICATION_KEY set to current authentication key
 4
 5'This sample will retrieve all leads for the tenant of the environment.
 6Try
 7  Dim sUrl As String = SDK_SERVICE_URI & "/api/leadsinbox_search"
 8
 9  Dim sLeadsInboxFilter As String = String.Empty 'If no value is provided in the filter, then all leads(open,imported,archived etc.) for the specific tenant will be returned.
10
11  ''** The default and max pageSize is 100. 
12
13  Dim sResponse As String
14  Using oWebclient As New WebClient
15    oWebclient.Encoding = Encoding.UTF8
16    With oWebclient.Headers
17      .Add("AuthenticationKey", AUTHENTICATION_KEY)
18      .Add("DatabaseName", DATABASE)
19      .Add("Content-type", "application/json")
20    End With
21    Dim aResponse As Byte() = oWebclient.UploadData(sUrl, "POST", Encoding.ASCII.GetBytes(sLeadsInboxFilter))
22    sResponse = oWebclient.Encoding.GetString(aResponse)
23  End Using
24  Console.WriteLine(sResponse)
25
26Catch ex As WebException
27  Dim sStatusCode As String = ex.Status.ToString
28  Dim sError As String = New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd
29  Console.WriteLine("Status Code: " & sStatusCode & ", Error: " & sError)
30Catch ex As Exception
31  Console.WriteLine(ex.Message)
32End Try

Get selected imported leads.

VB
 1' Dim SDK_SERVICE_URI As New Uri("https://Fully_Qualified_Service_Computer_Name/SDK_Service")
 2' Constant DATABASE preset to current database name
 3' Constant AUTHENTICATION_KEY set to current authentication key
 4
 5'This sample will retrieve the leads of the specified lead guids that are imported.
 6Try
 7  Dim sUrl As String = SDK_SERVICE_URI & "/api/leadsinbox_search"
 8
 9  Dim dictLeadsInboxFilter As New Dictionary(Of String, Object) From { 'If no value is provided in the filter all leads(open,imported,archived etc.) for the specific tenant will be returned.
10    {"lead_inbox_guids", {"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"}}, 'list of lead guids to search
11    {"status_code", {"1"}} 'Code for 'Imported'. Can be obtained from Post /api/lookup_search/leads_inbox_status_code
12  }
13
14  ''** The default and max pageSize is 100. 
15  ''** If you want to search lead_inbox_guids that doesn't exist on the first page you have to set the pages property in the filter and
16  ''   loop through all the pages to find the appropriate lead_inbox_guid. The 'total_pages' property in the result set gives you the total number of pages.  
17
18  Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer
19  Dim sRequestBody As String = jss.Serialize(dictLeadsInboxFilter)
20
21  Dim sResponse As String
22  Using oWebclient As New WebClient
23    oWebclient.Encoding = Encoding.UTF8
24    With oWebclient.Headers
25      .Add("AuthenticationKey", AUTHENTICATION_KEY)
26      .Add("DatabaseName", DATABASE)
27      .Add("Content-type", "application/json")
28    End With
29    Dim aResponse As Byte() = oWebclient.UploadData(sUrl, "POST", Encoding.ASCII.GetBytes(sRequestBody))
30    sResponse = oWebclient.Encoding.GetString(aResponse)
31  End Using
32  Console.WriteLine(sResponse)
33
34Catch ex As WebException
35  Dim sStatusCode As String = ex.Status.ToString
36  Dim sError As String = New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd
37  Console.WriteLine("Status Code: " & sStatusCode & ", Error: " & sError)
38Catch ex As Exception
39  Console.WriteLine(ex.Message)
40End Try

Get imported leads within an imported date range.

VB
 1' Dim SDK_SERVICE_URI As New Uri("https://Fully_Qualified_Service_Computer_Name/SDK_Service")
 2' Constant DATABASE preset to current database name
 3' Constant AUTHENTICATION_KEY set to current authentication key
 4
 5'This sample will retrieve the leads within the specified date range that are imported.
 6Try
 7  Dim sUrl As String = SDK_SERVICE_URI & "/api/leadsinbox_search"
 8
 9  Dim dictImportedDateRange As New Dictionary(Of String, Object) From {
10    {"starts", "4/23/2020 11:55:00 AM"},
11    {"ends", "4/29/2020 12:00:00 AM"}
12  }
13
14  Dim dictLeadsInboxFilter As New Dictionary(Of String, Object) From { 'If no value is provided in the filter all leads(open,imported,archived etc.) for the specific tenant will be returned.
15    {"imported_date", dictImportedDateRange},
16    {"status_code", {"1"}} 'Code for 'Imported'. Can be obtained from Post /api/lookup_search/leads_inbox_status_code
17  }
18
19  ''** The default and max pageSize is 100. 
20
21  Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer
22  Dim sRequestBody As String = jss.Serialize(dictLeadsInboxFilter)
23
24  Dim sResponse As String
25  Using oWebclient As New WebClient
26    oWebclient.Encoding = Encoding.UTF8
27    With oWebclient.Headers
28      .Add("AuthenticationKey", AUTHENTICATION_KEY)
29      .Add("DatabaseName", DATABASE)
30      .Add("Content-type", "application/json")
31    End With
32    Dim aResponse As Byte() = oWebclient.UploadData(sUrl, "POST", Encoding.ASCII.GetBytes(sRequestBody))
33    sResponse = oWebclient.Encoding.GetString(aResponse)
34  End Using
35  Console.WriteLine(sResponse)
36
37Catch ex As WebException
38  Dim sStatusCode As String = ex.Status.ToString
39  Dim sError As String = New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd
40  Console.WriteLine("Status Code: " & sStatusCode & ", Error: " & sError)
41Catch ex As Exception
42  Console.WriteLine(ex.Message)
43End Try

Get leads with import failure and reason for failure.

VB
 1' Dim SDK_SERVICE_URI As New Uri("https://Fully_Qualified_Service_Computer_Name/SDK_Service")
 2' Constant DATABASE preset to current database name
 3' Constant AUTHENTICATION_KEY set to current authentication key
 4
 5'This sample will retrieve the leads that where the imported failed.
 6Try
 7  Dim sUrl As String = SDK_SERVICE_URI & "/api/leadsinbox_search"
 8
 9  Dim dictLeadsInboxFilter As New Dictionary(Of String, Object) From { 'If no value is provided in the filter all leads(open,imported,archived etc.) for the specific tenant will be returned.
10    {"status_code", {"2"}} 'Code for 'ImportFailed'. Can be obtained from Post /api/lookup_search/leads_inbox_status_code
11  }
12
13  ''** The default and max pageSize is 100. 
14
15  Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer
16  Dim sRequestBody As String = jss.Serialize(dictLeadsInboxFilter)
17
18  Dim sResponse As String
19  Using oWebclient As New WebClient
20    oWebclient.Encoding = Encoding.UTF8
21    With oWebclient.Headers
22      .Add("AuthenticationKey", AUTHENTICATION_KEY)
23      .Add("DatabaseName", DATABASE)
24      .Add("Content-type", "application/json")
25    End With
26    Dim aResponse As Byte() = oWebclient.UploadData(sUrl, "POST", Encoding.ASCII.GetBytes(sRequestBody))
27    sResponse = oWebclient.Encoding.GetString(aResponse)
28  End Using
29  Console.WriteLine(sResponse)
30
31Catch ex As WebException
32  Dim sStatusCode As String = ex.Status.ToString
33  Dim sError As String = New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd
34  Console.WriteLine("Status Code: " & sStatusCode & ", Error: " & sError)
35Catch ex As Exception
36  Console.WriteLine(ex.Message)
37End Try
See Also