vekkon/postbarcodeclient-php

v1.0.2 2024-02-03 00:26 UTC

This package is auto-updated.

Last update: 2024-10-03 02:01:13 UTC


README

数字商业瑞士邮政网 REST API,用于生成地址标签。使用“生成地址标签”请求,将自动测试所选的基本和附加服务/配送说明的组合,无论您是否事先已经这样做。在“生成地址标签”操作中,还会验证邮寄数据(例如,到付金额)。对于“包裹”、“快递”和“解决方案”服务组,邮寄数据将自动传输到DataTransfer。这意味着您将获得与DataTransfer相同的好处。API文档 https://developer.post.ch/en/digital-commerce-api

此PHP包由Swagger Codegen项目自动生成

要求

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 OAuth2 access token for authorization: ClientCredentials
$config = Vekkon\PostBarcodeClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Vekkon\PostBarcodeClient\Api\BarcodeApi(
    // 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 \Vekkon\PostBarcodeClient\Model\GenerateLabel(); // \Vekkon\PostBarcodeClient\Model\GenerateLabel | 

try {
    $result = $apiInstance->generateAddressLabel($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BarcodeApi->generateAddressLabel: ', $e->getMessage(), PHP_EOL;
}
?>

API端点文档

所有URI都是相对于 https://dcapi.apis.post.ch/barcode/v1

模型文档

授权文档

ClientCredentials

  • 类型:OAuth
  • 流程:application
  • 授权URL:
  • 作用域:
  • DCAPI_BARCODE_READ:获取条码标签

作者

digitalintegration@post.ch