Released DVSA.MOT.SDK on NuGet

I have released and published v1.0.1 of my .NETStandard 2.1 SDK on NuGet for the DVSA Mot History API.

I tested it with a simple .NET Core 3.1 web api which can be found here.

The idea behind this package was to make accessing the DVSA API quick and easy.

Configuring the app to work with a .NET Core 3.1 web app, is as simple as adding the required api key to the appsettings.json or secrets.json and then registering the SDK in the Startup.cs file.

The setting is formatted as below:

  {
    "MotApi": {
      "DVSAApiKey": "YOUR KEY HERE"
    }
  }

Then registering the SDK is as simple as this:

services.Configure<ApiKey>(Configuration.GetSection("MotApi"));
services.AddDvlaMotSdk();
services.AddOptions();
services.AddLogging();

Then you can use 1 of 4 methods:

To request the MOT test history by registration

var vehicleDetails = await _singleVehicleService.GetSingleVehicleMotHistoryByRegistration(registration);

To request the MOT test history for a vehicle with the ID.

var vehicleDetails = await _singleVehicleService.GetSingleVehicleMotHistoryById(vehicleId);

To request a full extract of the database.
The last page normally increments by 10 each day.

var vehicleDetails = await _allVehiclesService.GetAllMotTests(Convert.ToInt32(page));

To request MOT tests completed on 10 March 2017 from page 1 to 1440.

Example
page 1 shows all tests completed on 10 March 2017 at the 10/03/2017 at 0:01am
page 300 shows all tests completed on 10 March 2017 at 5am
page 600 shows all tests completed on 10 March 2017 at 10am

var dateTime = DateTime.ParseExact(date, "yyyyMMdd", CultureInfo.InvariantCulture);
var vehicleDetails = await _allVehiclesService.GetAllMotTestsByDate(dateTime,Convert.ToInt32(page));

You can install the package from NuGet via Visual Studio or via the Package Manager Console:

Install-Package AjsWebDesign.DVSA.MOT.SDK -Version 1.0.1

The source code can be found on my GitHub here

I have released this under the MIT Licence, however use of the DVSA Api is under the Open Government Licence v3.0.

Any issues which are encountered can be raised on GitHub

Comments (0)