Document Retrieval

The R+L Carriers Document Retrieval API formally known as the Proof of Delivery API allows you to retrieve scanned documents related to your shipments.
Get Document Types
HTTP Method: GET
URL: /DocumentRetrieval/GetDocumentTypes
Request Parameters
Name Type Cardinality Required Description
ProNumber string One Required Pro Number
Response Parameters
Name Type Cardinality Description
DocumentTypes array One List of document types that are both available for the pro and you have access to.
Properties
DocumentType string Zero or More Returned values: BillOfLading, DeliveryReceipt, Invoice, WeightCertificate, NmfcCertificate, LetterOfAuthorization,
DeliveryPhoto
Code integer One
Errors array One
Properties
Error object Zero or More
Properties
Property string One
ErrorMessage string One
ExceptionMessage string One
Messages array One
Properties
Message string Zero or More
Example Request

require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{baseurl}/DocumentRetrieval/GetDocumentTypes?ProNumber=I111111111');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'apiKey' => 'Your API Key',
));
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.DocumentRetrieval.Response;
using System.Net.Http;
using System.Net.Http.Headers;

namespace CallAPI
{
class DocumentRetrievalSample
{
string apiKey = "Your API Key";
//GET
public DocRetrievalDocTypeResponse GetDocumentTypes()
{
var response = new DocRetrievalDocTypeResponse();
var proNumber = "I111111111";

var url = string.Format("{baseurl}/DocumentRetrieval/GetDocumentTypes?ProNumber={0}", proNumber);

using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("apiKey", apiKey);
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

var apiResponse = client.GetAsync(url).Result;
response = apiResponse.Content.ReadAsAsync().Result;
}

return response;
}
}
}
package Samples;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;

import com.fasterxml.jackson.databind.ObjectMapper;

import DocumentRetrieval.Response.DocumentRetrievalResponse;

public class DocumentRetrievalSample {
String apiKey = "Your API Key";
ObjectMapper mapper = new ObjectMapper();

public DocRetrievalDocTypeResponse GetDocumentTypes() throws Exception {
DocRetrievalDocTypeResponse response = new DocRetrievalDocTypeResponse();

String url = "{baseurl}/DocumentRetrieval/GetDocumentTypes";

String proNumber = "I111111111";


url += "?ProNumber=" + proNumber;

HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet httprequest = new HttpGet(url);
httprequest.addHeader("apiKey", apiKey);

HttpResponse httpResponse = httpClient.execute(httprequest);

BufferedReader in = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent()));

String inputLine;
StringBuffer result = new StringBuffer();

while ((inputLine = in.readLine()) != null) {
result.append(inputLine);
}
in.close();

response = mapper.readValue(result.toString(), DocRetrievalDocTypeResponse.class);

return response;
}
}
Get Documents
HTTP Method: GET
URL: /DocumentRetrieval
Request Parameters
Name Type Cardinality Required Description
ProNumber string One Required Pro Number
Properties
DocumentType string One or More Required Valid values: BillOfLading, DeliveryReceipt, Invoice, WeightCertificate, NmfcCertificate, LetterOfAuthorization
DocumentTypes array One Required List of document types you want to retrieve.
Properties
DocumentType string One or More Required Valid values: BillOfLading, DeliveryReceipt, Invoice, WeightCertificate, NmfcCertificate, LetterOfAuthorization,
DeliveryPhoto
AllOneDocument boolean One Optional If True: Will combine all requested document types into a single document.
If False: Will return each document type in a separate document.
MediaType string Zero or One Optional Valid values: PDF or TIF.
Default Value: PDF.
Response Parameters
Name Type Cardinality Description
Documents array One List of documents
Properties
Document object One or More Document object
Properties
Name string One If AllInOneDocument was true, this will be the pro number.
If AllInOneDocument was false, it will be "[pro]-[documenttype]".
Data string One Base64 encoded string of the document
Type string One If AllInOneDocument was true, this will be an empty string.
If AllInOneDocument was false, it will be the Document Type
Code integer One
Errors array One
Properties
Error string Zero or More
Properties
Property string One
ErrorMessage string One
ExceptionMessage string One
Messages array One
Properties
Message string Zero or More
Example Request

require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{baseurl}/DocumentRetrieval?DocumentTypes=BillOfLading&ProNumber=056391174&AllInOneDocument=true&MediaType=pdf');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'apiKey' => 'Your API Key',
));
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.DocumentRetrieval.Response;
using System.Net.Http;
using System.Net.Http.Headers;

namespace CallAPI
{
class DocumentRetrievalSample
{
string apiKey = "Your API Key";
//GET
public DocumentRetrievalResponse GetDocuments()
{
var response = new DocumentRetrievalResponse();

var url = "{baseurl}/DocumentRetrieval";

var documentType = "BillOfLading";
var proNumber = "I111111111";
var mediaType = "pdf";
var allInOneDocument = true;

url += "?DocumentTypes=" + documentType + "&ProNumber=" + proNumber + "&AllInOneDocument=" + allInOneDocument + "&MediaType=" + mediaType;
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("apiKey", apiKey);
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

var apiResponse = client.GetAsync(url).Result;
response = apiResponse.Content.ReadAsAsync().Result;
}

return response;
}
}
}
package Samples;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;

import com.fasterxml.jackson.databind.ObjectMapper;

import DocumentRetrieval.Response.DocumentRetrievalResponse;

public class DocumentRetrievalSample {
String apiKey = "Your API Key";
ObjectMapper mapper = new ObjectMapper();

public DocumentRetrievalResponse GetDocuments() throws Exception {
DocumentRetrievalResponse response = new DocumentRetrievalResponse();

String url = "{baseurl}/DocumentRetrieval";

String documentType = "BillOfLading";
String proNumber = "I111111111";
String mediaType = "pdf";
boolean allInOneDocument = true;


url += "?DocumentTypes=" + documentType + "&ProNumber=" + proNumber + "&AllInOneDocument=" + allInOneDocument + "&MediaType=" + mediaType;

HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet httprequest = new HttpGet(url);
httprequest.addHeader("apiKey", apiKey);

HttpResponse httpResponse = httpClient.execute(httprequest);

BufferedReader in = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent()));

String inputLine;
StringBuffer result = new StringBuffer();

while ((inputLine = in.readLine()) != null) {
result.append(inputLine);
}
in.close();

response = mapper.readValue(result.toString(), DocumentRetrievalResponse.class);

return response;
}
}