Developer Guide

The Trip Management service is your one-stop shop for generating truly compliant routes. Built upon our industry standard PC*MILER Web Services, Trip Management generates optimal routes for your delivery, inserting any fuel stops and/or necessary driver rest stops along the route. With these additional stops, you can more confidently determine your load’s true ETA.

This API guide will tell you how to interact with Trip Management and get you well on your way.

Resource URL

https://tripmanagement.alk.com/api/

Service Authentication

Every web service request needs to be authenticated. The process is simple. You just need to add the API key (enterprise app) or Single Sign-On token (consumer app) to the HTTP Authorization header. Examples for jQuery and Angular2 are listed below:

jQuery Example: Use HTTP POST to create a trip

var uri = "https://tripmanagement.alk.com/api/trip"; // The web service endpoint.
var request = {}; // Request data that will be sent to the service. Details for each API are listed in the help pages.
var apiKey = ""; // The API key obtained from ALK.
$.ajax({
  url: uri,
  type: "POST", // or "GET", "DELETE"
  data: request,
  contentType: "application/json; charset=utf-8",
  dataType: "json",
  beforeSend: function(xhr) {
    xhr.setRequestHeader("Authorization", apiKey);
  },
  success: function(resp) {
    // Your code goes here
  },
  error: function(resp) {
    // Your code goes here
  }
});

Angular 2 TypeScript Example: Use HTTP GET to retrieve a trip by trip id.

import {Injectable} from '@angular/core';
import {Http, Headers} from '@angular/http';
import 'rxjs/add/operator/map';

@Injectable()
export /**
 * RouteService
 */
  class RouteService {
  trueEtaUri: string = 'https://tripmanagement.alk.com/api/trip/'; // The web service endpoint.
  trueEtaApiKey: string = ''; // The API key obtained from ALK.

  /**
   * Constructor
   */
  constructor(private http: Http) {
    // Additional code for the class construction.
  }

  /**
   * Public Method: Gets trip by id.
   *
   * Parameters:
   * tripId - {number} trip id
   */
  getTrueEtaTrip(tripId: number) {
    return this.makeRequest(this.trueEtaUri + tripId);
  }

  /**
   * Private Method: Add API key to the HTTP authentication header.
   *
   * Parameters:
   * headers - {Headers} - HTTP header collection
   * authToken - {string} - API key from ALK
   */
  private createAuthorizationHeader(headers: Headers, authToken: string) {
    headers.append('Authorization', authToken);
  }

  /**
   * Private Method: Sends request to the service.
   *
   * Parameters:
   * path - {string} web service request URI
   */
  private makeRequest(path: string) {
    let headers = new Headers();
    this.createAuthorizationHeader(headers, this.trueEtaApiKey);
    return this.http.get(path, { headers: headers })
      .map((res) => res.json());
  }
}
Last updated April 16, 2019.