Integrating your systems with Australia Post and StarTrack using the Shipping and Tracking APIs enables you to lodge the information we need when sending parcels through our delivery networks. You can currently use the Shipping and Tracking APIs for... - Lodgement of parcels – creates an order, including all the shipments and items, and lodges the parcels with Australia Post and StarTrack - Label printing - prints our most up-to-date labels to improve your operational efficiency - Getting your contract details - gives all your current account information, including products, contract expiry dates & product features - Getting your contract pricing - provides an indicative price at checkout to enable the best service to be selected, giving you confidence of cost of lodgement - Tracking your parcels - allows you to easily surface tracking information on your website for your staff or customers
This PHP package is automatically generated by the Swagger Codegen project:
- API version: 1.0.2
- Package version: 1.0.2
- Build package: io.swagger.codegen.v3.generators.php.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/chrishemmings/auspost.git"
}
],
"require": {
"chrishemmings/auspost": "*@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
$config = ChrisHemmings\AusPost\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
// Configure API key authorization: CustomerAccount
$config = ChrisHemmings\AusPost\Configuration::getDefaultConfiguration()->setApiKey('Account-Number', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ChrisHemmings\AusPost\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Account-Number', 'Bearer');
$apiInstance = new ChrisHemmings\AusPost\Client\Api\AccountApi(
// 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
);
$account_number = "account_number_example"; // string | Numeric id of the charge account to query. Note this is a parameter to the request in addition to the account-number header field.
try {
$result = $apiInstance->accountsAccountNumberGet($account_number);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AccountApi->accountsAccountNumberGet: ', $e->getMessage(), PHP_EOL;
}
// Configure HTTP basic authorization: BasicAuth
$config = ChrisHemmings\AusPost\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
// Configure API key authorization: CustomerAccount
$config = ChrisHemmings\AusPost\Configuration::getDefaultConfiguration()->setApiKey('Account-Number', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ChrisHemmings\AusPost\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Account-Number', 'Bearer');
$apiInstance = new ChrisHemmings\AusPost\Client\Api\AccountApi(
// 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
);
$suburb = "suburb_example"; // string | Suburb.
$state = "state_example"; // string | State.
$postcode = "postcode_example"; // string | Postcode.
try {
$result = $apiInstance->addressGet($suburb, $state, $postcode);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AccountApi->addressGet: ', $e->getMessage(), PHP_EOL;
}
?>
All URIs are relative to https://digitalapi.auspost.com.au/test/shipping/v1
Class | Method | HTTP request | Description |
---|---|---|---|
AccountApi | accountsAccountNumberGet | GET /accounts/{account_number} | Fetch account information |
AccountApi | addressGet | GET /address | Validate Suburb |
ShipmentApi | labelsPost | POST /labels | Create Labels |
ShipmentApi | shipmentsPost | POST /shipments | Create Domestic Shipments |
- AccountDetails
- AccountInformation
- Address
- AddressLine
- CreateLabelsRequest
- CreateLabelsResponse
- CreateShipmentsRequest
- CreateShipmentsResponse
- Error
- ItemContents
- ItemFeatures
- LabelGroups
- LabelPreference
- LabelShipments
- LabelShipmentsItems
- LabelsResponseLabels
- LabelsResponseLabelsLabelProperties
- PostageProductContract
- PostageProductFeatures
- PostageProductOptions
- PostageProducts
- ResponseError
- ShipmentFromAddress
- ShipmentItem
- ShipmentRequest
- ShipmentResponse
- ShipmentResponseItems
- ShipmentResponseItemsItemsummary
- ShipmentResponseItemsShipmentSummary
- ShipmentResponseItemsTrackingDetails
- ShipmentToAddress
- ValidateSuburbResponse
- Type: HTTP basic authentication
- Type: API key
- API key parameter name: Account-Number
- Location: HTTP header