![]() | |
LoginsSearch |
This method is used to retrieve logins. In other words, this method mimics the Epic behavior of the following screens:
Can be accessed via the URI [Your_SDK_Service]/api/login_search?fields={properties}.
Request Parameters
fields
Type: System.String
Specify the properties that the partial response will contain. Accepted values can be string separated by comma. If not present, the response will contain all properties.
Request Body
Resource Representation: LoginFilter
Response
Status Code: 200
Type: List(Of Login)
A list of Logins that match the input information.
Examples
Get logins.
1Friend Sub GetLogins() 2 ' ' Comments For Documentation 3 ' Dim SDK_SERVICE_URI As New Uri("https://Fully_Qualified_Service_Computer_Name/SDK_Service") 4 ' Constant DATABASE preset to current database name 5 ' Constant AUTHENTICATION_KEY set to current authentication key 6 7 'This sample will retrieve the Login for the specified user Code. 8 Try 9 Dim sLoginUrl As String = SDK_SERVICE_URI & "/api/login_search?fields=user_code,full_name" 10 11 Dim dictGetRequest As New Dictionary(Of String, String) From { 12 {"user_code", "ENTERPRISEADMIN"}, 'user code for Login. Can be obtained from Post /api/lookup_search. 13 {"Include_inactive", "True"} 'inactive user codes to be included. 14 } 15 16 Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer 17 Dim sLoginGetRequestBody As String = jss.Serialize(dictGetRequest) 18 19 Dim sResponse As String 20 Using oWebclient As New WebClient 21 oWebclient.Encoding = Encoding.UTF8 22 With oWebclient.Headers 23 .Add("AuthenticationKey", AUTHENTICATION_KEY) 24 .Add("DatabaseName", DATABASE) 25 .Add("Content-type", "application/json") 26 End With 27 Dim aResponse As Byte() = oWebclient.UploadData(sLoginUrl, "POST", Encoding.ASCII.GetBytes(sLoginGetRequestBody)) 28 sResponse = oWebclient.Encoding.GetString(aResponse) 29 End Using 30 Dim lstLogin As List(Of Dictionary(Of String, String)) = jss.Deserialize(Of List(Of Dictionary(Of String, String)))(sResponse) 31 For Each dictLogin As Dictionary(Of String, String) In lstLogin 32 Console.WriteLine("User Code: " & dictLogin("user_code")) 33 Console.WriteLine("Full Name: " & dictLogin("full_name")) 34 Console.WriteLine() 35 Next 36 37 Catch 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) 41 Catch ex As Exception 42 Console.WriteLine(ex.Message) 43 End Try 44 45 ' ' Comments For Documentation 46End Sub