Getting Started

Modified on 2016/07/28 20:14 by Administrator — Categorized as: Uncategorized


Environment

Underwriting API has a separate Customer Integration (or UAT) environment that you can use while you are coding to our API. This differs from our Production API.




Credentials

In order to call the various reports, you will first need a username and password. This can be obtained from your Verisk Client Service representative.

PLEASE NOTE: Your credentials may differ from UAT to Production.

Once you have your credentials, you are ready to authenticate and begin coding against the Personal Lines API!

Request Format

You can specify the format of your request either as XML or JSON simply by setting a Header of "Content-Type" to either "application/xml" (for xml request) or "application/json" for json request.

Response Format

You can specify that you would like to receive your response either as XML or JSON simply by setting a Header of "Accept" to either "application/xml" (for xml response) or "application/json" for json response.

Sample Code Calling a RESTful Web Service

C#


      public string PostXml(string apiUrl, string token, string xmlRequest)
        {
            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml"));
                client.DefaultRequestHeaders.Authorization = AuthenticationHeaderValue.Parse("Bearer " + token);
                var content = new StringContent(xmlRequest, Encoding.UTF8, "application/xml");

                var responseMsg = client.PostAsync(new Uri(apiUrl), content).Result;
                var response = responseMsg.Content.ReadAsStringAsync().Result;
                                                                
                  return response;
            }
        }


Sample Usage:

            var searchResult = PostXml("https://gateway-uat.iso.com/underwriting/aplusauto/claims/v1.0", "7ca327234c09w8b99b9bda03c171a5c",   xmlRequest);

Java


public String postCallToApiService(String endPoinUrl, String accessToken, String requestXML)
	{
		String responseStr = "";
        HttpPost postMethod = new HttpPost(endPointUrl);
        postMethod.setHeader("Content-Type", "application/xml");
		postMethod.setHeader("Accept", "application/xml");
		postMethod.setHeader("Authorization", "Bearer "+accessToken);
        DefaultHttpClient httpClient = new DefaultHttpClient();
		InputStream responseStream = null;
    	try 
    	{
			postMethod.setEntity(new StringEntity(requestXML));			
			HttpResponse response = httpClient.execute(postMethod);			
			responseStream = response.getEntity().getContent();
			responseStr = IOUtils.toString(responseStream);			
    	}
    	catch (UnsupportedEncodingException e) {
        	//log and handle exception
		} catch (ClientProtocolException e) {
			// log and handle exception
		}catch (SocketTimeoutException e) {
			// log and handle exception
		}catch (ConnectTimeoutException e) {
			// log and handle exception
		}
		catch (IOException e) {
			// log and handle exception
		}
    	finally 
    	{
            // release the connection 
        	try 
        	{
        		if(responseStream!=null){
        			responseStream.close();
        		}
        		if(httpClient!=null){
        			httpClient.getConnectionManager().shutdown();
        		}
			} 
        	catch (IOException e) 
        	{
        		// log and handle exception
			}
        }
		
		return responseStr;
	}	
Sample Usage:

String searchResult = postCallToApiService("https://gateway-uat.iso.com/underwriting/aplusauto/claims/v1.0",
                                           "7ca327234c09w8b99b9bda03c171a5c",   xmlRequest);