Click or drag to resize

Option Sets

SDK provides the ability to retrieve values that are accepted in comboxes for UK risk data. In other words it exposes the same information as viewing the values of a combo box with the Epic UI except through an api.
Get /api/option_sets/{application_type}/{application_version}

This method is used to retrieve all the option sets for the specified application type and version. In other words, this method mimics the Epic behaviour of the following screen:

Lookup

Can be accessed via the URI [Your_SDK_Service]/api/option_sets/{application_type}/{application_version}.

Request Parameters

application_type

  • Type: System.String

    Type of the application for which option sets are requested. Accepted values can be obtained from the quote definition.

application_version

  • Type: System.String

    Version of the application for which option sets are requested. Accepted values can be obtained from the quote definition.

Response

  • Status Code: 200

    Resource Representation: Dictionary(Of String, Dictionary(Of Option))

Examples

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'Retrieve the option sets for a quote for a UK Motor policy.
 6Try
 7  'These values can be obtained from the quote definition (Get /api/quotes/definition/{quote_guid}).
 8  Dim sApplicationType As String = "UKMotor"
 9  Dim sApplicationVersion As String = "1.1.3"
10
11  Dim sOptionSetsURL As String = SDK_SERVICE_URI & $"/api/option_sets/{sApplicationType}/{sApplicationVersion}"
12  Dim sOptionSetsResponse As String
13  Using oWebclient As New WebClient With {.Encoding = Encoding.UTF8}
14    With oWebclient.Headers
15      .Add("AuthenticationKey", AUTHENTICATION_KEY)
16      .Add("DatabaseName", DATABASE)
17    End With
18    Dim aOptionSetsResponse As Byte() = oWebclient.DownloadData(sOptionSetsURL)
19    sOptionSetsResponse = oWebclient.Encoding.GetString(aOptionSetsResponse)
20  End Using
21  Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer
22  Dim dictOptionSets As Dictionary(Of String, Dictionary(Of String, [Option])) = jss.Deserialize(Of Dictionary(Of String, Dictionary(Of String, [Option])))(sOptionSetsResponse)
23
24  For Each dictOptionSet As KeyValuePair(Of String, Dictionary(Of String, [Option])) In dictOptionSets
25    Console.WriteLine("Option Set: " & dictOptionSet.Key)
26    For Each oOption As KeyValuePair(Of String, [Option]) In dictOptionSet.Value
27      Console.WriteLine("Option ID: " & oOption.Value.value)
28      Console.WriteLine("Option Description: " & oOption.Value.description)
29    Next
30  Next
31
32Catch ex As WebException
33  Dim sStatusCode As String = ex.Status.ToString
34  Dim sError As String = New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd
35  Console.WriteLine($"Status Code: {sStatusCode}, Error: {sError}")
36Catch ex As Exception
37  Console.WriteLine(ex.Message)
38End Try
Get /api/option_sets/{application_type}/{application_version}/{option_set_id}

Can be accessed via the URI [Your_SDK_Service]/api/option_sets/{application_type}/{application_version}/{option_set_id}.

Request Parameters

application_type

  • Type: System.String

    Type of the application for which option set is requested. Accepted values can be obtained from the quote definition.

application_version

  • Type: System.String

    Version of the application for which option set is requested. Accepted values can be obtained from the quote definition.

option_set_id

  • Type: System.String

    Name of the requested Option set. Accepted values can be obtained from the quote definition.

Response

  • Status Code: 200

    Resource Representation: Dictionary(Of Option)

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 sApplicationType As String = "UKMotor" 'The application type and version can be obtained from Get api/quotes/quote_definition/{quote_guid}
 7  Dim sApplicationVersion As String = "1.1.1"
 8  Dim sOptionSetId As String = "PLBodyType_CV" 'The option set id can be obtained from Get /api/otion_sets/{sApplicationType}/{sApplicationVersion} or validation messages.
 9  'Provide a fully qualified computer name with the SDK service installed and a real values for Application Type, Application Version and Option Set ID.
10  Dim sURI As String = $"https://Fully_Qualified_Service_Computer_Name/SDK_Service/api/otion_sets/{sApplicationType}/{sApplicationVersion}/{sOptionSetId}"
11
12  With webclient
13    .Encoding = Encoding.UTF8
14    .Headers.Add("Content-type", "application/json")
15    .Headers.Add("AuthenticationKey", AUTHENTICATION_KEY)
16    .Headers.Add("DatabaseName", DATABASE)
17  End With
18
19  Dim sResult As String = webclient.DownloadString(sURI)
20
21  Dim jss As New Web.Script.Serialization.JavaScriptSerializer
22  Dim oOptionSet As Dictionary(Of String, [Option]) = jss.Deserialize(Of Dictionary(Of String, [Option]))(sResult)
23  Return oOptionSet
24Catch ex As WebException
25  MessageBox.Show(New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd)
26Catch ex As Exception
27  MessageBox.Show(ex.Message)
28End Try
See Also

Other Resources