Class: Api::V2::MonitoringResultsController

Inherits:
V2::BaseController
  • Object
show all
Includes:
Api::Version2, Foreman::Controller::SmartProxyAuth
Defined in:
app/controllers/api/v2/monitoring_results_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/api/v2/monitoring_results_controller.rb', line 20

def create
  begin
    MonitoringResult.import(monitoring_result_params.to_h.with_indifferent_access)
  rescue StandardError => e
    Foreman::Logging.exception('Failed to import monitoring result', e)
    render :json => { 'message' => e.message }, :status => :unprocessable_entity
    return
  end

  render :json => { 'message' => 'OK' }
end