![]() | |
Option Sets |
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:
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
Get all option sets for an application type.
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 14 oWebclient.Encoding = Encoding.UTF8 15 With oWebclient.Headers 16 .Add("AuthenticationKey", AUTHENTICATION_KEY) 17 .Add("DatabaseName", DATABASE) 18 End With 19 Dim aOptionSetsResponse As Byte() = oWebclient.DownloadData(sOptionSetsURL) 20 sOptionSetsResponse = oWebclient.Encoding.GetString(aOptionSetsResponse) 21 End Using 22 Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer 23 Dim dictOptionSets As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(sOptionSetsResponse) 24 25 For Each kvpOptionSet As KeyValuePair(Of String, Object) In dictOptionSets 26 Dim dictOptionSet As Dictionary(Of String, Object) = CType(kvpOptionSet.Value, Dictionary(Of String, Object)) 27 28 Console.WriteLine("Option Set: " & kvpOptionSet.Key) 29 For Each dictOption As Dictionary(Of String, Object) In dictOptionSet.Values 30 Console.WriteLine("Option ID: " & dictOption("value").ToString) 31 Console.WriteLine("Option Description: " & dictOption("description").ToString) 32 Next 33 Next 34 35Catch ex As WebException 36 Dim sStatusCode As String = ex.Status.ToString 37 Dim sError As String = New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd 38 Console.WriteLine("Status Code: " & sStatusCode & ", Error: " & sError) 39Catch ex As Exception 40 Console.WriteLine(ex.Message) 41End Try
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
Get a particular option set.
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.1" 10 Dim sOptionSetId As String = "PLBodyType_CV" 'The option set id can be obtained from Get /api/otion_sets/{sApplicationType}/{sApplicationVersion} or validation messages." 11 12 Dim sOptionSetsURL As String = SDK_SERVICE_URI & "/api/option_sets/" & sApplicationType & "/" & sApplicationVersion & "/" & sOptionSetId 13 Dim sOptionSetsResponse As String 14 Using oWebclient As New WebClient 15 oWebclient.Encoding = Encoding.UTF8 16 With oWebclient.Headers 17 .Add("AuthenticationKey", AUTHENTICATION_KEY) 18 .Add("DatabaseName", DATABASE) 19 End With 20 Dim aOptionSetsResponse As Byte() = oWebclient.DownloadData(sOptionSetsURL) 21 sOptionSetsResponse = oWebclient.Encoding.GetString(aOptionSetsResponse) 22 End Using 23 Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer 24 Dim dictOptionSet As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(sOptionSetsResponse) 25 For Each dictOption As Dictionary(Of String, Object) In dictOptionSet.Values 26 Console.WriteLine("Option ID: " & dictOption("value").ToString) 27 Console.WriteLine("Option Description: " & dictOption("description").ToString) 28 Console.WriteLine() 29 Next 30 31Catch ex As WebException 32 Dim sStatusCode As String = ex.Status.ToString 33 Dim sError As String = New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd 34 Console.WriteLine("Status Code: " & sStatusCode & ", Error: " & sError) 35Catch ex As Exception 36 Console.WriteLine(ex.Message) 37End Try