Requires Authentication via 'x-api-key' header.
Returns an array of recorded crash entries for a given USDOT number
curl --request GET \
--url /v3/history/crash/:USDotNumber \
--header 'x-api-key: YourApiKey'
Source on Github
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "https://saferwebapi.com/v3/history/crash/:USDotNumber");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: YourApiKey");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
Source on Github
var client = new RestClient("https://saferwebapi.com/v3/history/crash/:USDotNumber");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "YourApiKey");
IRestResponse response = client.Execute(request);
Source on Github
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://saferwebapi.com/v3/history/crash/:USDotNumber"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "YourApiKey")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Source on Github
HttpResponse response = Unirest.get("https://saferwebapi.com/v3/history/crash/:USDotNumber")
.header("x-api-key", "YourApiKey")
.asString();
Source on Github
var axios = require("axios").default;
var options = {
method: 'GET',
url: 'https://saferwebapi.com/v3/history/crash/:USDotNumber',
headers: {'x-api-key': 'YourApiKey'}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
Source on Github
#import
NSDictionary *headers = @{ @"x-api-key": @"YourApiKey" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://saferwebapi.com/v3/history/crash/:USDotNumber"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
Source on Github
"https://saferwebapi.com/v3/history/crash/:USDotNumber",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: YourApiKey"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Source on Github
import requests
url = "https://saferwebapi.com/v3/history/crash/:USDotNumber"
headers = {"x-api-key": "YourApiKey"}
response = requests.request("GET", url, headers=headers)
print(response.text)
Source on Github
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://saferwebapi.com/v3/history/crash/:USDotNumber")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["x-api-key"] = 'YourApiKey'
response = http.request(request)
puts response.read_body
Source on Github
import Foundation
let headers = ["x-api-key": "YourApiKey"]
let request = NSMutableURLRequest(url: NSURL(string: "https://saferwebapi.com/v3/history/crash/:USDotNumber")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
Source on Github
/v3/history/crash/:USDotNumber
{
"crash_records": [
{
"batch_date": "April, 2021",
"report_number": "IA2001198080",
"report_sequence_number": 2,
"report_date": "2020-10-08",
"report_state": "IA",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": "Full Control",
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Daylight"
},
"vehicle": {
"vin": "4V4NC9EH4KN211082",
"license_number": "CHX876",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 2,
"citation_issue_description": "YES",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "April, 2021",
"report_number": "MO0000089128",
"report_sequence_number": 2,
"report_date": "2021-01-21",
"report_state": "MO",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": null,
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Dark - Not Lighted"
},
"vehicle": {
"vin": "1FUJHHDR1KLKN0054",
"license_number": "PDZ225",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 3,
"citation_issue_description": "UNKNOWN",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "August, 2021",
"report_number": "IA2001198080",
"report_sequence_number": 2,
"report_date": "2020-10-08",
"report_state": "IA",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": "Full Control",
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Daylight"
},
"vehicle": {
"vin": "4V4NC9EH4KN211082",
"license_number": "CHX876",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 2,
"citation_issue_description": "YES",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "August, 2021",
"report_number": "KS2021E21620",
"report_sequence_number": 1,
"report_date": "2021-02-21",
"report_state": "KS",
"total_injuries": 2,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": null,
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Daylight"
},
"vehicle": {
"vin": "3AKJHHDR2MSMD4325",
"license_number": "CJU594",
"license_state": "MB"
},
"severity_weight": 2,
"time_weight": 2,
"citation_issue_description": "NO",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "August, 2021",
"report_number": "KS2021E21912",
"report_sequence_number": 1,
"report_date": "2021-07-07",
"report_state": "KS",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Positive Barrier",
"access_control_description": "Full Control",
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Daylight"
},
"vehicle": {
"vin": "1FUJHHDR6LLKU7359",
"license_number": "CHY126",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 3,
"citation_issue_description": "NO",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "August, 2021",
"report_number": "MO0000089128",
"report_sequence_number": 2,
"report_date": "2021-01-21",
"report_state": "MO",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": null,
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Dark - Not Lighted"
},
"vehicle": {
"vin": "1FUJHHDR1KLKN0054",
"license_number": "PDZ225",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 2,
"citation_issue_description": "UNKNOWN",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "February, 2021",
"report_number": "IA2001198080",
"report_sequence_number": 2,
"report_date": "2020-10-08",
"report_state": "IA",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": "Full Control",
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Daylight"
},
"vehicle": {
"vin": "4V4NC9EH4KN211082",
"license_number": "CHX876",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 3,
"citation_issue_description": "YES",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "February, 2021",
"report_number": "MO0000089128",
"report_sequence_number": 2,
"report_date": "2021-01-21",
"report_state": "MO",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": null,
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Dark - Not Lighted"
},
"vehicle": {
"vin": "1FUJHHDR1KLKN0054",
"license_number": "PDZ225",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 3,
"citation_issue_description": "UNKNOWN",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "July, 2021",
"report_number": "IA2001198080",
"report_sequence_number": 2,
"report_date": "2020-10-08",
"report_state": "IA",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": "Full Control",
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Daylight"
},
"vehicle": {
"vin": "4V4NC9EH4KN211082",
"license_number": "CHX876",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 2,
"citation_issue_description": "YES",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "July, 2021",
"report_number": "KS2021E21620",
"report_sequence_number": 1,
"report_date": "2021-02-21",
"report_state": "KS",
"total_injuries": 2,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": null,
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Daylight"
},
"vehicle": {
"vin": "3AKJHHDR2MSMD4325",
"license_number": "CJU594",
"license_state": "MB"
},
"severity_weight": 2,
"time_weight": 3,
"citation_issue_description": "NO",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "July, 2021",
"report_number": "KS2021E21912",
"report_sequence_number": 1,
"report_date": "2021-07-07",
"report_state": "KS",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Positive Barrier",
"access_control_description": "Full Control",
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Daylight"
},
"vehicle": {
"vin": "1FUJHHDR6LLKU7359",
"license_number": "CHY126",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 3,
"citation_issue_description": "NO",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "July, 2021",
"report_number": "MO0000089128",
"report_sequence_number": 2,
"report_date": "2021-01-21",
"report_state": "MO",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": null,
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Dark - Not Lighted"
},
"vehicle": {
"vin": "1FUJHHDR1KLKN0054",
"license_number": "PDZ225",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 2,
"citation_issue_description": "UNKNOWN",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "June, 2021",
"report_number": "IA2001198080",
"report_sequence_number": 2,
"report_date": "2020-10-08",
"report_state": "IA",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": "Full Control",
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Daylight"
},
"vehicle": {
"vin": "4V4NC9EH4KN211082",
"license_number": "CHX876",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 2,
"citation_issue_description": "YES",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "June, 2021",
"report_number": "KS2021E21620",
"report_sequence_number": 1,
"report_date": "2021-02-21",
"report_state": "KS",
"total_injuries": 2,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": null,
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Daylight"
},
"vehicle": {
"vin": "3AKJHHDR2MSMD4325",
"license_number": "CJU594",
"license_state": "MB"
},
"severity_weight": 2,
"time_weight": 3,
"citation_issue_description": "NO",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "June, 2021",
"report_number": "MO0000089128",
"report_sequence_number": 2,
"report_date": "2021-01-21",
"report_state": "MO",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": null,
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Dark - Not Lighted"
},
"vehicle": {
"vin": "1FUJHHDR1KLKN0054",
"license_number": "PDZ225",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 3,
"citation_issue_description": "UNKNOWN",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "March, 2021",
"report_number": "IA2001198080",
"report_sequence_number": 2,
"report_date": "2020-10-08",
"report_state": "IA",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": "Full Control",
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Daylight"
},
"vehicle": {
"vin": "4V4NC9EH4KN211082",
"license_number": "CHX876",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 3,
"citation_issue_description": "YES",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "March, 2021",
"report_number": "MO0000089128",
"report_sequence_number": 2,
"report_date": "2021-01-21",
"report_state": "MO",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": null,
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Dark - Not Lighted"
},
"vehicle": {
"vin": "1FUJHHDR1KLKN0054",
"license_number": "PDZ225",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 3,
"citation_issue_description": "UNKNOWN",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "May, 2021",
"report_number": "IA2001198080",
"report_sequence_number": 2,
"report_date": "2020-10-08",
"report_state": "IA",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": "Full Control",
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Daylight"
},
"vehicle": {
"vin": "4V4NC9EH4KN211082",
"license_number": "CHX876",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 2,
"citation_issue_description": "YES",
"seq_num": 1,
"preventable": false
},
{
"batch_date": "May, 2021",
"report_number": "MO0000089128",
"report_sequence_number": 2,
"report_date": "2021-01-21",
"report_state": "MO",
"total_injuries": 0,
"total_fatalities": 0,
"tow_away": true,
"hazmat_released": false,
"trafficway_description": "Two-Way Trafficway Divided Unprotected Median",
"access_control_description": null,
"conditions": {
"road_surface": "Dry",
"weather": "No Adverse Conditions",
"light": "Dark - Not Lighted"
},
"vehicle": {
"vin": "1FUJHHDR1KLKN0054",
"license_number": "PDZ225",
"license_state": "MB"
},
"severity_weight": 1,
"time_weight": 3,
"citation_issue_description": "UNKNOWN",
"seq_num": 1,
"preventable": false
}
]
}