Transit Times
Receiving an accurate shipping transit time estimate is a crucial part of making an informed decision for your business. When you are in a hurry for transit times, look no further than R+L Carriers Transit Times API.
Get Transit Times
HTTP Method: POST
URL: /TransitTimes
URL: /TransitTimes
Request Parameters
Name | Type | Cardinality | Required | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PickupDate | string | One | Optional | Transit pickup date. If not passed, we will default to today's date. If we do not service the Origin on that date, it will be moved to the next day we do. Dates on weekends or company holidays will be moved to the next business day we service the origin. | ||||||||||||||||||||||||||||||
Origin | object | One | Required | Transit origin | ||||||||||||||||||||||||||||||
Properties
|
||||||||||||||||||||||||||||||||||
Destinations | array | One | Required | List of Destinations | ||||||||||||||||||||||||||||||
Properties
|
||||||||||||||||||||||||||||||||||
ApiKey | string | One | Required | The unique identifier for the user | ||||||||||||||||||||||||||||||
Properties
|
Response Parameters
Name | Type | Cardinality | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PickupDate | date | One | Transit time pickup date. This could be adjusted from your input if the input pickup date falls on the weekend or a company holiday as well as if your origin is only serviced on certain days of the week. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Origin | object | One | Transit time origin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Destinations | array | One | List of Destination objects | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Code | integer | One | HTTP Status code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Errors | array | One | Returned errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Messages | array | One | Returned informational messages | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
Example Request
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{baseurl}/TransitTimes');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'apiKey' => 'Your API Key',
'Content-Type' => 'application/json',
));
$request->setBody('{
\n "PickupDate": "08/17/2020",
\n "Origin": {
\n "City": "Ocala",
\n "StateOrProvince": "FL",
\n "ZipOrPostalCode": "34471",
\n "CountryCode": "USA"
\n },
\n "Destinations": [
\n {
\n "City": "Wilmington",
\n "StateOrProvince": "OH",
\n "ZipOrPostalCode": "45177",
\n "CountryCode": "USA"
\n }
\n ]
\n}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
using CallAPI.DataContracts;
using CallAPI.DataContracts.TransitTimes.Request;
using CallAPI.DataContracts.TransitTimes.Response;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
namespace CallAPI
{
class TransitTimesSample
{
string apiKey = "Your API Key";
public TransitTimesResponse CalculateTransitTimes()
{
var request = new TransitTimesRequest()
{
PickupDate = DateTime.Now.ToShortDateString(),
Origin = GetOrigin(),
Destinations = GetDestinations()
};
var url = "{baseurl}/TransitTimes";
var response = new TransitTimesResponse();
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("apiKey", apiKey);
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var apiResponse = client.PostAsJsonAsync(url, request).Result;
response = apiResponse.Content.ReadAsAsync().Result;
}
return response;
}
private ServicePoint GetOrigin()
{
var origin = new ServicePoint()
{
City = "Wilmington",
StateOrProvince = "OH",
ZipOrPostalCode = "45177",
CountryCode = "USA"
};
return origin;
}
private List GetDestinations()
{
var destination = new ServicePoint()
{
City = "Ocala",
StateOrProvince = "FL",
ZipOrPostalCode = "34471",
CountryCode = "USA"
};
var destinations = new List() { destination };
return destinations;
}
}
}
package Samples;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import com.fasterxml.jackson.databind.ObjectMapper;
import DataContracts.ServicePoint;
import DataContracts.TransitTimes.Request.TransitTimesRequest;
import DataContracts.TransitTimesResponse.TransitTimesResponse;
public class TransitTimesSample {
String apiKey = "Your API Key";
ObjectMapper mapper = new ObjectMapper();
public TransitTimesResponse CalculateTransitTimes() throws Exception{
TransitTimesResponse response = new TransitTimesResponse();
TransitTimesRequest request = new TransitTimesRequest();
request.PickupDate = LocalDate.now().format(DateTimeFormatter.ofPattern("MM/dd/yyyy"));
request.Origin = GetOrigin();
request.Destinations = GetDestinations();
String requestJSON = mapper.writeValueAsString(request);
String url = "{baseurl}/TransitTimes";
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost httpRequest = new HttpPost(url);
StringEntity params =new StringEntity(requestJSON);
httpRequest.addHeader("content-type", "application/json");
httpRequest.addHeader("apiKey", apiKey);
httpRequest.setEntity(params);
HttpResponse httpResponse = httpClient.execute(httpRequest);
BufferedReader rd = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent()));
StringBuffer result = new StringBuffer();
String line = "";
while ((line = rd.readLine()) != null) {
result.append(line);
}
response = mapper.readValue(result.toString(), TransitTimesResponse.class);
return response;
}
private ServicePoint GetOrigin()
{
ServicePoint origin = new ServicePoint();
origin.City = "Wilmington";
origin.StateOrProvince = "OH";
origin.ZipOrPostalCode = "45177";
origin.CountryCode = "USA";
return origin;
}
private List GetDestinations()
{
ServicePoint destination = new ServicePoint();
destination.City = "Ocala";
destination.StateOrProvince = "FL";
destination.ZipOrPostalCode = "34471";
destination.CountryCode = "USA";
List destinations = new ArrayList();
destinations.add(destination);
return destinations;
}
}