### Starting Advertising Campaign (advV0StartGet) in PHP
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/DefaultApi.md
This snippet demonstrates how to start a paused advertising campaign (status 11) by calling the `/api/v0/start` endpoint with a GET request. The campaign must have active bids to be started. It requires providing the integer ID of the campaign. The client setup and API call are enclosed in a try-catch block.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\DefaultApi(
// 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
);
$id = 56; // int | Идентификатор РК
try {
$apiInstance->advV0StartGet($id);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->advV0StartGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Getting Brands from Wildberries API (PHP)
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/_Api.md
This example shows how to set up the Wildberries API PHP client with API key authentication and retrieve a list of brands using the `contentV1DirectoryBrandsGet` method. It demonstrates passing optional parameters like `top` (limit) and `pattern` (search query) and includes error handling.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\_Api(
// 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
);
$top = 56; // int | Количество запрашиваемых значений (максимум 5000)
$pattern = "pattern_example"; // string | Поиск по наименованию значения характеристики
try {
$result = $apiInstance->contentV1DirectoryBrandsGet($top, $pattern);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling _Api->contentV1DirectoryBrandsGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Running Unit Tests (Shell)
Source: https://github.com/nik54rus/wildberries/blob/master/README.md
Shell commands to install dependencies via Composer and then execute the PHPUnit test suite for the library.
```Shell
composer install
./vendor/bin/phpunit
```
--------------------------------
### Manual Installation Autoloader Inclusion (PHP)
Source: https://github.com/nik54rus/wildberries/blob/master/README.md
PHP code snippet demonstrating how to include the library's autoloader after manually downloading the files and running composer install in the library directory.
```PHP
require_once('/path/to/WildberriesClient-php/vendor/autoload.php');
```
--------------------------------
### Get All Parent Categories (PHP)
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/_Api.md
This example shows how to initialize the Wildberries API client and call the `contentV1ObjectParentAllGet` method to fetch a list of all parent product categories. It includes API key configuration and error handling.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\_Api(
// 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
);
try {
$result = $apiInstance->contentV1ObjectParentAllGet();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling _Api->contentV1ObjectParentAllGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Getting Supplies with Pagination - Wildberries API - PHP
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/Marketplace_Api.md
This snippet demonstrates how to retrieve a list of supplies from the Wildberries API using the `apiV3SuppliesGet` method. It includes pagination parameters `limit` and `next` to control the number of results and the starting point. Requires API key authorization.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\Marketplace_Api(
// 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
);
$limit = 56; // int | Параметр пагинации. Устанавливает предельное количество возвращаемых данных.
$next = 789; // int | Параметр пагинации. Устанавливает значение, с которого надо получить следующий пакет данных. Для получения полного списка данных должен быть равен 0 в первом запросе.
try {
$result = $apiInstance->apiV3SuppliesGet($limit, $next);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling Marketplace_Api->apiV3SuppliesGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Composer Installation Configuration (composer.json)
Source: https://github.com/nik54rus/wildberries/blob/master/README.md
Configuration to add to your project's composer.json file to include the WildberriesClient-php library from a specified Git repository.
```JSON
{
"repositories": [
{
"type": "git",
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
}
],
"require": {
"GIT_USER_ID/GIT_REPO_ID": "*@dev"
}
}
```
--------------------------------
### Setting Discounts - Wildberries API - PHP
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/_Api.md
Example PHP code to set discounts for a list of nomenclatures using the Wildberries API endpoint `publicApiV1UpdateDiscountsPost`. Requires API key authorization. Takes an array of nomenclature objects as the request body and an optional activation date string.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\_Api(
// 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
);
$body = array(new \stdClass); // object[] | Перечень номенклатур
$activate_from = "activate_from_example"; // string | Дата активации скидки в формате `YYYY-MM-DD` или `YYYY-MM-DD HH:MM:SS`. Если не указывать, скидка начнет действовать сразу.
try {
$result = $apiInstance->publicApiV1UpdateDiscountsPost($body, $activate_from);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling _Api->publicApiV1UpdateDiscountsPost: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Getting Collections from Wildberries API (PHP)
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/_Api.md
This snippet illustrates how to initialize the Wildberries API PHP client with API key authentication and fetch a list of collections using the `contentV1DirectoryCollectionsGet` method. It shows how to provide optional parameters like `top` (limit) and `pattern` (search query) and includes error handling.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\_Api(
// 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
);
$top = 56; // int | Количество запрашиваемых значений (максимум 5000)
$pattern = "pattern_example"; // string | Поиск по наименованию значения характеристики
try {
$result = $apiInstance->contentV1DirectoryCollectionsGet($top, $pattern);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling _Api->contentV1DirectoryCollectionsGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Calling apiV1SupplierIncomesGet API Endpoint in PHP
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/DefaultApi.md
This example shows how to fetch supplier incomes using the Wildberries PHP SDK. It covers configuring the API key, initializing the API client, setting the `date_from` filter, and implementing basic error handling for the API request.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\DefaultApi(
// 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
);
$date_from = "date_from_example"; // string | Дата в формате RFC3339. Можно передать дату или дату со временем. Время можно указывать с точностью до секунд или миллисекунд. Литера `Z` в конце строки означает, что время передается в UTC-часовом поясе. При ее отсутствии время считается в часовом поясе МСК (UTC+3).
Примеры:
- `2019-06-20`
- `2019-06-20T00:00:00Z`
- `2019-06-20T23:59:59`
- `2019-06-20T00:00:00.12345Z`
- `2019-06-20T00:00:00.12345`
- `2017-03-25T00:00:00`
try {
$result = $apiInstance->apiV1SupplierIncomesGet($date_from);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->apiV1SupplierIncomesGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Querying Directory Kinds (Wildberries API) - PHP
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/_Api.md
This snippet demonstrates how to call the contentV1DirectoryKindsGet method of the Wildberries API client in PHP. It shows how to configure the API key, instantiate the client, and make a request to get gender values. It includes basic error handling. This endpoint requires no parameters.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\_Api(
// 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
);
try {
$result = $apiInstance->contentV1DirectoryKindsGet();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling _Api->contentV1DirectoryKindsGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Fetch Supplier Sales Data (PHP)
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/DefaultApi.md
This PHP snippet demonstrates how to configure the Wildberries API client using an API key and call the `apiV1SupplierSalesGet` method. It requires the Wildberries client library and GuzzleHttp. The example sets the `date_from` and `flag` parameters and prints the result or catches exceptions.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\DefaultApi(
// 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
);
$date_from = "date_from_example"; // string | Дата в формате RFC3339. Можно передать дату или дату со временем. Время можно указывать с точностью до секунд или миллисекунд. Литера `Z` в конце строки означает, что время передается в UTC-часовом поясе. При ее отсутствии время считается в часовом поясе МСК (UTC+3).
Примеры: - `2019-06-20`
- `2019-06-20T00:00:00Z`
- `2019-06-20T23:59:59`
- `2019-06-20T00:00:00.12345Z`
- `2019-06-20T00:00:00.12345`
- `2017-03-25T00:00:00`
$flag = 0; // int | Если параметр `flag=0` (или не указан в строке запроса), при вызове API возвращаются данные, у которых значение поля `lastChangeDate` (дата время обновления информации в сервисе) больше или равно переданному значению параметра `dateFrom`. При этом количество возвращенных строк данных варьируется в интервале от 0 до примерно 100 000.
Если параметр `flag=1`, то будет выгружена информация обо всех заказах или продажах с датой, равной переданному параметру `dateFrom` (в данном случае время в дате значения не имеет). При этом количество возващенных строк данных будет равно количеству всех заказов или продаж, сделанных в указанную дату, переданную в параметре `dateFrom`.
try {
$result = $apiInstance->apiV1SupplierSalesGet($date_from, $flag);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->apiV1SupplierSalesGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Calling apiV1SupplierExciseGoodsGet API Method - PHP
Source: https://github.com/nik54rus/wildberries/blob/master/README.md
This snippet demonstrates calling the `apiV1SupplierExciseGoodsGet` method of the Wildberries PHP API client. It configures API key authentication, initializes the client, sets the required `date_from` parameter (with detailed format examples from comments), and performs the API call. The result is printed on success, and exceptions are caught and reported.
```PHP
// Configure API key authorization: HeaderApiKey
$config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\DefaultApi(
// 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
);
$date_from = "date_from_example"; // string | Дата в формате RFC3339. Можно передать дату или дату со временем. Время можно указывать с точностью до секунд или миллисекунд. Литера `Z` в конце строки означает, что время передается в UTC-часовом поясе. При ее отсутствии время считается в часовом поясе МСК (UTC+3).
Примеры: - `2019-06-20`
- `2019-06-20T00:00:00Z`
- `2019-06-20T23:59:59`
- `2019-06-20T00:00:00.12345Z`
- `2019-06-20T00:00:00.12345`
- `2017-03-25T00:00:00`
try {
$result = $apiInstance->apiV1SupplierExciseGoodsGet($date_from);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->apiV1SupplierExciseGoodsGet: ', $e->getMessage(), PHP_EOL;
}
```
--------------------------------
### Getting Supply Information using Wildberries Marketplace API PHP
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/Marketplace_Api.md
This snippet shows how to retrieve detailed information about a specific supply using the Wildberries Marketplace API. It sets up the client with an API key, specifies the supply identifier, calls the `apiV3SuppliesSupplyGet` method, and prints the result. It includes error handling.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\Marketplace_Api(
// 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
);
$supply = "supply_example"; // string | Идентификатор поставки
try {
$result = $apiInstance->apiV3SuppliesSupplyGet($supply);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling Marketplace_Api->apiV3SuppliesSupplyGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Getting Supplies List - Wildberries API - PHP
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/MarketplaceDeprecatedApi.md
Shows how to fetch a list of supplies from the Wildberries API using the `apiV2SuppliesGet` method. It requires a `status` parameter ('ACTIVE' or 'ON_DELIVERY') to filter the results and returns an `InlineResponse20020` object containing the list. Includes API key configuration and error handling.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\MarketplaceDeprecatedApi(
// 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
);
$status = "status_example"; // string | `ACTIVE` - активные поставки, `ON_DELIVERY` - поставки в пути (которые ещё не приняты на складе).
try {
$result = $apiInstance->apiV2SuppliesGet($status);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling MarketplaceDeprecatedApi->apiV2SuppliesGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Getting CPM Rates - Wildberries API - PHP
Source: https://github.com/nik54rus/wildberries/blob/master/README.md
Demonstrates how to fetch CPM (Cost Per Mille) rates for active advertising campaigns based on type and a specific parameter (menuId, subjectId, or setId). Requires the Wildberries PHP client and GuzzleHttp. Configures the API key and instantiates the DefaultApi client. Includes error handling.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\DefaultApi(
// 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
);
$type = 56; // int | - Тип РК:
4 - реклама в каталоге 5 - реклама в карточке товара 6 - реклама в поиске 7 - реклама в рекомендациях на главной странице
$param = 56; // int | Параметр запроса, по которому будет получен список ставок активных РК.
Должен быть значением `menuId`, `subjectId` или `setId` в зависимости от типа РК.
try {
$result = $apiInstance->advV0CpmGet($type, $param);
}
```
--------------------------------
### Adding Nomenclature to Card using Wildberries PHP Client
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/_Api.md
This example shows how to add new nomenclature (НМ) to an existing product card (КТ) asynchronously using the Wildberries PHP client. It initializes the client, sets the API key, prepares the request body using the `UploadAddBody` model, and calls the `contentV1CardsUploadAddPost` method.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\_Api(
// 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
);
$body = new \Wildberries\Client\Model\UploadAddBody(); // \Wildberries\Client\Model\UploadAddBody |
try {
$result = $apiInstance->contentV1CardsUploadAddPost($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling _Api->contentV1CardsUploadAddPost: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Calling contentV1CardsCursorListPost API in PHP
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/_Api.md
This example demonstrates how to use the Wildberries PHP client to call the `contentV1CardsCursorListPost` method. It covers setting up API key authentication, initializing the API client, preparing the request body, executing the API call, and handling potential exceptions. This method is used to retrieve a paginated list of product items.
```php
setApiKey('Authorization', 'YOUR_API_KEY');\n// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed\n// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');\n\n$apiInstance = new Wildberries\Client\Api\_Api(\n // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.\n // This is optional, `GuzzleHttp\Client` will be used as default.\n new GuzzleHttp\Client(),\n $config\n);\n$body = new \Wildberries\Client\Model\CursorListBody(); // \Wildberries\Client\Model\CursorListBody |\n\ntry {\n $result = $apiInstance->contentV1CardsCursorListPost($body);\n print_r($result);\n} catch (Exception $e) {\n echo 'Exception when calling _Api->contentV1CardsCursorListPost: ', $e->getMessage(), PHP_EOL;\n}\n?>
```
--------------------------------
### Calling advV0StartGet API Method - PHP
Source: https://github.com/nik54rus/wildberries/blob/master/README.md
This snippet demonstrates calling the `advV0StartGet` method using the Wildberries PHP API client. It includes API key configuration, client initialization, providing the campaign identifier (`id`), and performing the API call within a try-catch block for error handling.
```PHP
// Configure API key authorization: HeaderApiKey
$config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\DefaultApi(
// 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
);
$id = 56; // int | Идентификатор РК
try {
$apiInstance->advV0StartGet($id);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->advV0StartGet: ', $e->getMessage(), PHP_EOL;
}
```
--------------------------------
### Getting TNVED Codes by Category and Filter (PHP)
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/_Api.md
This example shows how to use the `contentV1DirectoryTnvedGet` method in PHP to fetch a list of TNVED codes. It requires initializing the API client with an API key and provides examples for passing optional `object_name` and `tnveds_like` parameters to filter the results.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\_Api(
// 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
);
$object_name = "object_name_example"; // string | Поиск по наименованию категории
$tnveds_like = "tnveds_like_example"; // string | Поиск по коду ТНВЭД
try {
$result = $apiInstance->contentV1DirectoryTnvedGet($object_name, $tnveds_like);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling _Api->contentV1DirectoryTnvedGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Creating a New Supply using PHP
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/Marketplace_Api.md
This PHP snippet demonstrates how to initialize the Wildberries API client, configure it with an API key, create a request body object for the new supply, and call the `apiV3SuppliesPost` method to create the supply. It includes basic error handling.
```php
setApiKey('Authorization', 'YOUR_API_KEY');\n// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed\n// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');\n\n$apiInstance = new Wildberries\Client\Api\Marketplace_Api(\n // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.\n // This is optional, `GuzzleHttp\Client` will be used as default.\n new GuzzleHttp\Client(),\n $config\n);\n$body = new \Wildberries\Client\Model\V3SuppliesBody(); // \Wildberries\Client\Model\V3SuppliesBody | \n\ntry {\n $result = $apiInstance->apiV3SuppliesPost($body);\n print_r($result);\n} catch (Exception $e) {\n echo 'Exception when calling Marketplace_Api->apiV3SuppliesPost: ', $e->getMessage(), PHP_EOL;\n}\n?>
```
--------------------------------
### Get Advertisement Campaign Info - PHP
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/DefaultApi.md
This example demonstrates how to use the `advV0AdvertGet` method to retrieve information about a specific advertisement campaign using its ID. It requires the Wildberries PHP client library and an API key for authorization. The API key is configured using `setApiKey`.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\DefaultApi(
// 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
);
$id = 56; // int | Идентификатор РК
try {
$result = $apiInstance->advV0AdvertGet($id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->advV0AdvertGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Getting Wildberries Stocks (Deprecated) - PHP
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/MarketplaceDeprecatedApi.md
This example initializes the Wildberries API client and calls the `apiV2StocksGet` method to retrieve a paginated list of stocks. It takes parameters for skipping records (`skip`), limiting results (`take`), and an optional search string (`search`). Basic error handling is included.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\MarketplaceDeprecatedApi(
// 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
);
$skip = 56; // int | Сколько записей пропустить (для пагинации).
$take = 56; // int | Сколько записей выдать (для пагинации).
$search = "search_example"; // string | Поиск по всем полям таблицы.
try {
$result = $apiInstance->apiV2StocksGet($skip, $take, $search);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling MarketplaceDeprecatedApi->apiV2StocksGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Set Prices Wildberries API PHP
Source: https://github.com/nik54rus/wildberries/blob/master/README.md
This snippet shows the initial setup for setting prices using the Wildberries API PHP client. It configures the API key and instance and initializes the request body as an array of `V1PricesBody` objects. The actual API call (`apiV1PricesPost`) and error handling are incomplete in the provided text. It requires the Wildberries client and GuzzleHttp.
```php
// Configure API key authorization: HeaderApiKey
$config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\DefaultApi(
// 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
);
$body = array(new \Wildberries\Client\Model\V1PricesBody()); // \Wildberries\Client\Model\V1PricesBody[] |
try {
```
--------------------------------
### Pausing Advertising Campaign (advV0PauseGet) in PHP
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/DefaultApi.md
This example shows how to pause an advertising campaign that is currently running (status 9) by calling the `/api/v0/pause` endpoint with a GET request. It requires providing the integer ID of the campaign to be paused. The client is initialized with the API key, and the call is handled within a try-catch block.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\DefaultApi(
// 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
);
$id = 56; // int | Идентификатор РК
try {
$apiInstance->advV0PauseGet($id);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->advV0PauseGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Fetching New Orders - Wildberries PHP
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/Marketplace_Api.md
Illustrates how to fetch a list of new assembly tasks (orders) using the `apiV3OrdersNewGet` method of the Wildberries PHP client. It covers API key configuration, client initialization, and calling the method which requires no parameters. Includes basic error handling.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\Marketplace_Api(
// 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
);
try {
$result = $apiInstance->apiV3OrdersNewGet();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling Marketplace_Api->apiV3OrdersNewGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Get Order Statuses using Wildberries PHP Client
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/Marketplace_Api.md
This PHP example demonstrates how to use the Wildberries API client library to call the `apiV3OrdersStatusPost` method. It configures API key authentication, initializes the API client, creates a request body object, and calls the method within a try-catch block to retrieve and print the statuses of fulfillment tasks.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\Marketplace_Api(
// 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
);
$body = new \Wildberries\Client\Model\OrdersStatusBody(); // \Wildberries\Client\Model\OrdersStatusBody |
try {
$result = $apiInstance->apiV3OrdersStatusPost($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling Marketplace_Api->apiV3OrdersStatusPost: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Uploading Media File using contentV1MediaFilePost (PHP)
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/_Api.md
This snippet demonstrates how to upload a media file to a product using the `contentV1MediaFilePost` API method. It requires setting up the API key, initializing the API client (using GuzzleHttp), and providing the file path, vendor code, and photo number. It includes basic error handling.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\_Api(
// 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
);
$uploadfile = "uploadfile_example"; // string |
$x_vendor_code = "x_vendor_code_example"; // string | Артикул НМ
$x_photo_number = 56; // int | Номер медиафайла на загрузку. Начинать с 1.
Чтобы добавить фото к уже загруженным в НМ, номер медиафайла должен быть больше кол-ва загруженных в НМ медиафайлов.
try {
$result = $apiInstance->contentV1MediaFilePost($uploadfile, $x_vendor_code, $x_photo_number);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling _Api->contentV1MediaFilePost: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Get Wildberries Warehouses (PHP)
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/Marketplace_Api.md
This code snippet demonstrates how to use the Wildberries PHP API client to retrieve a list of warehouses associated with the supplier. It requires configuring the API key for authorization.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\Marketplace_Api(
// 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
);
try {
$result = $apiInstance->apiV2WarehousesGet();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling Marketplace_Api->apiV2WarehousesGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Getting Reshipment Orders - Wildberries API - PHP
Source: https://github.com/nik54rus/wildberries/blob/master/docs/Api/Marketplace_Api.md
This snippet shows how to fetch all reshipment orders using the `apiV3SuppliesOrdersReshipmentGet` method of the Wildberries API. This endpoint does not require any parameters. Requires API key authorization.
```php
setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Wildberries\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new Wildberries\Client\Api\Marketplace_Api(
// 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
);
try {
$result = $apiInstance->apiV3SuppliesOrdersReshipmentGet();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling Marketplace_Api->apiV3SuppliesOrdersReshipmentGet: ', $e->getMessage(), PHP_EOL;
}
?>
```