thecodebunny/otto-api

TheCodeBunny Otto API

dev-master 2023-09-04 08:52 UTC

This package is auto-updated.

Last update: 2024-09-04 11:18:35 UTC


README

Test and Verify

弃用通知!

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

注意!

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

简介

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

跳转到

要求

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

安装

要使用SDK,我们建议使用Composer。它可在Packagist下找到,地址为thecodebunny/otto-api。您可以在项目的根目录中使用以下命令将SDK包含到您的项目中。

composer require thecodebunny/otto-api

SDK的使用

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

<?php

use Thecodebunny\OttoApi\Configuration;
use Thecodebunny\OttoApi\Products\Model\Delivery;
use Thecodebunny\OttoApi\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客户端示例

有关实现示例,请参阅示例

功能

我们提供以下使用方法

  • 产品
    • 获取品牌
    • 获取分类
    • 从分类获取分类定义
    • 获取产品
    • 从JSON发布产品
    • 获取活动状态
    • 发布活动状态
    • 获取市场状态
  • 运输
    • 获取运输
    • 发布运输

资源