PC*MILER Web Services conform to REST architecture. All API request parameters and method parameters can be sent via the standard HTTP methods—POST, GET, PUT, and DELETE. Go here for a listing of commonly used endpoints.


The PC*MILER REST service requires an API key to access the service. The API key is used either in the URL or in the HTTP request header to validate a user’s request. If the client making the API request has an invalid API key, then the key will fail to authenticate.

Request Properties

A typical REST action consists of sending an HTTP request to the PC*MILER API Server and waiting for the response. Like any HTTP request, a REST request to PC*MILER API Server contains a request method, a URI, request headers, and a query string or request body. The response contains an HTTP status code, response headers, and a response body.

Request ElementDescription
HOSTThe Host header defines PC*MILER REST API server (where to connect).
Example: Host: pcmiler.alk.com
APIKEYAPI Key will be used to fully determine privileges and visibility for the request within PC*MILER platform.
Example:add Authorization: YOUR_KEY_HERE in Request Header
attach &authToken= YOUR_KEY_HERE in the URL.
CONTENT-TYPEDefines expected request MIME type.
application/json: PC*MILER will render the response in JSON format following the current REST API specifications.

Sample GET Requests

Java Header-Based GET Authentication

Query = "coords=-85.974742,37.892845";
String nospac = Query.replace(" ", "%20");
address = "https://pcmiler.alk.com/apis/rest/v1.0/Service.svc/locations?";
urlFormatted = address + nospac;
url = new URL(urlFormatted);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("Authorization", apiKeyVal);
connection.setReadTimeout(15 * 1000);
builder = new StringBuilder();
String type = connection.getContentType();
if (type == null) {

Sample POST Requests

Java POST Request

String address = ("https://pcmiler.alk.com/APIs/REST/v1.0/Service.svc/route/routeReports?dataVersion=Current");
URL url = new URL(address);

HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", API_KEY);
String postData = "{ \"ReportRoutes\": [{\"RouteId\": \"test\", \"Stops\": [{\"Address\": {\"Zip\": \"08540\"},\"Label\": \"Trimble MAPS\"}, {\"Address\": {\"Zip\": \"90266\"},\"Label\": \"Manhattan Beach\"}], \"ReportTypes\": [{\"__type\": \"MileageReportType:http://pcmiler.alk.com/APIs/v1.0\",\"THoursWithSeconds\": false}]}]}";
conn.setRequestProperty("Content-Length", Integer.toString(postData.length()));
OutputStream os = conn.getOutputStream();

if (conn.getResponseCode() != 200)
if (conn.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
throw new RuntimeException("Failed : HTTP error code : "+ conn.getResponseCode());

BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();

while ((inputLine = in.readLine()) != null) {


C# POST Request

var request = (HttpWebRequest)WebRequest.Create("https://pcmiler.alk.com/APIs/REST/v1.0/Service.svc/route/routeReports?dataVersion=Current");
var postData = "{ \"ReportRoutes\": [{\"RouteId\": \"test\", \"Stops\": [{\"Address\": {\"Zip\": \"08540\"},\"Label\": \"Trimble MAPS\"}, {\"Address\": {\"Zip\": \"90266\"},\"Label\": \"Manhattan Beach\"}], \"ReportTypes\": [{\"__type\": \"MileageReportType:http://pcmiler.alk.com/APIs/v1.0\",\"THoursWithSeconds\": false}]}]}";
var data = Encoding.ASCII.GetBytes(postData);
request.Headers.Add("Authorization", API_KEY);
request.Method = "POST";
request.ContentType = "application/json";
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
stream.Write(data, 0, data.Length);
var response = (HttpWebResponse)request.GetResponse();
var responseJSON = new StreamReader(response.GetResponseStream()).ReadToEnd();

JavaScript POST Request

reqhttp = new XMLHttpRequest();
var url =
reqhttp.open("POST", url, true);
reqhttp.setRequestHeader("Content-type", "application/json");
reqhttp.setRequestHeader("Authorization", APIKEY);
reqhttp.responseType = "arraybuffer";

reqhttp.onreadystatechange = function() {
  //Call a function when the state changes.
  if (reqhttp.readyState == 4 && reqhttp.status == 200) {
    var res = reqhttp.response;
    if (res) {
      var uInt8Array = new Uint8Array(res);
      var i = uInt8Array.length;
      var binaryString = new Array(i);
      while (i--) {
        binaryString[i] = String.fromCharCode(uInt8Array[i]);
      var data = binaryString.join("");

      document.getElementById("textbox").innerText = data;

var postData =
  '{ "ReportRoutes": [{"RouteId": "test", "Stops": [{"Address": {"Zip": "08540"},"Label": "Trimble MAPS"}, {"Address": {"Zip": "90266"},"Label": "Manhattan Beach"}], "ReportTypes": [{"__type": "MileageReportType:http://pcmiler.alk.com/APIs/v1.0","THoursWithSeconds": false}]}]}';

function doFunction() {