Click or drag to resize

Ratings

SDK provides the ability to retrieve rating information. In other words it exposes the same information as viewing the ratings screen in Epic UI except through an api.
Get /api/ratings?line_guid={line_guid}

This method is used to retrieve information of a rating. In other words, this method mimics the Epic behaviour of the following screen:

Rating Screen

Can be accessed via the URI [Your_SDK_Service]/api/ratings?line_guid={line_guid}.

Request Parameters

line_guid

  • Type: System.String

    Unique identifier specifing a line that the rating corresponds to. Accepted values can be obtained from Get_Line.

Response

  • Status Code: 200

    Resource Representation: Rating

Examples

VB
 1' Constant DATABASE preset to current database name
 2' Constant AUTHENTICATION_KEY set to current authentication key
 3
 4Try
 5  Dim webclient As WebClient = New WebClient
 6  Dim sLineGuid As String = "XX-XX-XX" 'A real value should be obtained using Get_Line. Line must be associated to a UK line type.
 7  'Provide a fully qualified computer name with the SDK service installed and a real value for the line_guid
 8  Dim sURI As String = "https://Fully_Qualified_Service_Computer_Name/SDK_Service/api/ratings/?line_guid=" & sLineGuid
 9
10  With webclient
11    .Encoding = Encoding.UTF8
12    .Headers.Add("Content-type", "application/json")
13    .Headers.Add("AuthenticationKey", AUTHENTICATION_KEY)
14    .Headers.Add("DatabaseName", DATABASE)
15  End With
16
17  Dim sResult As String = webclient.DownloadString(sURI)
18
19  Dim jss As New Web.Script.Serialization.JavaScriptSerializer
20  Dim oRating As Rating = jss.Deserialize(Of Rating)(sResult)
21  Return oRating
22Catch ex As WebException
23  MessageBox.Show(New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd)
24Catch ex As Exception
25  MessageBox.Show(ex.Message)
26End Try
VB
 1' Imports SDK2009_07 = [Project Name].schemas.appliedsystems.com.epic.sdk._2009._07
 2' Imports SDK2011_01 = [Project Name].schemas.appliedsystems.com.epic.sdk._2011._01
 3' Imports SDK2017_02 = [Project Name].schemas.appliedsystems.com.epic.sdk._2017._02
 4
 5' Constant DATABASE preset to current database name
 6' Constant AUTHENTICATION_KEY set to current authentication key
 7
 8Try
 9  Dim oService As New EpicSDK_2018_01Client  ' Instantiate the Service object
10  Dim oHeader As New SDK2009_07.MessageHeader ' Instantiate the Header object
11
12  ' Populate the database and authentication key in the Header object
13  oHeader.DatabaseName = DATABASE
14  oHeader.AuthenticationKey = AUTHENTICATION_KEY
15
16  ' Get Policies for the client.
17  Dim oPolicyFilter As New SDK2011_01._get.PolicyFilter With {.ClientID = 113168}
18  Dim oPolicyResult As SDK2011_01._get.PolicyGetResult = oService.Get_Policy(oHeader, oPolicyFilter, 0)
19
20  ' Get Lines for the policy.
21  Dim oLineFilter As New SDK2011_01._get.LineFilter With {.PolicyID = oPolicyResult.Policies(0).PolicyID}
22  Dim oLineResult As SDK2017_02._get.LineGetResult = oService.Get_Line(oHeader, oLineFilter, 0)
23
24  oService.Close() ' Close the service
25
26  Dim webclient As WebClient = New WebClient
27  ' Provide a fully qualified computer name with the SDK service installed
28  ' Use appropriate line GUID to get Rating data. Line must be assocaited to a UK line type.
29  Dim sURI As String = "https://Fully_Qualified_Service_Computer_Name/SDK_Service/api/ratings/?line_guid=" & oLineResult.Lines(0).LineGUID
30
31  With webclient
32    .Encoding = Encoding.UTF8
33    .Headers.Add("Content-type", "application/json")
34    .Headers.Add("AuthenticationKey", AUTHENTICATION_KEY)
35    .Headers.Add("DatabaseName", DATABASE)
36  End With
37
38  Dim sResult As String = webclient.DownloadString(sURI)
39
40  Dim jss As New Web.Script.Serialization.JavaScriptSerializer
41  Dim oRating As Rating = jss.Deserialize(Of Rating)(sResult)
42  Return oRating
43Catch ex As WebException
44  MessageBox.Show(New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd)
45Catch ex As Exception
46  MessageBox.Show(ex.Message)
47End Try
See Also

Reference