nogrod/dhl-retoure-php-sdk

# 简介 ## 概述 注意:这是DP-DHL集团包裹德国退货API的规范。此Web服务允许企业客户按需创建退货标签。# 场景 ## 主要场景:创建退货标签 这通过向URI '/rest/orders' 发送退货订单来实现。服务将返回一个退货标签。

v0.2.2 2024-02-27 21:36 UTC

This package is auto-updated.

Last update: 2024-09-28 12:18:47 UTC


README

简介

概述

注意:这是DP-DHL集团包裹德国退货API的规范。此Web服务允许企业客户按需创建退货标签。

场景

主要场景:创建退货标签

这通过向URI '/rest/orders' 发送退货订单来实现。服务将返回一个退货标签。

查询以获取收件人位置

此服务支持的单个场景是确定收件人位置。这是通过向URI '/rest/locations' 获取位置来实现的。服务将返回一个收件人。

安装与使用

要求

PHP 8.1及更高版本。

Composer

要通过Composer安装绑定,请将以下内容添加到composer.json

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/nogrod/dhl-retoure-php-sdk.git"
    }
  ],
  "require": {
    "nogrod/dhl-retoure-php-sdk": "*@dev"
  }
}

然后运行composer install

手动安装

下载文件并包含autoload.php

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

入门

请按照安装程序进行操作,然后运行以下命令

<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure API key authorization: ApiKey
$config = Dhl\Rest\Retoure\Configuration::getDefaultConfiguration()->setApiKey('dhl-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Dhl\Rest\Retoure\Configuration::getDefaultConfiguration()->setApiKeyPrefix('dhl-api-key', 'Bearer');

// Configure HTTP basic authorization: BasicAuth
$config = Dhl\Rest\Retoure\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new Dhl\Rest\Retoure\Api\LocationsApi(
    // 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
);
$country_code = new \Dhl\Rest\Retoure\Model\Country(); // Country | The ISO3 code of the location
$postal_code = 'postal_code_example'; // string | The postal code code of the location
$receiver_id = 'receiver_id_example'; // string | The receiver id of the location
$billing_number = 'billing_number_example'; // string
$max_result = 56; // int | The result should be containable.

try {
    $result = $apiInstance->getLocations($country_code, $postal_code, $receiver_id, $billing_number, $max_result);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LocationsApi->getLocations: ', $e->getMessage(), PHP_EOL;
}

API端点

所有URI均相对于https://api-sandbox.dhl.com/parcel/de/shipping/returns/v1

模型

授权

基本认证

  • 类型:HTTP基本认证

API密钥

  • 类型:API密钥
  • API密钥参数名:dhl-api-key
  • 位置:HTTP头

测试

要运行测试,请使用

composer install
vendor/bin/phpunit

作者

关于此包

此PHP包由OpenAPI Generator项目自动生成

  • API版本:1.0.4
  • 构建包:org.openapitools.codegen.languages.PhpNextgenClientCodegen