### Requesting All Resources via Business.ru API Source: https://github.com/business-ru/business-online-sdk-php/blob/master/README.md Demonstrates fetching all resources of a given model without specific filters using the requestAll method. This example retrieves all goods available in the system. ```php //Вернет все товары $api->requestAll('goods'); ``` -------------------------------- ### Deleting a Resource via Business.ru API Source: https://github.com/business-ru/business-online-sdk-php/blob/master/README.md Demonstrates how to send a DELETE request to the Business.ru API using the client's request method. This example specifically targets and deletes a task by its ID. ```php //Удалить задачу с ID 224 $api->request('delete', 'tasks', ['id' => 224]); ``` -------------------------------- ### Requesting All Resources of a Specific Type via Business.ru API Source: https://github.com/business-ru/business-online-sdk-php/blob/master/README.md Shows how to use the requestAll method to fetch multiple resources of a specific model, optionally filtered by parameters. This example retrieves all tasks with a task type ID of 2. ```php //Вернет все задачи с типом 2 $api->requestAll('tasks', ['task_type_id' => 2]); ``` -------------------------------- ### Creating a Resource via Business.ru API Source: https://github.com/business-ru/business-online-sdk-php/blob/master/README.md Illustrates sending a POST request to the Business.ru API to create a new resource. This snippet creates a new task with a specified type, description, and author employee ID. ```php //Создать задачу c описанием 'Задача создана с помощью API' $api->request('post', 'tasks', ['task_type_id' => 2, 'description' => 'Задача создана с помощью API', 'author_employee_id' => 44224]); ``` -------------------------------- ### Initializing Business.ru PHP Client Source: https://github.com/business-ru/business-online-sdk-php/blob/master/README.md Initializes a new instance of the Business.ru API client with the provided application ID, user ID, secret key, and an optional sleep flag. This object is used for making subsequent API calls. ```php //Создаем обьект для работы с API сайта https://a13344.business.ru $api = new Client('a13344', 2134124, 'CWZf963mlm0srCKXu8LPepSq69uEv6Hf', true); ``` -------------------------------- ### Setting PSR-3 Logger for Business.ru Client Source: https://github.com/business-ru/business-online-sdk-php/blob/master/README.md Configures the Business.ru API client to use a custom logger that implements the Psr\Log\LoggerInterface. This enables logging of API interactions according to the PSR-3 standard. ```php //Устанавливаем свой логгер $api->setLogger($myLogger); ``` -------------------------------- ### Sending Notification via Business.ru API Source: https://github.com/business-ru/business-online-sdk-php/blob/master/README.md Explains how to send a notification to one or more users using the sendNotification method. The method accepts an array specifying recipient employee IDs, notification header, and message body. ```php //Отправить пользователя 12345 уведомление $api->sendNotification(['employee_ids' => [12345], 'header' => 'Это заголовок уведомления', 'message' => 'Это текст сообщения']); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.