otto/marketplace-php-sdk

此包已被废弃,不再维护。没有建议的替代包。

Otto Market PHP SDK

0.2.3 2022-02-28 12:09 UTC

This package is auto-updated.

Last update: 2023-02-20 08:31:08 UTC


README

Test and Verify

弃用通知!

自2023年3月31日起,我们将不再支持SDK,将不再进行进一步开发。

注意!

目前仅支持产品和发货。其他接口将陆续推出!

介绍

otto market PHP SDK是开发人员访问otto市场API并在其上构建程序的一种简单方式。所有接口的详细文档可以在我们的文档中找到。

跳转到

要求

  1. 注册otto Market – 您需要一个有效的卖家账户。请在此注册并获取您的凭据。
  2. 最低要求 – 运行SDK,您的系统需要 PHP >= 7.4

安装

要使用SDK,我们建议使用Composer。它可通过Packagistotto/marketplace-php-sdk下获得。您可以在项目的根目录中使用以下代码将SDK包含到项目中。

composer require otto/marketplace-php-sdk

SDK的使用

设置新的交付类型和交付时间

<?php

use Otto\Market\Client\Configuration;
use Otto\Market\Products\Model\Delivery;
use Otto\Market\Client\PartnerApiClient;

// Configure the client
$configuration = Configuration::forLive('my-api-username', 'my-api-password');
$client = new PartnerApiClient($configuration);

// Update the delivery information for all products
$myProducts = $client->getPartnerProductClient()->getProducts();
foreach ($myProducts as $productVariation) {
    $delivery = new Delivery();
    $delivery->setType('PARCEL');
    $delivery->setDeliveryTime(2);
    
    $productVariation->setDelivery($delivery);
}

// Save the updated products
$client->getPartnerProductClient()->postProducts($myProducts);

示例CLI客户端

有关实现示例,请访问samples

特性

我们提供以下方法供您使用

  • 产品
    • 获取品牌
    • 获取类别
    • 从类别获取类别定义
    • 获取产品
    • 从JSON发布产品
    • 获取活动状态
    • 发布活动状态
    • 获取市场状态
  • 发货
    • 获取发货
    • 发布发货

资源