Click or drag to resize

Ratings

SDK provides read access for 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

Get rating detail for a line.

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'Here we will get rating information that corresponds to an Epic line. 
 6Try
 7  Dim sLineGuid As String = "E6B3FDE7-E6BB-44E6-877B-72DB00D7BFA5" 'A real value should be obtained using Get_Line. Line must be associated to a UK line type.
 8  Dim sURL As String = SDK_SERVICE_URI & "/api/ratings?line_guid=" & sLineGuid
 9  Dim sResponse As String
10  Using oWebclient As New WebClient
11    oWebclient.Encoding = Encoding.UTF8
12    With oWebclient.Headers
13      .Add("AuthenticationKey", AUTHENTICATION_KEY)
14      .Add("DatabaseName", DATABASE)
15    End With
16    Dim aQuoteRatesResponse As Byte() = oWebclient.DownloadData(sURL)
17    sResponse = oWebclient.Encoding.GetString(aQuoteRatesResponse)
18  End Using
19  Console.WriteLine(sResponse)
20
21Catch ex As WebException
22  Dim sStatusCode As String = ex.Status.ToString
23  Dim sError As String = New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd
24  Console.WriteLine("Status Code: &" & sStatusCode & ", Error: " & sError)
25Catch ex As Exception
26  Console.WriteLine(ex.Message)
27End Try

Get rating detail for a particular line from a policy.

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
 8'Here we show example code on how a policies can be obtained from a client and Lines can be obtained from those polcies.
 9'Then we will get rating information that corresponds to an Epic line. 
10Try
11  Dim oService As New EpicSDK_2019_01Client  ' Instantiate the Service object
12  Dim oHeader As New SDK2009_07.MessageHeader ' Instantiate the Header object
13
14  ' Populate the database and authentication key in the Header object
15  oHeader.DatabaseName = DATABASE
16  oHeader.AuthenticationKey = AUTHENTICATION_KEY
17
18  ' Get Policies for the client.
19  Dim oPolicyFilter As New SDK2011_01._get.PolicyFilter With {.ClientID = 113168}
20  Dim oPolicyResult As SDK2011_01._get.PolicyGetResult = oService.Get_Policy(oHeader, oPolicyFilter, 0)
21
22  ' Get Lines for the policy.
23  Dim oLineFilter As New SDK2011_01._get.LineFilter With {.PolicyID = oPolicyResult.Policies(0).PolicyID}
24  Dim oLineResult As SDK2017_02._get.LineGetResult = oService.Get_Line(oHeader, oLineFilter, 0)
25
26  oService.Close() ' Close the service
27
28  Dim sURL As String = SDK_SERVICE_URI & "/api/ratings?line_guid=" & oLineResult.Lines(0).LineGUID
29  Dim sResponse As String
30  Using oWebclient As New WebClient
31    oWebclient.Encoding = Encoding.UTF8
32    With oWebclient.Headers
33      .Add("AuthenticationKey", AUTHENTICATION_KEY)
34      .Add("DatabaseName", DATABASE)
35    End With
36    Dim aQuoteRatesResponse As Byte() = oWebclient.DownloadData(sURL)
37    sResponse = oWebclient.Encoding.GetString(aQuoteRatesResponse)
38  End Using
39  Console.WriteLine(sResponse)
40Catch ex As WebException
41  MessageBox.Show(New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd)
42Catch ex As Exception
43  MessageBox.Show(ex.Message)
44End Try
See Also