Skip to content

Instantly share code, notes, and snippets.

@sirkirby
Created October 22, 2012 19:25
Show Gist options
  • Save sirkirby/3933519 to your computer and use it in GitHub Desktop.
Save sirkirby/3933519 to your computer and use it in GitHub Desktop.
RyanTech VIN Explosion API Decode VIN w/ RestSharp
// 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