zvps / royal-mail-shipping-rest-api-client
Royal Mail Shipping REST API 客户端
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~1.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is auto-updated.
Last update: 2024-09-06 21:20:39 UTC
README
本 API 规范详细说明了与 Royal Mail API Shipping V3 集成的要求。
它具体说明了如何让企业客户使用 Royal Mail API Shipping V3 与 Royal Mail 进行运输活动,并提供构建此集成所需的技术信息。希望将系统与 Royal Mail 服务接口的客户必须使用相关的配套规范。
Royal Mail API Shipping V3 提供了一个完整的 RESTful 服务,允许账户客户创建运输、生成标签,并为使用 Royal Mail 国内物品运输所需的所有任务生成文件。
基于行业标准构建的 Royal Mail API Shipping V3 为客户提供了一种简单且成本低的集成方法,并使他们能够快速进行运输。API 提供数据流和离线条码,使客户在生成标签时具有更大的灵活性。使用 Royal Mail API Shipping V3 服务不会向客户收取费用,但是客户自身的开发成本必须由开发解决方案的客户承担。Royal Mail 将不承担任何开发、实施和测试成本的责任。客户应将有关为此目的开发系统等方面的初步咨询发送给其账户管理员。
此 API 可以与基于图形用户界面的 Royal Mail Pro Shipping 运输平台结合使用。有关 Royal Mail Pro Shipping 的更多详细信息(包括更新/取消运输和编制清单的视频和简介),请参阅 http://www.royalmail.com/pro-shipping-help。
此 PHP 软件包由 Swagger Codegen 项目自动生成
- API 版本:3.0.12
- 构建包:io.swagger.codegen.v3.generators.php.PhpClientCodegen
要求
PHP 5.5 及以上版本
安装与使用
Composer
要通过 Composer 安装绑定,请将以下内容添加到 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"
}
}
然后运行 composer install
手动安装
下载文件并包含 autoload.php
require_once 'vendor/autoload.php';
测试
要运行单元测试
composer install
./vendor/bin/phpunit
入门
请遵循 安装程序,然后运行以下命令
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: clientID/Secret $config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->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; } ?>
API 端点文档
所有 URI 都相对于 ///shipping/v3
模型文档
- 地址
- 地址响应
- 创建运输目的地
- 创建运输服务选项
- 创建运输运输
- 创建运输运输信息
- 创建运输运输包装
- 错误详情
- 项目
- 项目响应
- 清单
- 清单承运商代码请求
- 清单请求
- 清单响应
- 清单服务代码请求
- 包装响应
- 包装
- 包装响应
- 打印文档请求
- 打印文档响应
- 打印标签请求
- 打印标签响应
- 服务可用性目的地
- 服务可用性格式
- 服务可用性选项
- 服务可用性响应
- 服务可用性服务选项
- 服务可用性运输
- 服务可用性运输信息
- 服务可用性运输包装
- 运输取消请求
- 运输创建响应
- 发货延迟请求
- 发货挂起请求
- 发货项目
- 发货取消响应
- 发货延迟响应
- 发货挂起响应
- 发货释放请求
- 发货释放响应
- 承运人
授权文件
clientID
- 类型: API密钥
- API密钥参数名: X-IBM-Client-Id
- 位置: HTTP头部
clientSecret
- 类型: API密钥
- API密钥参数名: X-IBM-Client-Secret
- 位置: HTTP头部