Pickup Request

Pickup Request

Status
Request Type
POST

In order to schedule a pickup for your shipment, you must first have made a call to the bill of lading execute endpoint (which in turn requires calling the bill of lading LCC endpoint). A successful response from the execute endpoint will include the bill of lading id as well as the bill of lading date. The pickup request endpoint requires all the same data that was required for the execute endpoint, plus (1) the date and time the shipment will be ready, (2) the date and time the dock will close, and (3) the bill of lading date and id (concatenated together).

Carrier Inconsistencies

Some carriers may return their own errors. Some carriers may not return a pronumber, while others may not return a confirmation number.



On this page:

Supported Carriers
 Click here to expand...
Carrier NameSCAC
A. Duie Pyle, Inc.PYLE
AAA CooperAACT
ABF Freight Systems, Inc.ABFS
Averitt Express, Inc.AVRT or AVR9
Central Arizona FreightCAZF
Central Freight LinesCENF
Central TransportCTI1
DATS Trucking, Inc.DTST
Dayton FreightDAFG
Diamond Line Delivery Systems, Inc.DLDS
Dohrn TransferDHRN
Double D Express, Inc.DBDE
Estes ExpressEXLA or EXLG
Expedited Freight SystemsEXDF
FedEx Freight EconomyFXNL
FedEx Freight PriorityFXFE
Lakeville Motor ExpressLKVL
Midwest Motor Express, Inc.MIDW
Mountain Valley ExpressMTVL
MTS FreightMRGQ
New England Motor FreightNEMF
New Penn Motor ExpressNPME
Oak Harbor Freight LinesOAKH
Old Dominion Freight LinesODFL
Pitt OhioPITD
Roadrunner Transportation ServicesRDFS or ROA8
SAIA Motor Freight Line, Inc.SAIA or SAIG
South Eastern Freight LinesSEFL or SEFI
Sutton Transport, Inc.SUON
UPS Ground Freight, Inc.UPGF
USF HollandHMES
Volpe Express, Inc.VOLP
Ward TruckingWARD
Wilson TruckingWTVA
XPO LogisticsCNWY
YRC, Inc.RDWY

Endpoint

https://tms.targetfmi.com/index.php?p=api&r=json&c=pickupRequest&m=schedulePickup

Request Parameters

ParameterRequired

Available Options/Data Type

Description
testNo1 or 0 / intWhen the test flag is provided in the request body, a successful mock response is returned without contacting the carrier. This flag can be used during development to avoid scheduling real pickup requests with carriers.
schedulePickupYesn/aSchedule pickup container node.
schedulePickup/pickupDateTimeYesdate and time / stringYour local ready time. The time when your shipment can be ready for carrier to pickup. Restrictions may apply. Contact carrier for details. (Example: 'August 21, 2019 08:00 AM')
schedulePickup/dockCloseTimeYesdate and time / stringYour local close time. The time when your loading docks will close, the latest time a carrier will arrive. Restrictions may apply. Contact carrier for details. (Example: 'August 21, 2019 05:00 PM')
general/saved_bolYesbol date and id / stringConcatenation of the bill of lading date and id from the bill of lading execute endpoint. (Example '201908219999')

Examples

Using an Array
<?php

/**
* Pickup Request Example (Using Array Format)
*/

require_once "../../restClient.class.php";

$resource = "https://tms.targetfmi.com/index.php";
$user = "your_api_key_goes_here";
$pass = "";
$separator = "?";

$rest = new restClient($resource, $user, $pass, $separator);

// The request data is abbreviated here, but this demonstrates where to include the additional information.
$request = array(
    'schedulePickup' => array(
            'pickupDateTime' => 'August 21, 2019 08:00 AM',
            'dockCloseTime' => 'August 21, 2019 05:00 PM'
    ),	
    'carrier' => array(
    ),
    'special' => array(
    ),
    'general' => array(
		'saved_bol' => '201908219999'
    ),
    'location' => array(
    ),
    'units' => array(
    )
);

$response = $rest->post("p=api&r=text&c=pickupRequest&m=schedulePickup", $request);

?>


Response Parameters

Parameter Name

Description

body
body/ProNumberThis may or may not be returned by a carrier.
body/ConfirmationNumberThis may or may not be returned by a carrier.
body/TransactionIDThis may or may not be returned by a carrier.

