// ПОЛУЧЕНИЕ СПИСКА ЗАЯВОК (Строго по актуальной доке Ozon с курсором last_id и статусом NEW) function oda_fetch_ozon_discount_requests($creds, $shop_name) { $url = 'https://api-seller.ozon.ru/v2/actions/discounts-task/list'; // Формируем тело строго по доке: без "page", статус КАПСОМ, limit из списка enum $body = json_encode([ "filter" => [ "status" => "NEW" // Ищем только новые, чтобы не гонять архивные ], "limit" => 50 // "last_id" при первом запросе оставляем пустым (не передаем) ]); $response = wp_remote_post($url, [ 'headers' => [ 'Client-Id' => trim($creds['client_id']), 'Api-Key' => trim($creds['api_key']), 'Content-Type' => 'application/json' ], 'body' => $body, 'timeout' => 15 ]); if (is_wp_error($response)) { oda_log_to_file($shop_name, '-', '-', 0, 'error', 'WP_Error: ' . $response->get_error_message()); return []; } $code = wp_remote_retrieve_response_code($response); $response_body = wp_remote_retrieve_body($response); if ($code !== 200) { oda_log_to_file($shop_name, '-', '-', 0, 'error', "Код: {$code}. Ответ: " . substr($response_body, 0, 120)); return []; } $data = json_decode($response_body, true); // Данные по доке лежат в result -> items $requests = $data['result']['items'] ?? []; if (empty($requests)) { oda_log_to_file($shop_name, '-', '-', 0, 'info', 'Связь 200. Озон вернул пустой список items для статуса NEW. Проверьте ЛК.'); } else { $count = count($requests); oda_log_to_file($shop_name, 'OK_V2', '-', 0, 'info', "Успешно найдено новых заявок (NEW): {$count}"); } return $requests; }Forbidden - Visitors from your country are not permitted to browse this site.