### Go SDK Initialization Example Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/ОБЗОР.md Illustrates the basic setup for the analytics client in Go. You need to import the analytics package and configure the client with your token. ```go package main import ( "github.com/eslazarev/wildberries-sdk/clients/go/analytics" ) func main() { config := analytics.NewConfiguration() config.DefaultHeader["Authorization"] = "Bearer your_token" client := analytics.NewAPIClient(config) } ``` -------------------------------- ### Install Wildberries SDK for Go Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/БЫСТРЫЙ_СТАРТ.md Get the Go SDK package. ```bash go get github.com/eslazarev/wildberries-sdk/clients/go ``` -------------------------------- ### Python SDK Example for Analytics Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/README.md Demonstrates how to use the Python SDK to fetch product sales analytics. Ensure you have your API token and have installed the SDK. ```python from wildberries_sdk.analytics.api.default_api import DefaultApi from wildberries_sdk.analytics.configuration import Configuration from wildberries_sdk.analytics.models import ProductsRequest, ProductsRequestSelectedPeriod # 2. Конфигурация config = Configuration() config.api_key['Authorization'] = 'your_token' # 3. Создание клиента api = DefaultApi(api_client_configuration=config) # 4. Запрос request = ProductsRequest( selected_period=ProductsRequestSelectedPeriod(begin="2024-08-01", end="2024-08-31") ) response = api.post_sales_funnel_products(request) # 5. Использование результатов for product in response.data: print(f"{product.name}: {product.selected_period.revenue} RUB") ``` -------------------------------- ### Node.js (TypeScript) SDK Example Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/ОБЗОР.md Shows how to set up and use the analytics module with the Node.js SDK. Ensure 'wildberries-sdk-analytics' is installed and provide your API token. ```typescript import { DefaultApi, Configuration } from 'wildberries-sdk-analytics'; const config = new Configuration({ apiKey: 'your_token' }); const api = new DefaultApi(config); const response = await api.postSalesFunnelProducts({...}); ``` -------------------------------- ### Node.js/TypeScript SDK Configuration Examples Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/КОНФИГУРАЦИЯ.md Shows three methods for configuring the Node.js/TypeScript SDK: direct setup, using environment variables, and with additional parameters like access tokens or custom fetch functions. The `basePath` is crucial for specifying the API endpoint. ```typescript import { Configuration, DefaultApi } from 'wildberries-sdk-analytics'; // Способ 1: Прямая конфигурация const config = new Configuration({ apiKey: 'your_api_token', basePath: 'https://seller-analytics-api.wildberries.ru', isJsonMime: (mime: string) => { return mime.match(/application\/(json|hal\+json)/); } }); const api = new DefaultApi(config); // Способ 2: Через переменные окружения const config = new Configuration({ apiKey: process.env.WILDBERRIES_API_KEY, }); // Способ 3: С дополнительными параметрами const config = new Configuration({ apiKey: 'your_token', basePath: 'https://seller-analytics-api.wildberries.ru', accessToken: 'token_if_oauth', fetchApi: fetch, username: 'user', password: 'pass', middleware: [] }); ``` -------------------------------- ### Install Wildberries SDK for PHP Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/БЫСТРЫЙ_СТАРТ.md Install the PHP SDK using Composer. ```bash composer require eslazarev/wildberries-sdk ``` -------------------------------- ### Install Wildberries SDK for Node.js Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/README.md Command to install the Wildberries SDK for Node.js projects using npm. ```bash npm install wildberries-sdk-analytics ``` -------------------------------- ### Install Wildberries SDK for Node.js/TypeScript Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/БЫСТРЫЙ_СТАРТ.md Install the Node.js SDK for analytics and products, or individual modules. ```bash npm install wildberries-sdk-analytics wildberries-sdk-products # или для отдельных модулей npm install wildberries-sdk-{module} ``` -------------------------------- ### Install Wildberries SDK for Python Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/README.md Command to install the Wildberries SDK using pip for Python projects. ```bash pip install wildberries-sdk ``` -------------------------------- ### Example cURL Request for Sales Funnel Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/ЭНДПОИНТЫ.md A complete example demonstrating how to make a POST request to the sales funnel endpoint using cURL. This includes setting the request body with a selected period, product IDs, limit, and offset. ```bash curl -X POST https://seller-analytics-api.wildberries.ru/api/analytics/v3/sales-funnel/products \ -H "Content-Type: application/json" \ -H "Authorization: Bearer eJydUsFuwjAM_BXLZ..." \ -d '{ "selectedPeriod": { "begin": "2024-08-01", "end": "2024-08-31" }, "nmIds": [123456], "limit": 100, "offset": 0 }' ``` -------------------------------- ### Python Sandbox Configuration for Products Module Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/КОНФИГУРАЦИЯ.md Example of configuring the SDK for the products module using a sandbox URL and a placeholder token. ```python config = Configuration() config.host = 'https://content-api-sandbox.wildberries.ru' config.api_key['Authorization'] = 'your_sandbox_token' ``` -------------------------------- ### Python SDK Example Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/ОБЗОР.md Demonstrates how to initialize and use the analytics module in Python. Requires the 'wildberries-sdk' package and an API token. ```python from wildberries_sdk.analytics.api.default_api import DefaultApi from wildberries_sdk.analytics.configuration import Configuration config = Configuration() config.api_key['Authorization'] = 'your_token' api = DefaultApi() response = api.post_sales_funnel_products(request_body) ``` -------------------------------- ### Get Products with Prices Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Retrieves a list of products with their prices. ```APIDOC ## GET /api/v2/list/goods/filter ### Description Retrieves a list of products with their prices. ### Method GET ### Endpoint /api/v2/list/goods/filter ``` -------------------------------- ### Python SDK Configuration Examples Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/КОНФИГУРАЦИЯ.md Demonstrates three ways to configure the Python SDK: direct configuration, using global defaults, and via environment variables. Ensure your API key and host are correctly set. ```python from wildberries_sdk.analytics.configuration import Configuration from wildberries_sdk.analytics.api.default_api import DefaultApi # Способ 1: Прямая конфигурация config = Configuration( api_key='your_api_token', host='https://seller-analytics-api.wildberries.ru', client_side_validation=True, verify_ssl=True ) api = DefaultApi(api_client_configuration=config) # Способ 2: Использование глобальной конфигурации Configuration.set_default(config) api = DefaultApi() # Способ 3: Через переменные окружения import os os.environ['WILDBERRIES_API_KEY'] = 'your_token' config = Configuration() config.api_key['Authorization'] = os.environ.get('WILDBERRIES_API_KEY') ``` -------------------------------- ### Go SDK Configuration Examples Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/КОНФИГУРАЦИЯ.md Illustrates two ways to configure the Go SDK: with explicit settings for headers and base path, or using default configurations. The `Authorization` header is commonly used for API keys. ```go import ( "github.com/eslazarev/wildberries-sdk/clients/go/analytics" ) // Способ 1: С явной конфигурацией config := analytics.NewConfiguration() config.AddDefaultHeader("Authorization", "Bearer your_token") config.BasePath = "https://seller-analytics-api.wildberries.ru" config.Scheme = "https" config.Host = "seller-analytics-api.wildberries.ru" client := analytics.NewAPIClient(config) // Способ 2: Со значениями по умолчанию config := analytics.NewConfiguration() client := analytics.NewAPIClient(config) ``` -------------------------------- ### PHP SDK Configuration Examples Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/КОНФИГУРАЦИЯ.md Presents two configuration approaches for the PHP SDK: using default configurations and setting them directly, or initializing with a custom HTTP client. Ensure the API key is prefixed with 'Bearer ' if required. ```php require_once __DIR__ . '/vendor/autoload.php'; use Wildberries\Analytics\Configuration; use Wildberries\Analytics\Api\DefaultApi; // Способ 1: Прямая конфигурация $config = Configuration::getDefaultConfiguration(); $config->setApiKey('Authorization', 'Bearer your_token'); $config->setHost('https://seller-analytics-api.wildberries.ru'); $api = new DefaultApi(null, $config); // Способ 2: С custom HTTP client $config = new Configuration(); $config->setApiKey('Authorization', 'Bearer your_token'); $config->setHost('https://seller-analytics-api.wildberries.ru'); $config->setCurlTimeout(30); $api = new DefaultApi(null, $config); ``` -------------------------------- ### Get All Items Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Retrieves a list of all items. ```APIDOC ## GET /content/v2/object/all ### Description Retrieves a list of all items. ### Method GET ### Endpoint /content/v2/object/all ``` -------------------------------- ### GET /api/v3/dbw/orders/new Source: https://github.com/eslazarev/wildberries-sdk/blob/main/docs/php/README.md Retrieves a list of new assembly tasks. ```APIDOC ## GET /api/v3/dbw/orders/new ### Description Retrieves a list of new assembly tasks. ### Method GET ### Endpoint /api/v3/dbw/orders/new ``` -------------------------------- ### Get Product List Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/БЫСТРЫЙ_СТАРТ.md This snippet demonstrates how to fetch a list of products using the SDK, with options for filtering by limit and offset. ```APIDOC ## Get Product List ### Description Retrieves a paginated list of products associated with the seller account. Supports filtering by the number of items per page and the starting offset. ### Method GET ### Endpoint `/v2/list/goods/filter` ### Parameters #### Request Headers - **Authorization** (string) - Required - Your API token. #### Query Parameters - **limit** (integer) - Optional - The maximum number of items to return per page. Defaults to 50. - **offset** (integer) - Optional - The number of items to skip from the beginning of the list. Defaults to 0. ### Request Example ```python from wildberries_sdk.products.api.default_api import DefaultApi from wildberries_sdk.products.configuration import Configuration config = Configuration() config.api_key['Authorization'] = 'your_token' api = DefaultApi(api_client_configuration=config) response = api.get_v2_list_goods_filter(limit=50, offset=0) print(f"Total products: {response.total}") for item in response.data[:10]: print(f"Name: {item.name}, NM ID: {item.nm_id}") ``` ### Response #### Success Response (200) - **total** (integer) - The total number of products available. - **data** (array) - An array of product objects. - Each product object contains fields like `name` (string), `nm_id` (string), `discounted_price` (number), `discount` (number). #### Response Example ```json { "total": 150, "data": [ { "name": "Example Product 1", "nm_id": "12345678", "discounted_price": 999.99, "discount": 15 }, { "name": "Example Product 2", "nm_id": "87654321", "discounted_price": 1499.50, "discount": 10 } ] } ``` ``` -------------------------------- ### Get Stock Report by Products Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/api-reference/ANALYTICS.md Retrieves stock information for products. ```python async def api_v2_stocks_report_products_products_post( self, request_parameters: ApiV2StocksReportProductsProductsPostRequest ) -> ApiV2StocksReportProductsProductsPost200Response ``` -------------------------------- ### Get Products List (Python) Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/БЫСТРЫЙ_СТАРТ.md Fetch a list of products using the Python SDK, with options for limit and offset. Displays the first 10 items with their details. ```python from wildberries_sdk.products.api.default_api import DefaultApi from wildberries_sdk.products.configuration import Configuration config = Configuration() config.api_key['Authorization'] = 'your_token' api = DefaultApi(api_client_configuration=config) # Получить товары try: response = api.get_v2_list_goods_filter( limit=50, offset=0 ) print(f"Всего товаров: {response.total}\n") for item in response.data[:10]: # Первые 10 print(f"Название: {item.name}") print(f"Артикул WB: {item.nm_id}") print(f"Цена: {item.discounted_price} RUB") print(f"Скидка: {item.discount}%") print("---") except Exception as e: print(f"Ошибка: {e}") ``` -------------------------------- ### API Versioning (Git Tag) Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/МОДУЛИ.md Example of API versioning indicated by a Git tag. ```git v0.1.103 ``` -------------------------------- ### Get Stock Report by Product Sizes Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/api-reference/ANALYTICS.md Retrieves stock information for product sizes. ```python async def api_v2_stocks_report_products_sizes_post( self, request_parameters: ApiV2StocksReportProductsSizesPostRequest ) -> ApiV2StocksReportProductsSizesPost200Response ``` -------------------------------- ### API Versioning (JSON) Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/МОДУЛИ.md Example of API versioning specified in a package.json file for Node.js projects. ```json "version": "0.1.103" ``` -------------------------------- ### Get Product Sizes with Prices Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Retrieves the sizes of a product along with their prices. ```APIDOC ## GET /api/v2/list/goods/size/nm ### Description Retrieves the sizes of a product along with their prices. ### Method GET ### Endpoint /api/v2/list/goods/size/nm ``` -------------------------------- ### Get Product Card List Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Retrieves a list of product cards. ```APIDOC ## POST /content/v2/get/cards/list ### Description Retrieves a list of product cards. ### Method POST ### Endpoint /content/v2/get/cards/list ``` -------------------------------- ### GET Products with Prices Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/ЭНДПОИНТЫ.md Retrieves a list of products with their pricing information. Supports filtering by various criteria and pagination. ```http GET /api/v2/list/goods/filter ``` -------------------------------- ### Get Products with Prices by SKUs Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Retrieves a list of products with their prices based on provided SKUs. ```APIDOC ## POST /api/v2/list/goods/filter ### Description Retrieves a list of products with their prices based on provided SKUs. ### Method POST ### Endpoint /api/v2/list/goods/filter ``` -------------------------------- ### API Versioning (TOML) Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/МОДУЛИ.md Example of API versioning specified in a pyproject.toml file for Python projects. ```toml version = "0.1.103" ``` -------------------------------- ### Get Products List (TypeScript) Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/БЫСТРЫЙ_СТАРТ.md Fetch a list of products using the TypeScript SDK, with options for limit and offset. Displays the first 10 items with their details. ```typescript import { DefaultApi, Configuration } from 'wildberries-sdk-products'; const config = new Configuration({ apiKey: 'your_token' }); const api = new DefaultApi(config); try { const response = await api.getV2ListGoodsFilter({ limit: 50, offset: 0 }); console.log(`Total products: ${response.total}\n`); response.data.slice(0, 10).forEach(item => { console.log(`Name: ${item.name}`); console.log(`NM ID: ${item.nmId}`); console.log(`Price: ${item.discountedPrice} RUB`); console.log(`Discount: ${item.discount}%`); console.log('---'); }); } catch (error) { console.error(`Error: ${error}`); } ``` -------------------------------- ### Get Stock Report by Product Groups Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/api-reference/ANALYTICS.md Retrieves stock information for product groups. ```python async def api_v2_stocks_report_products_groups_post( self, request_parameters: ApiV2StocksReportProductsGroupsPostRequest ) -> ApiV2StocksReportProductsGroupsPost200Response ``` -------------------------------- ### Handling 402 Payment Required Error in Python Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/ОШИБКИ.md A Python example demonstrating how to check for a 402 status code and prompt the user to activate a required subscription. ```python try: api.post_sales_funnel_products(request) except Exception as e: if e.status_code == 402: print("Feature requires subscription. Activate Джем subscription.") ``` -------------------------------- ### products::default_api::post_v1_upload_task_b2b_wholesale Source: https://github.com/eslazarev/wildberries-sdk/blob/main/docs/rust/README.md Sets wholesale discounts for businesses. This method is available with Personal or Service tokens. Information about the pricing and discount setup process can be obtained using the task status and processed upload details methods. ```APIDOC ## POST /api/discounts-prices/v1/upload/task/b2b/wholesale ### Description Sets wholesale discounts for businesses. This method is available with Personal or Service tokens. Information about the pricing and discount setup process can be obtained using the task status and processed upload details methods. ### Method POST ### Endpoint /api/discounts-prices/v1/upload/task/b2b/wholesale ### Parameters ### Request Body ### Request Example ### Response #### Success Response (200) #### Response Example ### Rate Limiting Requests per seller account for all methods in the **Prices and Discounts** category are limited: | Type | Period | Limit | Interval | Burst | | --- | --- | --- | --- | --- | | Personal | 6 sec | 10 requests | 600 ms | 5 requests | | Service | 6 sec | 10 requests | 600 ms | 5 requests | ``` -------------------------------- ### GET Product Upload Information Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/ЭНДПОИНТЫ.md Retrieves information about the status and progress of product upload tasks. Supports pagination. ```http GET /api/v2/buffer/tasks ``` -------------------------------- ### Python SDK Error Handling Example Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/README.md Shows how to handle common API exceptions like unauthorized access, forbidden requests, and rate limiting when using the SDK. Wrap your API calls in a try-except block. ```python try: response = api.post_sales_funnel_products(request) except UnauthorizedException: print("Ошибка аутентификации") except ForbiddenException: print("Доступ запрещён") except ApiException as e: if e.status_code == 429: print("Превышен лимит запросов") ``` -------------------------------- ### Python Custom Middleware Implementation Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/КОНФИГУРАЦИЯ.md Example of creating and applying a custom middleware in Python to modify request headers before sending. ```python from wildberries_sdk.analytics.api_client import ApiClient from wildberries_sdk.analytics.configuration import Configuration class CustomMiddleware: def __call__(self, request): # Модификация запроса request.headers['X-Custom-Header'] = 'value' return request config = Configuration() api_client = ApiClient(configuration=config) api_client.default_headers['X-Custom-Header'] = 'value' ``` -------------------------------- ### Go Configuration with Environment Variables Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/КОНФИГУРАЦИЯ.md Demonstrates how to set up the Wildberries SDK in Go using the WILDBERRIES_API_KEY environment variable and setting the Authorization header. ```go import "os" apiKey := os.Getenv("WILDBERRIES_API_KEY") if apiKey == "" { log.Fatal("WILDBERRIES_API_KEY not set") } config := analytics.NewConfiguration() config.AddDefaultHeader("Authorization", fmt.Sprintf("Bearer %s", apiKey)) ``` -------------------------------- ### GET /api/v1/analytics/brand-share Source: https://github.com/eslazarev/wildberries-sdk/blob/main/docs/rust/README.md Retrieves the seller's brand share in sales report. Data is available for a maximum of 365 days, starting from November 1, 2022. Subject to request limits. ```APIDOC ## GET /api/v1/analytics/brand-share ### Description Returns the seller's brand share in sales report. Data is available for a maximum of 365 days, starting from November 1, 2022. ### Method GET ### Endpoint /api/v1/analytics/brand-share ### Parameters #### Query Parameters - **start_date** (string) - Required - The start date for the report (YYYY-MM-DD). - **end_date** (string) - Required - The end date for the report (YYYY-MM-DD). - **brand_name** (string) - Required - The name of the brand for the report. ### Request Example ### Response #### Success Response (200) - **brand_share_report** (object) - The brand share report. - **date** (string) - The date of the report entry. - **brand_name** (string) - The name of the brand. - **sales_volume** (number) - The sales volume for the brand on that date. - **market_share** (number) - The market share of the brand on that date. #### Response Example { "brand_share_report": [ { "date": "2023-10-26", "brand_name": "ExampleBrand", "sales_volume": 1500.50, "market_share": 0.15 } ] } ``` -------------------------------- ### Tariffs Module Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/МОДУЛИ.md Provides information on tariffs and commissions. Includes methods to get tariff lists, category commissions, and storage costs. ```APIDOC ## Tariffs Module ### Description Provides information on tariffs and commissions. ### Methods - `getTariffs()` - `getCommissions()` - `getStorageCosts()` ### Host `https://common-api.wildberries.ru` ``` -------------------------------- ### GET /api/v1/analytics/brand-share/parent-subjects Source: https://github.com/eslazarev/wildberries-sdk/blob/main/docs/rust/README.md Retrieves the seller's parent categories for the brand share in sales report. Data is available for a maximum of 365 days, starting from November 1, 2022. Subject to request limits. ```APIDOC ## GET /api/v1/analytics/brand-share/parent-subjects ### Description Returns the seller's parent categories for the brand share in sales report. Data is available for a maximum of 365 days, starting from November 1, 2022. ### Method GET ### Endpoint /api/v1/analytics/brand-share/parent-subjects ### Parameters ### Request Example ### Response #### Success Response (200) - **parent_subjects** (array) - List of parent categories. - **subject_id** (string) - The ID of the parent category. - **subject_name** (string) - The name of the parent category. #### Response Example { "parent_subjects": [ { "subject_id": "100", "subject_name": "Electronics" } ] } ``` -------------------------------- ### GET /api/v1/analytics/goods-labeling Source: https://github.com/eslazarev/wildberries-sdk/blob/main/docs/rust/README.md Retrieves a report on fines for the absence of mandatory goods labeling. The report includes photos of goods where labeling is missing or unreadable. Data is available for a maximum of 31 days, starting from March 2024. Subject to request limits. ```APIDOC ## GET /api/v1/analytics/goods-labeling ### Description Returns a report on fines for the absence of mandatory goods labeling. The report includes photos of goods where labeling is missing or unreadable. ### Method GET ### Endpoint /api/v1/analytics/goods-labeling ### Parameters #### Query Parameters - **start_date** (string) - Required - The start date for the report (YYYY-MM-DD). - **end_date** (string) - Required - The end date for the report (YYYY-MM-DD). ### Request Example ### Response #### Success Response (200) - **labeling_fines** (array) - List of goods labeling fines. - **product_id** (string) - The ID of the product. - **photo_url** (string) - URL to the photo of the product with missing labeling. - **fine_amount** (number) - The amount of the fine. #### Response Example { "labeling_fines": [ { "product_id": "11223", "photo_url": "http://example.com/photo.jpg", "fine_amount": 500.00 } ] } ``` -------------------------------- ### Use Context Managers for API Call Cleanup Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/ОШИБКИ.md This Python example shows how to use a context manager (`@contextmanager`) to ensure proper cleanup of resources after an API call. This is useful for managing connections or other resources that need to be released. ```python from contextlib import contextmanager @contextmanager def api_call(config): api = DefaultApi(api_client_configuration=config) try: yield api finally: # Cleanup код pass with api_call(config) as api: response = api.post_sales_funnel_products(request) ``` -------------------------------- ### Products Module Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/МОДУЛИ.md Handles product management, including uploading and editing products. Offers methods to retrieve product lists, manage upload tasks, and get brand information. ```APIDOC ## Products Module ### Description Manages products, including uploading and editing. ### Methods - `getV2ListGoodsFilter()` - `postV2ListGoodsFilter()` - `getV2BufferTasks()` - `getV2HistoryTasks()` - `getApiContentV1Brands()` - `postV1UploadTaskB2bWholesale()` ### Host `https://content-api.wildberries.ru` ``` -------------------------------- ### Ping and Seller Info Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/БЫСТРЫЙ_СТАРТ.md Demonstrates how to initialize the SDK, authenticate with an API token, and make the first API calls to check the connection (ping) and retrieve seller information. ```APIDOC ## Ping and Seller Info ### Description This section shows how to set up the SDK client and make basic API calls to verify connectivity and get seller details. ### Method GET ### Endpoint `/ping` and `/api/v1/seller/info` ### Parameters #### Request Headers - **Authorization** (string) - Required - Your API token. ### Request Example ```python from wildberries_sdk.general.api.default_api import DefaultApi from wildberries_sdk.general.configuration import Configuration config = Configuration() config.api_key['Authorization'] = 'your_api_token' api = DefaultApi(api_client_configuration=config) # Ping request response = api.get_ping() print(response.status, response.ts) # Seller info request seller_info = api.get_api_v1_seller_info() print(seller_info.public_name, seller_info.supplier_id) ``` ### Response #### Success Response (200) - **ping**: `status` (string), `ts` (string) - **seller_info**: `public_name` (string), `supplier_id` (string), `warehouse_id` (string) #### Response Example ```json { "status": "ok", "ts": "2023-10-27T10:00:00Z" } ``` ```json { "public_name": "Example Seller", "supplier_id": "12345", "warehouse_id": "67890" } ``` ``` -------------------------------- ### Example 402 Payment Required Response Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/ОШИБКИ.md An example JSON response for a 402 Payment Required error, indicating that a required subscription is missing or insufficient. ```json { "error_text": "Требуется подписка Джем для доступа к этому методу", "error_code": "INSUFFICIENT_SUBSCRIPTION", "required_subscription": "jem", "http_code": 402 } ``` -------------------------------- ### Example 429 Too Many Requests Response Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/ОШИБКИ.md This is an example of a JSON response when the rate limit is exceeded. It includes an error message, a specific error code, and the HTTP status code. ```json { "error_text": "Превышен лимит запросов. Попробуйте ещё раз позже", "error_code": "RATE_LIMIT_EXCEEDED", "http_code": 429 } ``` -------------------------------- ### Create and Use ProductsRequest in Go Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/ТИПЫ_ДАННЫХ.md Illustrates how to construct and use a ProductsRequest object in Go for API interactions. ```go import "github.com/eslazarev/wildberries-sdk/clients/go/analytics" request := analytics.ProductsRequest{ SelectedPeriod: analytics.ProductsRequestSelectedPeriod{ Begin: "2024-08-01", End: "2024-08-31", }, NmIds: []int32{123456, 789012}, Limit: 100, Offset: 0, } response, _, err := client.DefaultApi.PostSalesFunnelProducts(context.Background()). ProductsRequest(request). Execute() ``` -------------------------------- ### Create and Use ProductsRequest in Python Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/ТИПЫ_ДАННЫХ.md Demonstrates how to create, serialize, and deserialize a ProductsRequest object in Python. ```python from wildberries_sdk.analytics.models import ( ProductsRequest, ProductsRequestSelectedPeriod ) # Создание объекта запроса request = ProductsRequest( selected_period=ProductsRequestSelectedPeriod( begin="2024-08-01", end="2024-08-31" ), nm_ids=[123456, 789012], limit=100, offset=0 ) # Сериализация в JSON json_str = request.to_json() # Десериализация из JSON request = ProductsRequest.from_json(json_str) ``` -------------------------------- ### Get Tags List Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Retrieves a list of all available tags. ```APIDOC ## GET /content/v2/tags ### Description Retrieves a list of all available tags. ### Method GET ### Endpoint /content/v2/tags ``` -------------------------------- ### Get Item Characteristics Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Retrieves the characteristics of a specific item. ```APIDOC ## GET /content/v2/object/charcs/{subjectId} ### Description Retrieves the characteristics of a specific item. ### Method GET ### Endpoint /content/v2/object/charcs/{subjectId} ### Parameters #### Path Parameters - **subjectId** (string) - Required - The ID of the subject ``` -------------------------------- ### Python Configuration with Environment Variables Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/КОНФИГУРАЦИЯ.md Shows how to configure the Wildberries SDK in Python using the WILDBERRIES_API_KEY environment variable. ```python import os from wildberries_sdk.analytics.configuration import Configuration api_key = os.getenv('WILDBERRIES_API_KEY') if not api_key: raise ValueError("WILDBERRIES_API_KEY not set") config = Configuration() config.api_key['Authorization'] = f'Bearer {api_key}' ``` -------------------------------- ### GET /api/v3/dbw/orders Source: https://github.com/eslazarev/wildberries-sdk/blob/main/docs/php/README.md Retrieves information about completed assembly tasks. ```APIDOC ## GET /api/v3/dbw/orders ### Description Retrieves information about completed assembly tasks. ### Method GET ### Endpoint /api/v3/dbw/orders ### Parameters #### Query Parameters - **orderId** (string) - Optional - Filter by order ID. ``` -------------------------------- ### First Request: Ping and Seller Info (Python) Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/БЫСТРЫЙ_СТАРТ.md Make a ping request to check connectivity and retrieve seller information using the Python SDK. Ensure you have configured your API token. ```python from wildberries_sdk.general.api.default_api import DefaultApi from wildberries_sdk.general.configuration import Configuration # 1. Конфигурация config = Configuration() config.api_key['Authorization'] = 'your_api_token' # 2. Создание API клиента api = DefaultApi(api_client_configuration=config) # 3. Первый запрос — проверка подключения try: response = api.get_ping() print(f"✓ Подключение успешно: {response.status}") print(f" Время сервера: {response.ts}") except Exception as e: print(f"✗ Ошибка подключения: {e}") # 4. Получить информацию о продавце seller_info = api.get_api_v1_seller_info() print(f"\n✓ Информация о продавце:") print(f" Название: {seller_info.public_name}") print(f" ID поставщика: {seller_info.supplier_id}") print(f" ID склада: {seller_info.warehouse_id}") ``` -------------------------------- ### Set Prices and Discounts Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Uploads a task to set prices and discounts for products. ```APIDOC ## POST /api/v2/upload/task ### Description Uploads a task to set prices and discounts for products. ### Method POST ### Endpoint /api/v2/upload/task ``` -------------------------------- ### Get Seller Warehouses List Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Retrieves a list of seller warehouses. ```APIDOC ## GET /api/v3/warehouses ### Description Retrieves a list of seller warehouses. ### Method GET ### Endpoint /api/v3/warehouses ``` -------------------------------- ### Rust Configuration Options Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/КОНФИГУРАЦИЯ.md Demonstrates two ways to configure the Wildberries SDK in Rust: with explicit settings and with default values. ```rust use wildberries_sdk_analytics::apis::configuration::Configuration; use wildberries_sdk_analytics::apis::default_api::DefaultApi; // Способ 1: С явной конфигурацией let mut config = Configuration::new(); config.base_path = "https://seller-analytics-api.wildberries.ru".to_string(); config.api_key = Some("your_token".to_string()); config.bearer_access_token = Some("your_token".to_string()); // Способ 2: Со значениями по умолчанию let config = Configuration::default(); ``` -------------------------------- ### Get WB Warehouses List Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Retrieves a list of WB warehouses. ```APIDOC ## GET /api/v3/offices ### Description Retrieves a list of WB warehouses. ### Method GET ### Endpoint /api/v3/offices ``` -------------------------------- ### Get Quarantined Products Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Retrieves a list of products currently in quarantine. ```APIDOC ## GET /api/v2/quarantine/goods ### Description Retrieves a list of products currently in quarantine. ### Method GET ### Endpoint /api/v2/quarantine/goods ``` -------------------------------- ### General TypeScript SDK Import Structure Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/МОДУЛИ.md This demonstrates how to import and initialize the API client in TypeScript. ```typescript // Основной API класс import { DefaultApi } from 'wildberries-sdk-{module}'; // Конфигурация и модели import { Configuration, RequestType, ResponseType } from 'wildberries-sdk-{module}'; // Использование const config = new Configuration({ apiKey: token }); const api = new DefaultApi(config); ``` -------------------------------- ### Node.js Configuration with Environment Variables Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/КОНФИГУРАЦИЯ.md Illustrates configuring the Wildberries SDK in Node.js using the WILDBERRIES_API_KEY environment variable. ```typescript const apiKey = process.env.WILDBERRIES_API_KEY; if (!apiKey) { throw new Error('WILDBERRIES_API_KEY not set'); } const config = new Configuration({ apiKey: apiKey }); ``` -------------------------------- ### Get Parent Product Categories Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Retrieves a list of parent product categories. ```APIDOC ## GET /content/v2/object/parent/all ### Description Retrieves a list of parent product categories. ### Method GET ### Endpoint /content/v2/object/parent/all ``` -------------------------------- ### Get Stock Levels Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Retrieves the stock levels for products in a specific warehouse. ```APIDOC ## POST /api/v3/stocks/{warehouseId} ### Description Retrieves the stock levels for products in a specific warehouse. ### Method POST ### Endpoint /api/v3/stocks/{warehouseId} ### Parameters #### Path Parameters - **warehouseId** (string) - Required - The ID of the warehouse ``` -------------------------------- ### First Request: Ping (Go) Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/БЫСТРЫЙ_СТАРТ.md Make a ping request to check connectivity using the Go SDK. Ensure you have configured your API token. ```go package main import ( "context" "fmt" "github.com/eslazarev/wildberries-sdk/clients/go/general" ) func main() { // 1. Конфигурация config := general.NewConfiguration() config.AddDefaultHeader("Authorization", "Bearer your_api_token") // 2. Создание API клиента client := general.NewAPIClient(config) api := client.DefaultApi // 3. Первый запрос ctx := context.Background() response, _, err := api.GetPing(ctx).Execute() if err != nil { fmt.Printf("✗ Connection error: %v\n", err) return } fmt.Printf("✓ Connection successful: %v\n", response.Status) fmt.Printf(" Server time: %v\n", response.Ts) } ``` -------------------------------- ### GET /api/v3/dbw/orders/{orderId}/meta Source: https://github.com/eslazarev/wildberries-sdk/blob/main/docs/php/README.md Retrieves labeling identifiers for an assembly task. ```APIDOC ## GET /api/v3/dbw/orders/{orderId}/meta ### Description Retrieves labeling identifiers for an assembly task. ### Method GET ### Endpoint /api/v3/dbw/orders/{orderId}/meta ### Parameters #### Path Parameters - **orderId** (string) - Required - The ID of the order. ``` -------------------------------- ### General Module Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/README.md Provides methods for general SDK operations, including checking connection, retrieving news, seller information, user management, and subscriptions/ratings. ```APIDOC ## GENERAL MODULE ### Description Provides methods for general SDK operations, including checking connection, retrieving news, seller information, user management, and subscriptions/ratings. ### Methods - `getPing()`: Checks the connection to the Wildberries API. - `getApiCommunicationsV2News()`: Retrieves news updates. - `getApiV1SellerInfo()`: Fetches information about the seller. - `getApiV1Users()`: Manages users. - `postApiV1Invite()`: Invites a new user. - `putApiV1UsersAccess()`: Modifies user access. - `getApiCommonV1Subscriptions()`: Retrieves subscription information. - `getApiCommonV1Rating()`: Fetches rating information. ``` -------------------------------- ### Get Stock Report by Offices Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/api-reference/ANALYTICS.md Retrieves stock information for delivery warehouses. ```python async def api_v2_stocks_report_offices_post( self, request_parameters: ApiV2StocksReportOfficesPostRequest ) -> ApiV2StocksReportOfficesPost200Response ``` -------------------------------- ### Import Promotion Module (Python) Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/МОДУЛИ.md Use this import statement to access the Promotion module in Python. ```python from wildberries_sdk.promotion.api.default_api import DefaultApi ``` -------------------------------- ### Project File Structure Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/README.md This snippet shows the directory structure of the Wildberries SDK project. It outlines the location of various documentation files and API reference modules. ```bash output/ ├── README.md # Этот файл ├── ОБЗОР.md # Введение в SDK ├── БЫСТРЫЙ_СТАРТ.md # Начало работы ├── КОНФИГУРАЦИЯ.md # Настройка ├── МОДУЛИ.md # Справочник модулей ├── ТИПЫ_ДАННЫХ.md # Все типы ├── ЭНДПОИНТЫ.md # HTTP методы ├── ОШИБКИ.md # Обработка ошибок └── api-reference/ # Детальные справочники ├── GENERAL.md # Модуль General ├── PRODUCTS.md # Модуль Products ├── ANALYTICS.md # Модуль Analytics └── ORDERS.md # Модули Orders ``` -------------------------------- ### Get Product Cards in Trash Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Retrieves a list of product cards currently in the trash. ```APIDOC ## POST /content/v2/get/cards/trash ### Description Retrieves a list of product cards currently in the trash. ### Method POST ### Endpoint /content/v2/get/cards/trash ``` -------------------------------- ### Set Prices for Sizes Source: https://github.com/eslazarev/wildberries-sdk/blob/main/README.md Uploads a task to set prices for product sizes. ```APIDOC ## POST /api/v2/upload/task/size ### Description Uploads a task to set prices for product sizes. ### Method POST ### Endpoint /api/v2/upload/task/size ``` -------------------------------- ### Get Seller Information Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/ЭНДПОИНТЫ.md Retrieves information about the seller account. Requires HeaderApiKey authorization. ```http GET /api/v1/seller-info ``` -------------------------------- ### Python Configuration Validation Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/КОНФИГУРАЦИЯ.md Shows how to validate SDK configuration in Python, including checking for an API key and disabling SSL warnings if verify_ssl is false. ```python from wildberries_sdk.analytics.configuration import Configuration from wildberries_sdk.analytics.exceptions import ApiException try: config = Configuration() if not config.api_key: raise ValueError("API key is required") # Проверка SSL if not config.verify_ssl: import urllib3 urllib3.disable_warnings() except Exception as e: print(f"Configuration error: {e}") ``` -------------------------------- ### Products Module Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/МОДУЛИ.md Provides methods for managing products. The `postV2ListGoodsFilter()` method is available for filtering goods. ```APIDOC ## POST /v2/list/goods/filter ### Description Retrieves a list of goods based on specified filters. ### Method POST ### Endpoint /v2/list/goods/filter ### Parameters #### Query Parameters - **limit** (int) - Optional - Maximum number of items to return (default 100, max 1000). - **offset** (int) - Optional - Offset for pagination. - **date_start** (int) - Optional - Filter by start date (Unix timestamp or ISO 8601). - **date_end** (int) - Optional - Filter by end date (Unix timestamp or ISO 8601). - **ids** (List[int]) - Optional - Filter by a list of IDs. - **search** (str) - Optional - Search string for filtering. - **sort** (str) - Optional - Field to sort by. - **ascending** (bool) - Optional - Sort order (True for ascending, False for descending). ### Request Example ```json { "limit": 100, "offset": 0, "date_start": 1678886400, "date_end": 1678972800, "ids": [123, 456], "search": "example product", "sort": "name", "ascending": true } ``` ### Response #### Success Response (200) - **items** (List[object]) - A list of product objects. - **total** (int) - The total number of products available. #### Response Example ```json { "items": [ { "id": 123, "name": "Example Product", "price": 1000 } ], "total": 1 } ``` ``` -------------------------------- ### Create a Wrapper for Configuration Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/БЫСТРЫЙ_СТАРТ.md Encapsulates the Wildberries SDK configuration, including API key retrieval from environment variables. This class ensures the configuration is initialized only when needed. ```python class WBConfig: def __init__(self, module_name: str): self.module_name = module_name self._config = None @property def config(self): if self._config is None: self._config = Configuration() self._config.api_key['Authorization'] = os.getenv('WILDBERRIES_API_KEY') return self._config config = WBConfig('analytics').config ``` -------------------------------- ### GET /api/v2/list/goods/filter Source: https://github.com/eslazarev/wildberries-sdk/blob/main/_autodocs/ЭНДПОИНТЫ.md Retrieves a list of products with their pricing information, supporting filtering, sorting, and pagination. ```APIDOC ## GET /api/v2/list/goods/filter ### Description Retrieves a list of products with their pricing information, supporting filtering, sorting, and pagination. ### Method GET ### Endpoint /api/v2/list/goods/filter ### Parameters #### Query Parameters - **filterNmID** (string) - Optional - Артикулы WB (через запятую или JSON) - **filterBrandID** (string) - Optional - ID брендов - **filterSubjectID** (string) - Optional - ID предметов - **sort** (string) - Optional - Поле для сортировки - **ascending** (boolean) - Optional - Порядок сортировки - **limit** (integer) - Optional - Максимум записей - **offset** (integer) - Optional - Смещение ### Response #### Success Response (200) - **data** (array) - Array of product objects - **ID** (integer) - Product ID - **nmID** (integer) - Wildberries Article ID - **imtID** (integer) - IMT ID - **vendorCode** (string) - Vendor code - **name** (string) - Product name - **editableName** (string) - Editable product name - **brand** (string) - Brand name - **subjectID** (integer) - Subject ID - **subjectName** (string) - Subject name - **offerID** (string) - Offer ID - **tagsIDs** (array) - Array of tag IDs - **price** (integer) - Original price - **discount** (integer) - Discount percentage - **discountedPrice** (integer) - Price after discount - **commissionPercent** (integer) - Commission percentage - **currencyIsoCode4217** (string) - ISO 4217 currency code - **total** (integer) - Total number of products matching the filter ### Response Example ```json { "data": [ { "ID": 123456, "nmID": 123456, "imtID": 1, "vendorCode": "ABC-123", "name": "Товар", "editableName": "Редактируемое имя", "brand": "Nike", "subjectID": 1, "subjectName": "Категория", "offerID": "offer_123", "tagsIDs": [1, 2], "price": 1500, "discount": 10, "discountedPrice": 1350, "commissionPercent": 8, "currencyIsoCode4217": "RUB" } ], "total": 100 } ``` ```