Example

Example Response (Success)
 Array
(
    [body] => Array
        (
            [ProNumber] => 
            [ConfirmationNumber] => PIT-0327829
            [TransactionID] => 
        )

    [message] => Array
        (
            [0] => Array
                (
                    [type] => success
                    [message] => Saved transit information.
                    [stacktrace] => Array
                        (
                            [0] => model
                            [1] => saveTransitInfo
                            [2] => 
                        )

                )

        )

)
Example Response (Error)
 Array
(
    [body] => Array
        (
            [ProNumber] => 
            [ConfirmationNumber] => PIT-0327829
            [TransactionID] => 
        )

    [message] => Array
        (
            [0] => Array
                (
                    [type] => alert
                    [message] => There was an error trying to update the Bill of Lading.
                    [stacktrace] => Array
                        (
                            [0] => model
                            [1] => schedule_pickup
                            [2] => 500.11
                        )

                )

            [1] => Array
                (
                    [type] => error
                    [message] => An error occured saving the BoL.
                    [stacktrace] => Array
                        (
                            [0] => model
                            [1] => save_new_bol
                            [2] => 500.2
                        )

                )

            [2] => Array
                (
                    [type] => alert
                    [message] => We could not update the BoL details with a PRO. Database Error! Contact IS Immediately!
                    [stacktrace] => Array
                        (
                            [0] => model
                            [1] => schedule_pickup
                            [2] => 500.9
                        )

                )

        )

)

Full Example

