| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #include "api_v1_calls.h" |
| 4 | |
| 5 | int api_v1_ml_info(RRDHOST *host, struct web_client *w, char *url) { |
| 6 | (void) url; |
| 7 | #if defined(ENABLE_ML) |
| 8 | |
| 9 | if (!netdata_ready_load()) |
| 10 | return HTTP_RESP_SERVICE_UNAVAILABLE; |
| 11 | |
| 12 | BUFFER *wb = w->response.data; |
| 13 | buffer_flush(wb); |
| 14 | wb->content_type = CT_APPLICATION_JSON; |
| 15 | |
| 16 | buffer_json_initialize(wb, "\"", "\"", 0, true, BUFFER_JSON_OPTIONS_DEFAULT); |
| 17 | ml_host_get_detection_info(host, wb); |
| 18 | buffer_json_finalize(wb); |
| 19 | |
| 20 | buffer_no_cacheable(wb); |
| 21 | |
| 22 | return HTTP_RESP_OK; |
| 23 | #else |
| 24 | UNUSED(host); |
| 25 | UNUSED(w); |
| 26 | return HTTP_RESP_SERVICE_UNAVAILABLE; |
| 27 | #endif // ENABLE_ML |
| 28 | } |