Skip to content

GetParcelList

Zsolt Kaveczki edited this page Sep 15, 2020 · 1 revision

Get parcel(s) information by date ranges.

use GuzzleHttp\Client as HttpClient;
use Webapix\GLS\Client;
use Webapix\Requests\GetParcelList;

$request = new GetParcelList; 
$request->addPickupDateInterval(
    \DateTime::createFromFormat('Y-m-d', '2020-08-01'),
    \DateTime::createFromFormat('Y-m-d', '2020-08-02')
);

$client = new Client(new HttpClient);

/** @var \Webapix\GLS\Responses\GetParcelList $response */ 
$response = $client->on(new DefaultAccount)->request($request);

// Parcel(s) information:
var_dump($response->printDataInfo());

You can use the print dates to list the parcels:

use Webapix\Requests\GetParcelList;

$request = new GetParcelList; 
$request->addPrintDateInterval(
    \DateTime::createFromFormat('Y-m-d', '2020-08-01'),
    \DateTime::createFromFormat('Y-m-d', '2020-08-02')
)