https://github.com/zvps/royal-mail-shipping-rest-api-client
Royal Mail Pro Shipping v3 REST API PHP Client
https://github.com/zvps/royal-mail-shipping-rest-api-client
php royal-mail shipping-api
Last synced: about 1 year ago
JSON representation
Royal Mail Pro Shipping v3 REST API PHP Client
- Host: GitHub
- URL: https://github.com/zvps/royal-mail-shipping-rest-api-client
- Owner: zVPS
- License: gpl-3.0
- Created: 2018-06-12T08:55:05.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-04-06T15:08:48.000Z (about 4 years ago)
- Last Synced: 2025-03-25T09:02:32.749Z (about 1 year ago)
- Topics: php, royal-mail, shipping-api
- Language: PHP
- Homepage: https://developer.royalmail.net/node/1874755
- Size: 371 KB
- Stars: 8
- Watchers: 1
- Forks: 9
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Royal Mail API Shipping v3 Client
This API specification details the requirements for integrating with **Royal Mail API Shipping V3**.
It specifically covers how the Royal Mail API Shipping V3 can be used by business customers to conduct shipping activity with Royal Mail and provides the technical information to build this integration. This specification must be used with the relevant accompanying specifications for customers wishing to interface their systems with Royal Mail services.
Royal Mail API Shipping V3 exposes a fully RESTful service that allows account customers to create shipments, produce labels, and produce documentation for all the tasks required to ship domestic items with Royal Mail.
Built on industry standards, Royal Mail API Shipping V3 provides a simple and low cost method for customers to integrate with Royal Mail, and allows them to get shipping quickly. The API offers data streaming and offline barcoding to allow customers greater flexibility when generating their labels. There are no costs to customers for using the Royal Mail API Shipping V3 services, however customers’ own development costs must be covered by the customer developing the solution. Royal Mail will not accept any responsibility for these development, implementation and testing costs. Customers should address initial enquiries regarding development of systems for these purposes to their account handler.
This API can be used in conjunction with Royal Mail Pro Shipping, a GUI based shipping platform. For more details on Royal Mail Pro Shipping, including videos on and briefs on updating/ cancelling a shipment and Manifesting please refer to http://www.royalmail.com/pro-shipping-help.
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: 3.0.12
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen
## Requirements
PHP 5.5 and later
## Installation & Usage
### Composer
To install the bindings via [Composer](http://getcomposer.org/), add the following to `composer.json`:
```
{
"repositories": [
{
"type": "git",
"url": "https://github.com/zVPS/royal-mail-shipping-rest-api-client.git"
}
],
"require": {
"zVPS/royal-mail-shipping-rest-api-client": "*@dev"
}
}
```
Then run `composer install`
### Manual Installation
Download the files and include `autoload.php`:
```php
require_once 'vendor/autoload.php';
```
## Tests
To run the unit tests:
```
composer install
./vendor/bin/phpunit
```
## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following:
```php
setApiKey('X-IBM-Client-Id', 'YOUR_API_KEY');
$config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKey('X-IBM-Client-Secret', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-IBM-Client-Id', 'Bearer');
$apiInstance = new RoyalMail\Shipping\Rest\ApiAddressesApi(
// 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
);
$body = new \RoyalMail\Shipping\Rest\Api\models\Address(); // \RoyalMail\Shipping\Rest\Api\models\Address | The address.
$xRMGAuthToken = "xRMGAuthToken_example"; // string | Authorisation token required to invoke this operation. Can be retrieved by invoking the **_/token** operation.
try {
$result = $apiInstance->addressesCreate($body, $xRMGAuthToken);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AddressesApi->addressesCreate: ', $e->getMessage(), PHP_EOL;
}
// Configure API key authorization: clientID
$config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKey('X-IBM-Client-Id', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-IBM-Client-Id', 'Bearer');
$apiInstance = new RoyalMail\Shipping\Rest\ApiAddressesApi(
// 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
);
$xRMGAuthToken = "xRMGAuthToken_example"; // string | Authorisation token required to invoke this operation. Can be retrieved by invoking the **_/token** operation.
$addressId = "addressId_example"; // string | Your unique Address ID of the address to delete.
try {
$result = $apiInstance->addressesDelete($xRMGAuthToken, $addressId);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AddressesApi->addressesDelete: ', $e->getMessage(), PHP_EOL;
}
// Configure API key authorization: clientID
$config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKey('X-IBM-Client-Id', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-IBM-Client-Id', 'Bearer');
$apiInstance = new RoyalMail\Shipping\Rest\ApiAddressesApi(
// 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
);
$xRMGAuthToken = "xRMGAuthToken_example"; // string | Authorisation token required to invoke this operation. Can be retrieved by invoking the **_/token** operation.
$addressId = "addressId_example"; // string | Your unique Address ID.
try {
$result = $apiInstance->addressesGet($xRMGAuthToken, $addressId);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AddressesApi->addressesGet: ', $e->getMessage(), PHP_EOL;
}
// Configure API key authorization: clientID
$config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKey('X-IBM-Client-Id', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-IBM-Client-Id', 'Bearer');
$apiInstance = new RoyalMail\Shipping\Rest\ApiAddressesApi(
// 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
);
$xRMGAuthToken = "xRMGAuthToken_example"; // string | Authorisation token required to invoke this operation. Can be retrieved by invoking the **_/token** operation.
try {
$result = $apiInstance->addressesGetAll($xRMGAuthToken);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AddressesApi->addressesGetAll: ', $e->getMessage(), PHP_EOL;
}
// Configure API key authorization: clientID
$config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKey('X-IBM-Client-Id', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-IBM-Client-Id', 'Bearer');
$apiInstance = new RoyalMail\Shipping\Rest\ApiAddressesApi(
// 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
);
$body = new \RoyalMail\Shipping\Rest\Api\models\Address(); // \RoyalMail\Shipping\Rest\Api\models\Address | The address with the updated details.
$xRMGAuthToken = "xRMGAuthToken_example"; // string | Authorisation token required to invoke this operation. Can be retrieved by invoking the **_/token** operation.
$addressId = "addressId_example"; // string | Your unique Address ID of the address to update.
try {
$result = $apiInstance->addressesUpdate($body, $xRMGAuthToken, $addressId);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AddressesApi->addressesUpdate: ', $e->getMessage(), PHP_EOL;
}
?>
```
## Documentation for API Endpoints
All URIs are relative to *///shipping/v3*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AddressesApi* | [**addressesCreate**](docs/Api/AddressesApi.md#addressescreate) | **POST** /addresses | Create Address
*AddressesApi* | [**addressesDelete**](docs/Api/AddressesApi.md#addressesdelete) | **DELETE** /addresses/{addressId} | Delete Address
*AddressesApi* | [**addressesGet**](docs/Api/AddressesApi.md#addressesget) | **GET** /addresses/{addressId} | Get Address
*AddressesApi* | [**addressesGetAll**](docs/Api/AddressesApi.md#addressesgetall) | **GET** /addresses | Get Addresses
*AddressesApi* | [**addressesUpdate**](docs/Api/AddressesApi.md#addressesupdate) | **PUT** /addresses/{addressId} | Update address
*ItemsApi* | [**itemsCreate**](docs/Api/ItemsApi.md#itemscreate) | **POST** /items | Create Item
*ItemsApi* | [**itemsDelete**](docs/Api/ItemsApi.md#itemsdelete) | **DELETE** /items/{itemId} | Delete Item
*ItemsApi* | [**itemsGet**](docs/Api/ItemsApi.md#itemsget) | **GET** /items/{itemId} | Get Item
*ItemsApi* | [**itemsGetAll**](docs/Api/ItemsApi.md#itemsgetall) | **GET** /items | Get Items
*ItemsApi* | [**itemsUpdate**](docs/Api/ItemsApi.md#itemsupdate) | **PUT** /items/{itemId} | Update item
*ManifestsApi* | [**manifestsCreate**](docs/Api/ManifestsApi.md#manifestscreate) | **POST** /manifests | Manifest All Shipments
*ManifestsApi* | [**manifestsCreateByCarrier**](docs/Api/ManifestsApi.md#manifestscreatebycarrier) | **POST** /manifests/bycarrier | Manifest by Carrier Code(s)
*ManifestsApi* | [**manifestsCreateByService**](docs/Api/ManifestsApi.md#manifestscreatebyservice) | **POST** /manifests/byservice | Manifest by Service Code(s)
*PackagingApi* | [**packagingCreate**](docs/Api/PackagingApi.md#packagingcreate) | **POST** /packaging | Create Packaging
*PackagingApi* | [**packagingDelete**](docs/Api/PackagingApi.md#packagingdelete) | **DELETE** /packaging/{packagingId} | Delete Packaging
*PackagingApi* | [**packagingGet**](docs/Api/PackagingApi.md#packagingget) | **GET** /packaging/{packagingId} | Get Packaging
*PackagingApi* | [**packagingGetAll**](docs/Api/PackagingApi.md#packaginggetall) | **GET** /packaging | Get All Packaging
*PackagingApi* | [**packagingUpdate**](docs/Api/PackagingApi.md#packagingupdate) | **PUT** /packaging/{packagingId} | Update packaging
*ShipmentsApi* | [**shipmentsCancel**](docs/Api/ShipmentsApi.md#shipmentscancel) | **PUT** /shipments/cancel | Cancel Shipments
*ShipmentsApi* | [**shipmentsCreate**](docs/Api/ShipmentsApi.md#shipmentscreate) | **POST** /shipments | Create Shipment
*ShipmentsApi* | [**shipmentsDefer**](docs/Api/ShipmentsApi.md#shipmentsdefer) | **PUT** /shipments/defer | Defer Shipments
*ShipmentsApi* | [**shipmentsHold**](docs/Api/ShipmentsApi.md#shipmentshold) | **PUT** /shipments/hold | Hold Shipments
*ShipmentsApi* | [**shipmentsPrintDocument**](docs/Api/ShipmentsApi.md#shipmentsprintdocument) | **PUT** /shipments/{shipmentId}/printDocument | Print Document
*ShipmentsApi* | [**shipmentsPrintLabel**](docs/Api/ShipmentsApi.md#shipmentsprintlabel) | **PUT** /shipments/{shipmentId}/printLabel | Print Label
*ShipmentsApi* | [**shipmentsRelease**](docs/Api/ShipmentsApi.md#shipmentsrelease) | **PUT** /shipments/release | Release Shipments
*ShipmentsApi* | [**shipmentsServiceAvailability**](docs/Api/ShipmentsApi.md#shipmentsserviceavailability) | **POST** /shipments/serviceAvailability | Service Availability
*TokenApi* | [**authenticatePost**](docs/Api/TokenApi.md#authenticatepost) | **POST** /token | Authenticates a User and provides token.
## Documentation For Models
- [Address](docs/Model/Address.md)
- [AddressResponse](docs/Model/AddressResponse.md)
- [CreateShipmentDestination](docs/Model/CreateShipmentDestination.md)
- [CreateShipmentServiceOptions](docs/Model/CreateShipmentServiceOptions.md)
- [CreateShipmentShipment](docs/Model/CreateShipmentShipment.md)
- [CreateShipmentShipmentInformation](docs/Model/CreateShipmentShipmentInformation.md)
- [CreateShipmentShipmentPackage](docs/Model/CreateShipmentShipmentPackage.md)
- [ErrorDetail](docs/Model/ErrorDetail.md)
- [Item](docs/Model/Item.md)
- [ItemResponse](docs/Model/ItemResponse.md)
- [Manifest](docs/Model/Manifest.md)
- [ManifestCarrierCodesRequest](docs/Model/ManifestCarrierCodesRequest.md)
- [ManifestRequest](docs/Model/ManifestRequest.md)
- [ManifestResponse](docs/Model/ManifestResponse.md)
- [ManifestServiceCodesRequest](docs/Model/ManifestServiceCodesRequest.md)
- [PackageResponse](docs/Model/PackageResponse.md)
- [Packaging](docs/Model/Packaging.md)
- [PackagingResponse](docs/Model/PackagingResponse.md)
- [PrintDocumentRequest](docs/Model/PrintDocumentRequest.md)
- [PrintDocumentResponse](docs/Model/PrintDocumentResponse.md)
- [PrintLabelRequest](docs/Model/PrintLabelRequest.md)
- [PrintLabelResponse](docs/Model/PrintLabelResponse.md)
- [ServiceAvailabilityDestination](docs/Model/ServiceAvailabilityDestination.md)
- [ServiceAvailabilityFormat](docs/Model/ServiceAvailabilityFormat.md)
- [ServiceAvailabilityOption](docs/Model/ServiceAvailabilityOption.md)
- [ServiceAvailabilityResponse](docs/Model/ServiceAvailabilityResponse.md)
- [ServiceAvailabilityServiceOptions](docs/Model/ServiceAvailabilityServiceOptions.md)
- [ServiceAvailabilityShipment](docs/Model/ServiceAvailabilityShipment.md)
- [ServiceAvailabilityShipmentInformation](docs/Model/ServiceAvailabilityShipmentInformation.md)
- [ServiceAvailabilityShipmentPackage](docs/Model/ServiceAvailabilityShipmentPackage.md)
- [ShipmentCancelRequest](docs/Model/ShipmentCancelRequest.md)
- [ShipmentCreateResponse](docs/Model/ShipmentCreateResponse.md)
- [ShipmentDeferRequest](docs/Model/ShipmentDeferRequest.md)
- [ShipmentHoldRequest](docs/Model/ShipmentHoldRequest.md)
- [ShipmentItem](docs/Model/ShipmentItem.md)
- [ShipmentsCancelResponse](docs/Model/ShipmentsCancelResponse.md)
- [ShipmentsDeferResponse](docs/Model/ShipmentsDeferResponse.md)
- [ShipmentsHoldResponse](docs/Model/ShipmentsHoldResponse.md)
- [ShipmentsReleaseRequest](docs/Model/ShipmentsReleaseRequest.md)
- [ShipmentsReleaseResponse](docs/Model/ShipmentsReleaseResponse.md)
- [Shipper](docs/Model/Shipper.md)
## Documentation For Authorization
## clientID
- **Type**: API key
- **API key parameter name**: X-IBM-Client-Id
- **Location**: HTTP header
## clientSecret
- **Type**: API key
- **API key parameter name**: X-IBM-Client-Secret
- **Location**: HTTP header
## Author