MOT.NET 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MOT.NET --version 2.0.0                
NuGet\Install-Package MOT.NET -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MOT.NET" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MOT.NET --version 2.0.0                
#r "nuget: MOT.NET, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MOT.NET as a Cake Addin
#addin nuget:?package=MOT.NET&version=2.0.0

// Install MOT.NET as a Cake Tool
#tool nuget:?package=MOT.NET&version=2.0.0                

Overview

MOT.NET is a .NET Core library which provides access to the DVSA's MOT history API.

As well as MOT tests, this API provides access to other vehicle data. These include registration date, cylinder capacity, fuel type and make and model.

Apply for API access

This API requires an API key. You may obtain an API key for your organisation by completing this application.

Setup

MotTestClient takes an API key as a SecureString. The example below shows converting a regular string to a SecureString to construct a MotTestClient:

// Example API key, replace with yours. Keep it secret!
var apikey = "foobar";

// Load the API key into a SecureString.
var securekey = new SecureString();
foreach(var character in apikey) {
    securekey.AppendChar(character);
}
securekey.MakeReadOnly();

// Initialise the MotTestClient.
IMotTestClient client = new MotTestClient(securekey);

Queries

Once initialised, the library may query the API in three different ways:

By vehicle:

Vehicles are queried by registration. Use the Registration method to specify a registration, and FetchAsync to fetch records:

// IAsyncEnumerable of Vehicles, allowing asynchronous streaming of results.
IAsyncEnumerable<Vehicle> vehicles = client
    .Registration("F1") // Set the registration to query.
    .FetchAsync(); // Fetch the vehicle from the API service.

// Asynchronously iterate reulsts.
await foreach(Vehicle vehicle in vehicles) {
    // Output vehicle make.
    Console.WriteLine(vehicle.Make);
}

By page:

Records are grouped in pages of 400-500 each. Use the Page method to specify a page, and FetchAsync to fetch records:

// Used after a previous query has been run, clears parameters.
client.Clear();

IAsyncEnumerable<Vehicle> vehicles = client
    .Page(0) // Set the page to query.
    .FetchAsync();

await foreach(Vehicle vehicle in vehicles) {
    // Output the vehicle models.
    Console.WriteLine(vehicle.Model);
}

This method is useful for downloading all records. Continue to download these pages from zero until exhaustion after ~50,000 pages (server will return status 404).

Note: The API is rate limited to 10 requests per second, make sure not to exceed this.

By date and page:

Records are queryable by date, with 1440 pages per day (1 page per minute).

Use the Date method to set the date parameter, the Page method to set the page parameter, and the FetchAsync method to fetch records:

client.Clear();

IAsyncEnumerable<Vehicle> vehicles = client
    .Date(DateTime.Today) // Set the page to query (to today).
    .Page(720) // Set the page to query (720 = noon).
    .FetchAsync();

await foreach(Vehicle vehicle in vehicles) {
    // Output the vehicle engine size.
    Console.WriteLine(vehicle.EngineSize;
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.0 587 2/5/2020
2.0.0 548 2/2/2020
1.2.0 630 1/25/2020