Created
October 22, 2012 19:25
-
-
Save sirkirby/3933519 to your computer and use it in GitHub Desktop.
RyanTech VIN Explosion API Decode VIN w/ RestSharp
This file contains hidden or 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
// using RestSharp and Json.Net | |
// client and authentication | |
var client = new RestClient("http://vinexplosion.com/api/"); | |
client.Authenticator = new HttpBasicAuthenticator("username", "password"); | |
// request | |
var request = new RestRequest("vin/decode/{vin}/?fuzzy=true", Method.GET); | |
request.AddUrlSegment("vin", "JA4AP3AU5BZ009787"); | |
request.AddHeader("Accept", "application/json"); // use application/xml for xml response | |
// response | |
var response = client.Execute(request); | |
var rvef = JObject.Parse(response.Content); | |
var year = (string)rvef.SelectToken("Vehicles[0].Providers[0].Year"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment