vekkon/postbarcodeclient-php

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

This package is auto-updated.

Last update: 2025-05-31 00:26:12 UTC


README

Digital Commerce Swiss Post web REST API for the generation of the address label. With the "Generate address label" request, the combinations of selected basic and additional services/delivery instructions will be tested automatically, whether or not you have already done this yourself beforehand. With the "Generate address label" operation, the mailing data (e.g. COD amount) is also validated. For the "Parcels", "Express" and "Solutions" service groups, the mailing data is automatically transferred to DataTransfer. This means that you receive the same benefits as you would under DataTransfer. API documentation https://developer.post.ch/en/digital-commerce-api

This PHP package is automatically generated by the Swagger Codegen project:

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/git_user_id/git_repo_id.git"
    }
  ],
  "require": {
    "git_user_id/git_repo_id": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/SwaggerClient-php/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?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;
}
?>

Documentation for API Endpoints

All URIs are relative to https://dcapi.apis.post.ch/barcode/v1

Class Method HTTP request Description
BarcodeApi generateAddressLabel POST /generateAddressLabel Generate Label
ReplacementApi submitReplacementRequest POST /generateReplacementLabel
SingleBarcodeApi generateSingleBarcodes POST /generateSingleBarcodes Generate Single Barcode

Documentation For Models

Documentation For Authorization

ClientCredentials

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes:
  • DCAPI_BARCODE_READ: get barcode label

Author

digitalintegration@post.ch