Skip to content

Instantly share code, notes, and snippets.

@pullmonkey
Created January 13, 2011 22:57
Show Gist options
  • Save pullmonkey/778789 to your computer and use it in GitHub Desktop.
Save pullmonkey/778789 to your computer and use it in GitHub Desktop.
VB .NET example from one of VIN API's customers
Public Function DecodeVIN(ByVal VIN As String, Optional ByVal Complete As Boolean = False) As String
Try
Dim aResponse() As Byte
Dim sResponse As String = ""
Dim oWebclient As New WebClient
Dim oEncoder As New System.Text.ASCIIEncoding
'Call the API
oWebclient = New WebClient
oWebclient.Headers.Add("X-VinApiKey", "APIKEYGOESHERE")
If Complete = True Then
aResponse = oWebclient.DownloadData("http://vinapi.skizmo.com/vins/" & VIN & ".xml?complete=true")
Else
aResponse = oWebclient.DownloadData("http://vinapi.skizmo.com/vins/" & VIN & ".xml")
End If
sResponse = oEncoder.GetString(aResponse)
'Debug.Print(sResponse)
Return sResponse
Catch ex As Exception
End Try
Return Nothing
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment