Excel Format SMS Reports

Requires Authentication via 'x-api-key' header.

Returns returns an .xlsx file contianing the most recent SMS records


Code Examples



curl --request GET \
  --url /v2/usdot/sms/: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/v2/usdot/sms/: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/v2/usdot/sms/: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/v2/usdot/sms/: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/v2/usdot/sms/:USDotNumber")
  .header("x-api-key", "YourApiKey")
  .asString();

Source on Github


var axios = require("axios").default;

var options = {
  method: 'GET',
  url: 'https://saferwebapi.com/v2/usdot/sms/: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/v2/usdot/sms/: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/v2/usdot/sms/: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/v2/usdot/sms/: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/v2/usdot/sms/: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/v2/usdot/sms/: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
Endpoints
  • GET /v2/usdot/sms/:USDotNumber
Response Example