diff --git a/app/Routes.php b/app/Routes.php index d5e646b..cbc72a0 100644 --- a/app/Routes.php +++ b/app/Routes.php @@ -40,6 +40,9 @@ $router->post('/api/widgets/{widgetId}/run', 'WidgetApi@run'); $router->get('/api/widgets/{widgetId}/detail', 'WidgetApi@detail'); $router->get('/api/widgets/{widgetId}/detail/{period}', 'WidgetApi@detail'); +$router->get('/api/automations', 'AutomationsApi@default'); + + //cron $router->post('/cron/clean', 'CronApi@clean'); diff --git a/app/api/AutomationsApi.php b/app/api/AutomationsApi.php new file mode 100644 index 0000000..1f45ce9 --- /dev/null +++ b/app/api/AutomationsApi.php @@ -0,0 +1,22 @@ +requireAuth(); + $response = []; + $automationData = AutomationManager::getAll(); + + foreach ($automationData as $automationKey => $automation) { + $response[] = [ + "automation_id" => $automation['automation_id'], + "name" => $automation['name'], + "enabled" => $automation['enabled'], + ]; + } + + $this->response($response); + } +}