Example
 <?php
    
    require_once('../../restClient.class.php');
 
    $resource = 'https://tms.targetfmi.com/index.php';

    // Response has been set to json for these endpoints so we can work with response data
    $lcc = 'p=api&r=json&c=rater&m=lcc';
    $execute = 'p=api&r=json&c=billoflading&m=execute';

    // Response has been set to text for this endpoint
    $pickupRequest = 'p=api&r=text&c=pickupRequest&m=schedulePickup';

    $user = 'your_api_key_goes_here';
    $pass = '';
    $separator = '?';
 
    $rest = new restClient($resource, $user, $pass, $separator);
     
    /**
     * LCC Example (Using Array Format)
     */
    $request = array(
        'general' => array(
            'code' => 'CODE',
            'shipper' => 15236,
            'consignee' => 15236,
            'shipment_type' => "Outbound/Prepaid",
        ),
        'units' => array(
            array(
                'num_of' => 1,
                'type' => 'pallet',
                'stack' => 'No',
                'length' => 40,
                'width' => 40,
                'height' => 48,
                'products' => array(
                    array(
                        'pieces' => 1,
                        'weight' => 250,
                        'class' => 175,
                    ),
                ),
            ),
        ),
    );

    $response = $rest->post($lcc, $request);
 
	// Turn JSON into object
    $carriers = json_decode($response);

    // Very basic error handling
    if(empty($carriers->body->carriers)) {
        die('There are no carriers available.');
    }

 
    $query_id = $carriers->body->query_id;
    $carrier = $carriers->body->carriers[0]->scac;
    
    /**
     * Bill of Lading Example (Using Array Format)
     */
 
    $request = array(
        'carrier' => array(
            'query_id' => $query_id,
            'carrier_scac' => $carrier,
        ),
        'special' => array(),
        'general' => array(
            'pro' => '',
            'saved_bol' => '',
            'bol' => '',
            'po' => '',
            'so' => '',
            'ref' => '',
            'status' => '',
            'warehouse' => 'CODE',
            'direction' => 'Outbound/Prepaid',
        ),
        'location' => array(
            'shipper' => array(
                'name' => 'Test Shipper Company Name',
                'address1' => '123 Sesame St',
                'address2' => '',
                'city' => 'Pittsburgh',
                'state' => 'PA',
                'zip' => '15236',
                'country' => '',
                'contact_name' => 'Test Shipper Contact Name',
                'contact_phone' => '000-000-0000',
                'contact_fax' => '',
                'contact_email' => 'contact@example.com',
                'save' => FALSE,
            ),
            'consignee' => array(
                'name' => 'Test Consignee Company Name',
                'address1' => '123 Sesame St',
                'address2' => '',
                'city' => 'Pittsburgh',
                'state' => 'PA',
                'zip' => '15236',
                'country' => '',
                'contact_name' => 'Test Consignee Contact Name',
                'contact_phone' => '000-000-0000',
                'contact_fax' => '',
                'contact_email' => 'contact@example.com',
                'save' => FALSE,
            ),
            'billing' => array(
                'name' => 'Test Billing Company Name',
                'address1' => '123 Sesame St',
                'address2' => '',
                'city' => 'Pittsburgh',
                'state' => 'PA',
                'zip' => '15236',
                'country' => '',
                'contact_name' => 'Test Billing Contact Name',
                'contact_phone' => '000-000-0000',
                'contact_fax' => '',
                'contact_email' => 'contact@example.com',
                'save' => FALSE,
            ),
        ),
        'units' => array(
            array(
                'details' => array(
                    'pieces' => 1,
                    'stack' => 0,
                    'type' => 'Pallet',
                    'length' => 36,
                    'width' => 36,
                    'height' => 36,
                ),
                'products' => array(
                    array(
                        'product' => 'A Test Product',
                        'pieces' => 1,
                        'uom' => 'Piece',
                        'nmfc' => '',
                        'sub_nmfc' => '',
                        'class' => 50,
                        'weight' => 300,
                        'hazmat' => array(),
                    ),
                ),
            ),
        ),
    );
     
    $response = $rest->post($execute, $request);

    // Turn JSON into object
    $bolData = json_decode($response);

	// Very basic error handling
    if(empty($bolData->body->bolId)) {
        die('Bill of lading was not saved.');
    }

    // Concatenate bill of lading date and id
    $bolId = $bolData->body->bolId;
    $bolDate = $bolData->body->date;
    $savedBOL = $bolDate . $bolId;

    $request = array(
        'schedulePickup' => array(
            'pickupDateTime' => 'August 30, 2019 08:00 AM',
            'dockCloseTime' => 'August 30, 2019 05:00 PM'
        ),
        'carrier' => array(
            'query_id' => $query_id,
            'carrier_scac' => $carrier,
        ),
        'special' => array(),
        'general' => array(
            'pro' => '',
            'saved_bol' => $savedBOL,
            'bol' => '',
            'po' => '',
            'so' => '',
            'ref' => '',
            'status' => '',
            'warehouse' => 'CODE',
            'direction' => 'Outbound/Prepaid',
        ),
        'location' => array(
            'shipper' => array(
                'name' => 'Test Shipper Company Name',
                'address1' => '123 Sesame St',
                'address2' => '',
                'city' => 'Pittsburgh',
                'state' => 'PA',
                'zip' => '15236',
                'country' => '',
                'contact_name' => 'Test Shipper Contact Name',
                'contact_phone' => '000-000-0000',
                'contact_fax' => '',
                'contact_email' => 'contact@example.com',
                'save' => FALSE,
            ),
            'consignee' => array(
                'name' => 'Test Consignee Name',
                'address1' => '123 Seseame St',
                'address2' => '',
                'city' => 'Pittsburgh',
                'state' => 'PA',
                'zip' => '15236',
                'country' => '',
                'contact_name' => 'Test Consignee Contact Name',
                'contact_phone' => '000-000-0000',
                'contact_fax' => '',
                'contact_email' => 'contact@example.com',
                'save' => FALSE,
            ),
            'billing' => array(
                'name' => 'Test Billing Company Name',
                'address1' => '123 Sesame St',
                'address2' => '',
                'city' => 'Pittsburgh',
                'state' => 'PA',
                'zip' => '15236',
                'country' => '',
                'contact_name' => 'Test Billing Contact Name',
                'contact_phone' => '000-000-0000',
                'contact_fax' => '',
                'contact_email' => 'contact@example.com',
                'save' => FALSE,
            ),
        ),
        'units' => array(
            array(
                'details' => array(
                    'pieces' => 1,
                    'stack' => 0,
                    'type' => 'Pallet',
                    'length' => 36,
                    'width' => 36,
                    'height' => 36,
                ),
                'products' => array(
                    array(
                        'product' => 'A Test Product',
                        'pieces' => 1,
                        'uom' => 'Piece',
                        'nmfc' => '',
                        'sub_nmfc' => '',
                        'class' => 50,
                        'weight' => 300,
                        'hazmat' => array(),
                    ),
                ),
            ),
        ),
    );

    $response = $rest->post($pickupRequest, $request);

?>