API

We now offer an API for you to use in other applications to check whether a vehicle was stolen or not.

The API will the check the main database of entries added directly into this website, as well as the BOLO section, where we obtain information from social media.

No authentication required.

You just need to call the URL as shown in the examples below with the search term appended at the end. A minimum of 4 characters are required.

The search term must either be the: VIN Number OR Registration/License Plate Number OR Engine Number.

Base URL

https://stolenvehicles.co.za/api/vehicles/

Example

https://stolenvehicles.co.za/api/vehicles/CA529663

API Response
                                        
{
    "result": "Stolen",
    "type": "Motorcycle",
    "stolen_date": "2018-03-14",
    "vin_number": "WB10404JXWZC43519",
    "reg_number": "CA529663",
    "engine_number": "112EB299870",
    "make": "BMW",
    "model": "R1100GS",
    "year": "1994",
    "color": "Red",
    "province": "Gauteng",
    "last_known_location": "Magaliesburg",
    "description": "Adventure bike with aluminum top box",
    "case_number": "CAS46\/3\/2018",
    "police_station": "Randburg",
    "datadot_id": "",
    "source_system": "www.stolenvehicles.co.za",
    "link": "www.stolenvehicles.co.za\/vehicles\/view\/86"
}
                                        
                    

Code Examples

                            
$ch = curl_init();

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
));
curl_setopt($ch, CURLOPT_URL, "https://stolenvehicles.co.za/api/vehicles/CA529663");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($ch);
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if (curl_error($ch)) {
    echo 'Error:' . curl_error($ch) . ".\nHTTP Status: " . $http_status;
}

curl_close($ch);

if ($http_status == 200) {
    //A JSON object will be returned if the vehicle details were found.
    //We then decode it and get an array.
    $vehicle_data = json_decode($result, true);
    
    //Check the result value...
    $result = $vehicle_data['result'];
    
    if($result == "Stolen") {
        //We can now extract all the fields, or specific fields from the array.
        $vin_number = $vehicle_data['vin_number'];
        $stolen_date = $vehicle_data['stolen_date'];

        //Save the data to a database or echo it out to screen.
        echo "This vehicle with VIN:$vin_number was stolen on $stolen_date.";
    } else {
        echo "No data found.";
    }
} elseif ($http_status == 401) {
    echo "Unauthorized access. - " . $result;
} elseif ($http_status == 404) {
        echo "Resource not found. - " . $result;
}
                            
                    
                            
var reg_number = "CA529663";

$.ajax({
    type: 'GET',
    url: 'https://stolenvehicles.co.za/api/vehicles/' + reg_number,
    dataType: 'jsonp',
    success: function (data) {
        console.log(data);

        //Now we can use the result...
        if (data.result == "Stolen") {
            alert("Vehicle with reg number " + reg_number + " was stolen on " + data.stolen_date + ".");
        } else {
            alert("No data found...");
        }
    }
});