PHP code example of mehr-it / otto-shipments-api-client

1. Go to this page and download the library: Download mehr-it/otto-shipments-api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mehr-it / otto-shipments-api-client example snippets


    


Instance = new MehrIt\OttoShipmentsApiClient\Api\ShipmentsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$body = array(new \MehrIt\OttoShipmentsApiClient\Model\PositionItem()); // \MehrIt\OttoShipmentsApiClient\Model\PositionItem[] | The position items singPOST: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new MehrIt\OttoShipmentsApiClient\Api\ShipmentsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$body = array(new \MehrIt\OttoShipmentsApiClient\Model\PositionItem()); // \MehrIt\OttoShipmentsApiClient\Model\PositionItem[] | positionItems
$shipment_id = "shipment_id_example"; // string | Internal shipment identifier assigned by OTTO Market.

try {
    $apiInstance->appendPositionItemsUsingPOST($body, $shipment_id);
} catch (Exception $e) {
    echo 'Exception when calling ShipmentsApi->appendPositionItemsUsingPOST: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new MehrIt\OttoShipmentsApiClient\Api\ShipmentsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$body = new \MehrIt\OttoShipmentsApiClient\Model\CreateShipmentRequest(); // \MehrIt\OttoShipmentsApiClient\Model\CreateShipmentRequest | request

try {
    $result = $apiInstance->createdAndSentShipmentUsingPOST($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ShipmentsApi->createdAndSentShipmentUsingPOST: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new MehrIt\OttoShipmentsApiClient\Api\ShipmentsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$datefrom = "datefrom_example"; // string | Shipments created from this date onwards for the given authorized partner will be returned. The date is considered as UTC.
$limit = 25; // int | The maximum number of shipments to be returned in each response.
$next = "next_example"; // string | The cursor which points to the next shipment that should be queried. It is used to paginate the results.

try {
    $result = $apiInstance->listShipmentsUsingGET($datefrom, $limit, $next);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ShipmentsApi->listShipmentsUsingGET: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new MehrIt\OttoShipmentsApiClient\Api\ShipmentsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$carrier = "carrier_example"; // string | The carrier of the shipment.
$tracking_number = "tracking_number_example"; // string | The tracking number of the shipment assigned by the carrier.

try {
    $result = $apiInstance->shipmentByCarrierAndTrackingNumberUsingGET($carrier, $tracking_number);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ShipmentsApi->shipmentByCarrierAndTrackingNumberUsingGET: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new MehrIt\OttoShipmentsApiClient\Api\ShipmentsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$shipment_id = "shipment_id_example"; // string | Internal shipment identifier assigned by OTTO Market.

try {
    $result = $apiInstance->shipmentUsingGET($shipment_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ShipmentsApi->shipmentUsingGET: ', $e->getMessage(), PHP_EOL;
}