![]() | |
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