zvps / royal-mail-click-and-drop-rest-api-client
v1.4
2021-10-20 21:18 UTC
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~2.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
README
导入您的订单,检索您的订单并生成标签。
此PHP包由Swagger Codegen项目自动生成
- API版本:1.0.0
- 构建包:io.swagger.codegen.languages.PhpClientCodegen
要求
PHP 5.5 及以上版本
安装与使用
Composer
要通过Composer安装绑定,请在composer.json中添加以下内容
{
"repositories": [
{
"type": "git",
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
}
],
"require": {
"GIT_USER_ID/GIT_REPO_ID": "*@dev"
}
}
然后运行composer install
手动安装
下载文件并包含autoload.php
require_once('/path/to/SwaggerClient-php/vendor/autoload.php');
测试
要运行单元测试
composer install
./vendor/bin/phpunit
入门指南
请按照安装过程进行操作,然后运行以下命令
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: Bearer $config = RoyalMail\ClickAndDrop\Rest\Api\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = RoyalMail\ClickAndDrop\Rest\Api\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer'); $apiInstance = new RoyalMail\ClickAndDrop\Rest\Api\LabelsApi( // 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 ); $orderIdentifiers = "orderIdentifiers_example"; // string | Order Identifier or several Order Identifiers separated by semicolon $documentType = "documentType_example"; // string | Document generation mode. When documentType is set to \"postageLabel\" the additional parameters below must be used. These additional parameters will be ignored when documentType is not set to \"postageLabel\" $includeReturnsLabel = true; // bool | Include returns label. Required when documentType is set to 'postageLabel' $includeCN = true; // bool | Include CN22/CN23 with label. Optional parameter. If this parameter is used the setting will override the default account behaviour specified in the \"Label format\" setting \"Generate customs declarations with orders\" try { $result = $apiInstance->getOrdersLabelAsync($orderIdentifiers, $documentType, $includeReturnsLabel, $includeCN); print_r($result); } catch (Exception $e) { echo 'Exception when calling LabelsApi->getOrdersLabelAsync: ', $e->getMessage(), PHP_EOL; } ?>
API端点文档
所有URI均相对于https://api.parcel.royalmail.com/api/v1
模型文档
- AddressRequest
- BillingDetailsRequest
- CreateOrderErrorResponse
- CreateOrderRequest
- CreateOrderResponse
- CreateOrdersRequest
- CreateOrdersResponse
- DimensionsRequest
- ErrorResponse
- FailedOrderResponse
- GetOrderDetailsResource
- GetOrderInfoResource
- GetOrderLineResult
- GetPostalDetailsResult
- GetShippingDetailsResult
- GetTagDetailsResult
- GetVersionResource
- LabelGenerationRequest
- OrderFieldResponse
- PostageDetailsRequest
- ProductItemRequest
- RecipientDetailsRequest
- SenderDetailsRequest
- ShipmentPackageRequest
- TagRequest
授权文档
Bearer
- 类型:API密钥
- API密钥参数名称:Authorization
- 位置:HTTP头部