Automation api Endpoint
This commit is contained in:
parent
821c0926e8
commit
38b29a2a4a
@ -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');
|
||||
|
22
app/api/AutomationsApi.php
Normal file
22
app/api/AutomationsApi.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
class AutomationsApi extends ApiController
|
||||
{
|
||||
|
||||
public function default()
|
||||
{
|
||||
//$this->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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user