apiship/yandex-market-php-client

与 Yandex Market API 集成(SDK)

1.0.7 2024-04-27 12:38 UTC

This package is auto-updated.

Last update: 2024-09-24 12:25:12 UTC


README

Yandex Маркета API 帮助卖家自动化和简化与市场平台的操作。

集成功能包括:

  • 管理商品目录和店面,

  • 处理订单,

  • 更改商店设置,

  • 获取报告。

安装与使用

要求

PHP 7.4 及以上版本。也适用于 PHP 8.0。

Composer

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

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/apiship/yandex-market-php-client.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

然后运行 composer install

手动安装

下载文件并包含 autoload.php

<?php
require_once('/path/to/apiship/yandex-market-php-client/vendor/autoload.php');

入门

请遵循安装步骤,然后运行以下操作

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



// Configure OAuth2 access token for authorization: OAuth
$config = YandexMarketApi\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new YandexMarketApi\Api\BidsApi(
    // 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
);
$business_id = 56; // int | Идентификатор кабинета. Чтобы узнать идентификатор, воспользуйтесь запросом [GET campaigns](../../reference/campaigns/getCampaigns.md#businessdto).  ℹ️ [Что такое кабинет и магазин на Маркете](https://yandex.ru/support/marketplace/account/introduction.html)
$page_token = eyBuZXh0SWQ6IDIzNDIgfQ==; // string | Идентификатор страницы c результатами.  Если параметр не указан, возвращается самая старая страница.  Рекомендуется передавать значение выходного параметра `nextPageToken`, полученное при последнем запросе.  Если задан `page_token`, параметры `offset`, `page_number` и `page_size` игнорируются.
$limit = 20; // int | Количество товаров на одной странице.
$get_bids_info_request = new \YandexMarketApi\Model\GetBidsInfoRequest(); // \YandexMarketApi\Model\GetBidsInfoRequest | description

try {
    $result = $apiInstance->getBidsInfoForBusiness($business_id, $page_token, $limit, $get_bids_info_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BidsApi->getBidsInfoForBusiness: ', $e->getMessage(), PHP_EOL;
}

API 端点

所有 URI 都相对于 https://api.partner.market.yandex.ru

模型

授权

为API定义的认证方案

OAuth

  • 类型: OAuth
  • 流程: implicit
  • 授权URL: https://oauth.yandex.ru/authorize
  • 作用域:
    • market:partner-api: API Яндекс.Маркета / 商品搜索合作伙伴

测试

要运行测试,请使用

composer install
vendor/bin/phpunit

作者

关于此包

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

  • API版本: LATEST
  • 构建包: org.openapitools.codegen.languages.PhpClientCodegen