Created
January 13, 2011 22:57
-
-
Save pullmonkey/778789 to your computer and use it in GitHub Desktop.
VB .NET example from one of VIN API's customers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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