![]() | |
Lookup Search |
This method is used to retrieve all available lookups.
Can be accessed via the URI [Your_SDK_Service]/api/lookup_search.
Response
Status Code: 200
Type: List(Of System.String)
A list of all available lookups.
Examples
Get all lookups.
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 lookup types that can be used for the /api/lookup_seach/{lookup_type} 6Try 7 Dim sUrl As String = SDK_SERVICE_URI & "/api/lookup_search" 8 9 Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer 10 11 Dim sResponse As String 12 Using oWebclient As New WebClient 13 oWebclient.Encoding = Encoding.UTF8 14 With oWebclient.Headers 15 .Add("AuthenticationKey", AUTHENTICATION_KEY) 16 .Add("DatabaseName", DATABASE) 17 .Add("Content-type", "application/json") 18 End With 19 Dim aResponse As Byte() = oWebclient.DownloadData(sUrl) 20 sResponse = oWebclient.Encoding.GetString(aResponse) 21 End Using 22 Dim lstLookupTypes As List(Of String) = jss.Deserialize(Of List(Of String))(sResponse) 23 For Each sLookupType As String In lstLookupTypes 24 Console.WriteLine("Lookup Type: " & sLookupType) 25 Next 26 27Catch ex As WebException 28 Dim sStatusCode As String = ex.Status.ToString 29 Dim sError As String = New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd 30 Console.WriteLine("Status Code: " & sStatusCode & ", Error: " & sError) 31Catch ex As Exception 32 Console.WriteLine(ex.Message) 33End Try
This method is used to retrieve all valid values for the specified lookup type.
Can be accessed via the URI [Your_SDK_Service]/api/lookup_search/{lookup_type}.
Requestlookup_type
Type: System.String
A lookup type for which all allowed values are returned.
Response
Status Code: 200
Type: List(Of Dictionary(Of String, String))
A dictionary containing all the valid values and their descriptions for the specified lookup.
Examples
Get all valid values for specified lookup .
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 program navigation information for the Genernal Ledger program area. 6Try 7 Dim sLookupType As String = "program_navigation" 'Can be obtained from Get /api/lookup_search 8 Dim sUrl As String = SDK_SERVICE_URI & "/api/lookup_search/" & sLookupType 9 'Get /api/lookup_search/{lookup_type} can accept a databag of input. Some lookup types such as program_navigation require data to be passed. 10 Dim dictRequest As New Dictionary(Of String, String) From { 11 {"program_area_code", "GENL"} 'Area code for General Ledger. Can be obtained from Get /api/lookup_search/program_area 12 } 13 14 Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer 15 Dim sRequestBody As String = jss.Serialize(dictRequest) 16 17 Dim sResponse As String 18 Using oWebclient As New WebClient 19 oWebclient.Encoding = Encoding.UTF8 20 With oWebclient.Headers 21 .Add("AuthenticationKey", AUTHENTICATION_KEY) 22 .Add("DatabaseName", DATABASE) 23 .Add("Content-type", "application/json") 24 End With 25 Dim aResponse As Byte() = oWebclient.UploadData(sUrl, "POST", Encoding.ASCII.GetBytes(sRequestBody)) 26 sResponse = oWebclient.Encoding.GetString(aResponse) 27 End Using 28 29 Dim lstLookupItems As List(Of Dictionary(Of String, String)) = jss.Deserialize(Of List(Of Dictionary(Of String, String)))(sResponse) 30 For Each dictLookupItem As Dictionary(Of String, String) In lstLookupItems 31 Console.WriteLine("Code: " & dictLookupItem("code")) 32 Console.WriteLine("Description: " & dictLookupItem("description")) 33 Console.WriteLine() 34 Next 35 36Catch ex As WebException 37 Dim sStatusCode As String = ex.Status.ToString 38 Dim sError As String = New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd 39 Console.WriteLine("Status Code: " & sStatusCode & ", Error: " & sError) 40Catch ex As Exception 41 Console.WriteLine(ex.Message) 42End Try
Get all valid values for "user_available_structures" lookup .
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 available structures for Configure User area . 6Try 7 Dim sLookupType As String = "user_available_structures" 'Can be obtained from Get /api/lookup_search 8 Dim sUrl As String = SDK_SERVICE_URI & "/api/lookup_search/" & sLookupType 9 'Get /api/lookup_search/user_available_structures can accept a databag of optional input data. 10 'If none of the optional data is passed (i.e. empty databag is passed in the lookup body), lookup returns all available structures. 11 'To refine search, some or all of the optional data can be passed in the lookup body, and available structures would be returned accordingly. 12 Dim dictRequest As New Dictionary(Of String, String) From { 13 {"agency_code", "A01"}, 'Can be obtained from Get_Lookup Agency 14 {"branch_code", "BRC"}, 'Can be obtained from Get_Lookup Broker 15 {"department_code", "DPT"}, 'Can be obtained from Get_Lookup Department 16 {"profit_center_code", "PFC"} 'Can be obtained from Get_Lookup ProfitCenter 17 } 18 19 Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer 20 Dim sRequestBody As String = jss.Serialize(dictRequest) 21 22 Dim sResponse As String 23 Using oWebclient As New WebClient 24 oWebclient.Encoding = Encoding.UTF8 25 With oWebclient.Headers 26 .Add("AuthenticationKey", AUTHENTICATION_KEY) 27 .Add("DatabaseName", DATABASE) 28 .Add("Content-type", "application/json") 29 End With 30 Dim aResponse As Byte() = oWebclient.UploadData(sUrl, "POST", Encoding.ASCII.GetBytes(sRequestBody)) 31 sResponse = oWebclient.Encoding.GetString(aResponse) 32 End Using 33 34 Dim lstLookupItems As List(Of Dictionary(Of String, String)) = jss.Deserialize(Of List(Of Dictionary(Of String, String)))(sResponse) 35 For Each dictLookupItem As Dictionary(Of String, String) In lstLookupItems 36 Console.WriteLine("Code: " & dictLookupItem("code")) 37 Console.WriteLine("Description: " & dictLookupItem("description")) 38 Console.WriteLine() 39 Next 40 41Catch ex As WebException 42 Dim sStatusCode As String = ex.Status.ToString 43 Dim sError As String = New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd 44 Console.WriteLine("Status Code: " & sStatusCode & ", Error: " & sError) 45Catch ex As Exception 46 Console.WriteLine(ex.Message) 47End Try