DVLA Search

Description

The DVLA Search Plugin provides subscribers to the DVLA Search API a widget, customisable results page, and shortcodes for use on custom pages.

Installation

  1. Upload the plugin files to the /wp-content/plugins/dvla-search directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress
  3. Use the Settings->DVLA Search screen to configure the plugin with your API Key
    1.1 If you want to test the Plugin you can use the example API Key “DvlaSearchDemoAccount” and test with a registration number beginning MT09 or FH51 such as MT09NKS.

Once you’ve added your API Key you can customize the fields shown on the simple results page from the Settings->DVLA Search->Results Fields screen.

Add The Widget To Your Site

  1. Go to Appearance->Widgets
  2. Drag the “DVLA Search Widget” to the sidebar or other widget area of your choice.
  3. By default the widget will point at the simple results page and the widget will have no title.

Create a Custom Results Page

To display the results on your own page, you can use the provided shortcodes as follows:

  1. Create a new page from Pages->Add New
  2. Use the [dvla_search_success][/dvla_search_success] block to wrap the content to show if the search returned valid results.
  3. Use the [dvla_search_error][/dvla_search_error] block to wrap a message to display if there was an error.
  4. You can display the results data with the [dvla_search_result] shortcode by specifying one or more field to output.
    1.1 For example, to display the vin use [dvla_search_result vin]
    1.1 Or to display the colour and model use [dvla_search_result colour model]
    1.1 For a full list of fields avilable see the help page at DVLA Search->Shortcode Help or in the readme.
  5. Save your page and take note of the slug.
  6. Update the widget “Results Page” option with the slug of your custom results page.

For example, your custom results page might contain the following shortcodes:

    [dvla_search_success]
      Your car [dvla_search_result registration] is a [dvla_search_result colour model] and the VIN is [dvla_search_result vin]
    [/dvla_search_success]

    [dvla_search_error]
      There was an error searching for [dvla_search_result registration]
    [/dvla_search_error]

FAQ

Installation Instructions
  1. Upload the plugin files to the /wp-content/plugins/dvla-search directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress
  3. Use the Settings->DVLA Search screen to configure the plugin with your API Key
    1.1 If you want to test the Plugin you can use the example API Key “DvlaSearchDemoAccount” and test with a registration number beginning MT09 or FH51 such as MT09NKS.

Once you’ve added your API Key you can customize the fields shown on the simple results page from the Settings->DVLA Search->Results Fields screen.

Add The Widget To Your Site

  1. Go to Appearance->Widgets
  2. Drag the “DVLA Search Widget” to the sidebar or other widget area of your choice.
  3. By default the widget will point at the simple results page and the widget will have no title.

Create a Custom Results Page

To display the results on your own page, you can use the provided shortcodes as follows:

  1. Create a new page from Pages->Add New
  2. Use the [dvla_search_success][/dvla_search_success] block to wrap the content to show if the search returned valid results.
  3. Use the [dvla_search_error][/dvla_search_error] block to wrap a message to display if there was an error.
  4. You can display the results data with the [dvla_search_result] shortcode by specifying one or more field to output.
    1.1 For example, to display the vin use [dvla_search_result vin]
    1.1 Or to display the colour and model use [dvla_search_result colour model]
    1.1 For a full list of fields avilable see the help page at DVLA Search->Shortcode Help or in the readme.
  5. Save your page and take note of the slug.
  6. Update the widget “Results Page” option with the slug of your custom results page.

For example, your custom results page might contain the following shortcodes:

    [dvla_search_success]
      Your car [dvla_search_result registration] is a [dvla_search_result colour model] and the VIN is [dvla_search_result vin]
    [/dvla_search_success]

    [dvla_search_error]
      There was an error searching for [dvla_search_result registration]
    [/dvla_search_error]
Can I test the DVLA Search Plugin without an account?

Yes, you can use the example API Key “DvlaSearchDemoAccount” and test with a registration number beginning MT09 or FH51 such as MT09NKS.

How do I signup for an account with DVLASearch.co.uk?

You can sign up for an account at https://dvlasearch.co.uk/dvla-api-obtaining-access/

How many credits does each search use?

Each time someone searches for a vehicle registration, it uses one credit.

Available Fields

The following API fields are available:

  • vin – A vehicle identification number, commonly abbreviated to VIN, or chassis number, is a unique code including a serial number, used by the automotive industry to identify individual motor vehicles, towed vehicles, motorcycles, scooters and mopeds as defined in ISO 3833. VINs were first used in 1954. eg WVGZZZ5NZAW007903
  • make – The vehicle manufacturer. eg Vauxhall
  • model – The vehicle model. eg Vectra
  • cylinderCapacity – The vehicle cylinder capacity (cc). eg 1968cc
  • numberOfDoors – The number of doors on the vehicle. eg 5
  • sixMonthRate – The cost of vehicle tax for 6 months. eg 112.75
  • twelveMonthRate – The cost of vehicle tax for 12 months. eg 205.00
  • dateOfFirstRegistration – The date on which the vehicle was registered. eg 23 July 2009
  • yearOfManufacture – They year the vehicle was manufactured. eg 2009
  • co2Emissions – The vehicle emissions. eg 167 g/km
  • fuelType – The vehicle fuel type. eg Diesel (other values: Petrol, Electric)
  • taxStatus – Current tax status. eg Not taxed
  • transmission – The vehicle transmission. eg Manual (other values: automatic, cvt)
  • colour – The vehicle colour. eg Silver
  • typeApproval – The vehicle category classification. eg M1
  • wheelPlan – The vehicle wheel plan. eg 2 AXLE RIGID BODY
  • revenueWeight – The vehicle’s confirmed maximum gross weight. eg 3850kg
  • taxDetails – Vehicle tax information. eg Tax due: 06 February 2015
  • motDetails – MOT expiry day. eg Expires: 23 July 2015
  • taxed – States if the tax is valid. eg false
  • mot – States if the mot is valid. eg true

    For full details, see the “Shortcode Help” section of the DVLA Search Admin Menu, or the DVLA Search API Documentation

Advanced Customization

If you are comfortable writing or modifying WordPress Plugins you can take advantage of the search functionality and access the results in your own code.

  • Any page with the ?dvla_search_registration=<REG> query param will hit the API using your registered API Key and add the results to a global variable $dvla_search_result_data
  • The results in $dvla_search_result_data are an array keyed by the fields described in “Available Fields” section of the readme.
  • For more insight into how the DVLA Search shortcodes access the results, see the code in the plugin directory.
  • You could for example use this data in a your own shortcode to display on a custom results page.

For example:

<?php
function dvla_search_custom_shortcode() {
  global $dvla_search_result_data;
  global $dvla_search_registration;

  if( $dvla_search_result_data['mot'] ) {
    return "$dvla_search_registration has a valid MOT";
  } else {
    return "$dvla_search_registration does not have a valid MOT";
  }
}
add_shortcode('dvla_search_custom_shortcode', 'dvla_search_custom_shortcode');

Contributors & Developers

“DVLA Search” is open source software. The following people have contributed to this plugin.

Changelog

1.0.1

  • Updated readme.txt formatting.

1.0.0

  • Initial Release