vekkon / postbarcodeclient-php
Requires
- php: ^7.4 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- phpunit/phpunit: ^8.0 || ^9.0
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:
- API version: 1.2
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen For more information, please visit https://www.post.ch/digital-commerce/api
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
- AdditionalData
- BaseRecipient
- Communication
- CustomerAddress
- CustomerLogo
- DispatchInfo
- DynPicType
- ExchangeLabelDefinition
- ExchangeNotification
- GenerateLabel
- GenerateLabelCustomer
- GenerateLabelDefinition
- GenerateLabelResponse
- GenerateSingleBarcodes
- GenerateSingleBarcodesResponse
- IdentCode
- Item
- LabelAddress
- Language
- MessageType
- MessagesType
- Notification
- NotificationType
- Recipient
- ReplacementCustomerDetails
- ReplacementLabelDefinition
- ReplacementLabelResponse
- ReplacementRequest
- ReplacementResponse
- ResponseGenerateLabelDefinition
- ResponseItem
- ReturnInfoType
- ServiceCodeAttributes
- SingleBarcodesDefinition
- SingleBarcodesResponseDefinition
- SingleBarcodesResponseItem
- UNNumbers
- ValidationError
Documentation For Authorization
ClientCredentials
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes:
- DCAPI_BARCODE_READ: get barcode label