Library for Canada Post REST API
This PHP package is automatically generated by the Swagger Codegen project:
- API version: 1.0.0
- Build package: io.swagger.codegen.languages.PhpClientCodegen
PHP 5.5 and later
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/spysystem/canadapost-client.git"
}
],
"require": {
"spysystem/canadapost-client": "*@dev"
}
}
Then run composer install
Download the files and include autoload.php
:
require_once('/path/to//vendor/autoload.php');
To run the unit tests:
composer install
./vendor/bin/phpunit
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure HTTP basic authorization: basicAuth
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
$apiInstance = new CanadaPost\Api\DefaultApi(
// 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(),
$config
);
$str_customer = "str_customer_example"; // string | Customer Number
$str_mobo = "str_mobo_example"; // string | Mailed On Behalf Of Custoner Number
$accept_language = "accept_language_example"; // string |
$xmlbody = new \CanadaPost\Model\Shipment(); // \CanadaPost\Model\Shipment | Shipment data
try {
$result = $apiInstance->createShipment($str_customer, $str_mobo, $accept_language, $xmlbody);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->createShipment: ', $e->getMessage(), PHP_EOL;
}
?>
All URIs are relative to https://ct.soa-gw.canadapost.ca/rs
Class | Method | HTTP request | Description |
---|---|---|---|
DefaultApi | createShipment | POST /{strCustomer}/{strMobo}/shipment | creates a Shipment |
DefaultApi | transmitShipment | POST /{strCustomer}/{strMobo}/manifest | transmits a Shipment |
- AddressDetails
- DeliveryCustoms
- DeliveryItem
- DeliveryParcelCharacteristics
- DeliveryPreferences
- DeliveryPrintPreferences
- DeliveryReferences
- DeliverySettlementInfo
- DeliverySpec
- Destination
- ErrorResponseObject
- ErrorResponseMessage
- Manifest
- Manifests
- ManifestsInner
- Sender
- Shipment
- ShipmentInfo
- ShipmentinfoLinks
- Shipments
- TransmitSet
- TransmitsetManifestaddress
- Type: HTTP basic authentication