Documentation :: AllTruckJobs.com

AllTruckJobs API v2.0

Getting Started

The AllTruckJobs API v2.0 is a RESTful API. Requests are made using standard HTTP methods such as GET, POST and DELETE.

The Basics

  • To protect sensitive information, the API communicates ONLY over SSL/TLS-encrypted connections.
  • The API speaks JSON & XML fluently. For maximum performance, we recommend using JSON instead of XML.
  • All date/time fields are formatted according to the rules specified in RFC 3339.

Authentication

Every request you make to our API must be accompanied by your API key. You can find your key in your Company Admin panel. Our API uses HTTP Basic authentication to include the key with your requests.

How to Send Requests

To make implementing our API easier, we've provided examples of how to connect to our API in some popular programming languages:

Sample GET Request
curl -X GET 'https://www.alltruckjobs.com/api/v2.0/drivers.json' \
-u YOUR_API_KEY_HERE:
Sample POST Request
curl -X POST 'https://www.alltruckjobs.com/api/v2.0/jobs.json' \
-d 'STRING_CONTAINING_JSON_JOB_DATA' \
-u YOUR_API_KEY_HERE:
Sample DELETE Request
curl -X DELETE 'https://www.alltruckjobs.com/api/v2.0/jobs.json' \
-d '["abcd1234","abcd5678"]' \
-u YOUR_API_KEY_HERE:
Sample GETRequest
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.alltruckjobs.com/api/v2.0/drivers.json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "YOUR_API_KEY_HERE:"); //Note the colon after your API key (HTTP Basic Auth expects [username:password] format; your API key is your username and there is no password)
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Connection: close"));

$response = curl_exec($ch);
Sample POST Request
$json = "STRING_CONTAINING_JSON_JOB_DATA";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.alltruckjobs.com/api/v2.0/jobs.json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "YOUR_API_KEY_HERE:"); //Note the colon after your API key (HTTP Basic Auth expects [username:password] format; your API key is your username and there is no password)
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Connection: close"));

$response = curl_exec($ch);
Sample DELETE Request
$json = json_encode(array(
    "abcd1234",
    "abcd5678"
));

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.alltruckjobs.com/api/v2.0/jobs.json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST ,"DELETE");
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "YOUR_API_KEY_HERE:"); //Note the colon after your API key (HTTP Basic Auth expects [username:password] format; your API key is your username and there is no password)
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Connection: close"));

$response = curl_exec($ch);
Sample GET Request
using System;
using System.Net.Http;
using System.Net.Http.Headers;

public class Program
{
    public static void Main(string[] args)
    {
        using (HttpClient client = new HttpClient())
        {
            // Set the base URL
            client.BaseAddress = new Uri("https://www.alltruckjobs.com/api/v2.0/");

            // Add the credentials as a Basic Authentication header
            var byteArray = System.Text.Encoding.ASCII.GetBytes("YOUR_API_KEY_HERE:");
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            // Make the GET request synchronously
            HttpResponseMessage response = client.GetAsync("drivers.json").Result;

            if (response.IsSuccessStatusCode)
            {
                string responseData = response.Content.ReadAsStringAsync().Result;
                Console.WriteLine(responseData);
            }
            else
            {
                Console.WriteLine($"Error: {response.StatusCode}");
            }
        }
    }
}
Sample POST Request
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;

public class Program
{
    public static void Main(string[] args)
    {
        using (HttpClient client = new HttpClient())
        {
            // Set the base URL
            client.BaseAddress = new Uri("https://www.alltruckjobs.com/api/v2.0/");

            // Add the credentials as a Basic Authentication header
            var byteArray = System.Text.Encoding.ASCII.GetBytes("YOUR_API_KEY_HERE:");
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            // Encapsule the JSON content into a StringContent object instance
			var json = "{\"field\":\"value\", \"test\":\"value\"}";
			var content = new StringContent(json, Encoding.UTF8, "application/json");

            // Make the POST request synchronously
            HttpResponseMessage response = client.PostAsync("jobs.json", content).Result;

            if (response.IsSuccessStatusCode)
            {
                string responseData = response.Content.ReadAsStringAsync().Result;
                Console.WriteLine(responseData);
            }
            else
            {
                Console.WriteLine($"Error: {response.StatusCode}");
            }
        }
    }
}
Sample DELETE Request
using System;
using System.Net.Http;
using System.Net.Http.Headers;

public class Program
{
    public static void Main(string[] args)
    {
        using (HttpClient client = new HttpClient())
        {
            // Set the base URL
            client.BaseAddress = new Uri("https://www.alltruckjobs.com/api/v2.0/");

            // Add the credentials as a Basic Authentication header
            var byteArray = System.Text.Encoding.ASCII.GetBytes("YOUR_API_KEY_HERE:");
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            // Make the DELETE request synchronously
            HttpResponseMessage response = client.DeleteAsync("jobs.json").Result;

            if (response.IsSuccessStatusCode)
            {
                string responseData = response.Content.ReadAsStringAsync().Result;
                Console.WriteLine(responseData);
            }
            else
            {
                Console.WriteLine($"Error: {response.StatusCode}");
            }
        }
    }
}